:root {
    --forest-900: #173228;
    --forest-700: #24513f;
    --forest-500: #39755a;
    --pine-400: #5d9367;
    --pine-200: #b9d1bc;
    --pine-100: #dce8dc;
    --paper: #f7f4ee;
    --card: #fffdfa;
    --ink: #1d2a23;
    --muted: #64756a;
    --danger: #9b3f3f;
    --success: #2d6a4f;
    --shadow: 0 18px 42px rgba(23, 50, 40, 0.09);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(93, 147, 103, 0.18), transparent 30%),
        linear-gradient(180deg, #f8f6f0 0%, #f1eee5 100%);
}

a {
    color: var(--forest-700);
    text-decoration: none;
}

img {
    max-width: 100%;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.guest-shell,
.public-form-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 18px;
}

.sidebar {
    background: linear-gradient(180deg, var(--forest-900) 0%, #10231c 100%);
    color: #f3f0e9;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-lockup span,
.topbar p,
.subtle,
.workspace-card span,
.mini-card p {
    color: var(--muted);
}

.sidebar .brand-lockup span {
    color: rgba(255, 255, 255, 0.72);
    display: block;
    font-size: 0.9rem;
}

.brand-mark {
    width: 48px;
    height: 48px;
}

.brand-mark.large {
    width: 72px;
    height: 72px;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.sidebar-nav a {
    color: #eef7f0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
    margin-top: auto;
}

.workspace-pill {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
}

.main-shell {
    padding: 28px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.flash {
    border-radius: 14px;
    padding: 14px 16px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.flash-success {
    border-left: 4px solid var(--success);
}

.flash-error {
    border-left: 4px solid var(--danger);
}

.stats-grid,
.panel-grid,
.card-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 18px;
}

.panel-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stat-card,
.panel,
.auth-card,
.public-form-card,
.mini-card {
    background: rgba(255, 253, 250, 0.92);
    border: 1px solid rgba(36, 81, 63, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2rem;
}

.panel,
.mini-card {
    padding: 22px;
}

.panel-heading,
.action-row,
.inline-actions,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wrap {
    flex-wrap: wrap;
}

.stacked-form,
.workspace-list {
    display: grid;
    gap: 14px;
}

.two-column-form {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

label span,
details summary {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d3ddd5;
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

.primary-button,
.ghost-button,
.link-button {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
}

.primary-button {
    background: linear-gradient(135deg, var(--forest-700), var(--pine-400));
    color: #fff;
}

.ghost-button {
    background: var(--pine-100);
    color: var(--forest-900);
}

.link-button {
    background: transparent;
    color: var(--forest-700);
    padding: 0;
}

.full-width {
    width: 100%;
}

.text-link {
    font-weight: 700;
}

.toolbar-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    margin-bottom: 18px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e5ebe6;
    vertical-align: top;
}

.status-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--pine-100);
    color: var(--forest-900);
    font-size: 0.85rem;
}

.auth-card,
.public-form-card {
    width: min(720px, 100%);
    padding: 28px;
}

.auth-card-wide {
    width: min(860px, 100%);
}

.auth-brand {
    text-align: center;
    margin-bottom: 20px;
}

.workspace-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #e4ebe4;
    background: #fff;
}

.mini-card textarea {
    margin-top: 10px;
}

.step-list {
    margin: 0;
    padding-left: 18px;
}

.automation-builder {
    display: grid;
    gap: 12px;
}

.builder-row {
    display: grid;
    grid-template-columns: 1fr 1fr 140px;
    gap: 12px;
}

.honeypot {
    position: absolute;
    left: -9999px;
}

hr {
    border: 0;
    border-top: 1px solid #e3e9e3;
    margin: 20px 0;
}

code {
    background: #eef3ef;
    padding: 2px 6px;
    border-radius: 8px;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding-bottom: 18px;
    }

    .main-shell {
        padding: 20px;
    }
}

@media (max-width: 760px) {
    .two-column-form,
    .toolbar-grid,
    .builder-row {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }
}
