/* GreenTomatoMedia portal — brand palette + UI primitives */

:root {
    /* Brand palette extracted from logo-GTM-new.png */
    --brand-primary: #9CC73D;
    --brand-primary-hover: #84AB30;
    --brand-primary-light: #ECF3D5;
    --brand-primary-pale: #F7FAEC;
    --brand-accent: #5A6F1D;

    /* Neutrals */
    --bg-page: #FAFAF8;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-muted: #F4F5F1;
    --border: #E5E7DF;
    --border-strong: #CFD3C5;

    /* Text */
    --text-primary: #1F2622;
    --text-secondary: #4D544A;
    --text-muted: #7A816F;
    --text-on-brand: #1F2622;

    /* Status */
    --status-active: #2E8540;
    --status-active-bg: #E6F2E8;
    --status-archived: #6B7280;
    --status-archived-bg: #EEEFEC;
    --status-paused: #B45309;
    --status-paused-bg: #FEF3C7;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(31, 38, 34, 0.04);
    --shadow-md: 0 2px 8px rgba(31, 38, 34, 0.06);
    --shadow-lg: 0 8px 24px rgba(31, 38, 34, 0.08);

    /* Radii + spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--text-primary); margin: 0; line-height: 1.25; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.0625rem; font-weight: 600; }
h4 { font-size: 0.9375rem; font-weight: 600; color: var(--text-secondary); }

p { margin: 0 0 0.5rem 0; }

code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.85em;
    background: var(--bg-muted);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

/* ============================================================ */
/* Auth pages (login / register / home anonymous)                */
/* ============================================================ */

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 0%, var(--brand-primary-pale) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, var(--brand-primary-pale) 0%, transparent 40%),
        var(--bg-page);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px 32px;
    text-align: center;
}

.auth-card .brand-logo {
    height: 72px;
    width: auto;
    margin: 0 auto 16px;
    display: block;
}

.auth-card h1 {
    font-size: 1.375rem;
    margin-bottom: 4px;
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 28px;
}

.auth-card form { text-align: left; }
.auth-card .form-group { margin-bottom: 16px; }

.auth-card .nav-links {
    margin-top: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-card .nav-links a { color: var(--brand-accent); }

/* ============================================================ */
/* Form primitives                                               */
/* ============================================================ */

label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

input[type="text"], input[type="email"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

/* ============================================================ */
/* Buttons                                                       */
/* ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--brand-primary);
    color: var(--text-on-brand);
}
.btn-primary:hover { background: var(--brand-primary-hover); text-decoration: none; }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-muted); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-muted); text-decoration: none; }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.875rem; }

/* ============================================================ */
/* Alerts                                                        */
/* ============================================================ */

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid;
    text-align: left;
}
.alert-danger { background: #FEF1F1; border-color: #F8C7C7; color: #842029; }
.alert-success { background: var(--brand-primary-light); border-color: var(--brand-primary); color: var(--brand-accent); }
.alert h4 { margin-bottom: 4px; font-size: 0.9375rem; color: inherit; }
.alert-dismissible .close {
    background: transparent; border: none; font-size: 1.25rem;
    color: inherit; opacity: 0.5; cursor: pointer; float: right;
}

/* ============================================================ */
/* Portal shell — sidebar + main                                 */
/* ============================================================ */

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

.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.sidebar-brand img { height: 36px; width: auto; }
.sidebar-brand .brand-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}
.sidebar-brand .brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.1s;
}
.nav-link:hover { background: var(--bg-muted); text-decoration: none; }
.nav-link.active { background: var(--brand-primary-light); color: var(--brand-accent); font-weight: 600; }
.nav-link .icon { font-size: 1.125rem; line-height: 1; }

.nav-spacer { flex: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    font-size: 0.875rem;
}
.sidebar-footer .user-info {
    padding: 8px 12px;
    color: var(--text-secondary);
}
.sidebar-footer .user-info strong { display: block; color: var(--text-primary); }
.sidebar-footer .user-info .role {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--brand-primary-light);
    color: var(--brand-accent);
    font-size: 0.75rem;
    font-weight: 600;
}

.main {
    padding: 32px 40px 64px;
    max-width: 1200px;
    width: 100%;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.page-header .crumb {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.page-header h1 { font-size: 1.625rem; }
.page-header .subtitle {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.9375rem;
}

/* ============================================================ */
/* Cards, grids, badges                                          */
/* ============================================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.card:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.card h3 { margin-bottom: 4px; }
.card .meta { color: var(--text-muted); font-size: 0.8125rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.stat .label {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat .value {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 6px;
    color: var(--text-primary);
}
.stat .delta { color: var(--text-muted); font-size: 0.8125rem; margin-top: 4px; }

.section { margin-bottom: 36px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
}
.section-header h2 { font-size: 1.0625rem; }
.section-header .meta { color: var(--text-muted); font-size: 0.8125rem; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge-active { background: var(--status-active-bg); color: var(--status-active); }
.badge-archived { background: var(--status-archived-bg); color: var(--status-archived); }
.badge-paused { background: var(--status-paused-bg); color: var(--status-paused); }
.badge-role { background: var(--brand-primary-light); color: var(--brand-accent); }
.badge-lead { background: #FEF3C7; color: #92400E; }

/* ============================================================ */
/* Tables                                                        */
/* ============================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}
.table th {
    background: var(--bg-muted);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: var(--brand-primary-pale); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

/* ============================================================ */
/* Detail page two-column layout                                 */
/* ============================================================ */

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
.detail-grid .panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
}
.detail-grid .panel h3 {
    font-size: 0.9375rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.kv {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
}
.kv dt {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}
.kv dd {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9375rem;
    word-break: break-all;
}
.kv dd.empty { color: var(--text-muted); font-style: italic; }

/* ============================================================ */
/* Responsive                                                    */
/* ============================================================ */

@media (max-width: 900px) {
    .portal-shell { grid-template-columns: 1fr; }
    .sidebar {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-brand { padding-bottom: 0; border-bottom: none; margin-bottom: 0; flex-shrink: 0; }
    .sidebar-brand .brand-name, .sidebar-brand .brand-sub { display: none; }
    .nav-section-title, .sidebar-footer { display: none; }
    .nav-link { white-space: nowrap; }
    .main { padding: 20px; }
    .detail-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 4px 0; }
    .kv dt { font-size: 0.75rem; text-transform: uppercase; }
}
