@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #C89B3C;
    --primary-dark: #A67C25;
    --primary-light: #FBF1DC;
    --gold-soft: #E8C877;
    --ink: #1C1C1A;
    --text-secondary: #5F5E5A;
    --text-muted: #928E80;
    --border: #E9E2D0;
    --surface: #FFFFFF;
    --surface-tint: #FAF7EF;
    --green: #16A34A;
    --green-bg: #EAF3DE;
    --orange: #F5A623;
    --orange-bg: #FAEEDA;
    --blue: #2563EB;
    --radius: 10px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--surface);
}

/* ============ Auth pages (login + admin create-user) ============ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(200,155,60,0.14), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(200,155,60,0.10), transparent 45%),
        var(--surface-tint);
}

.auth-shell {
    display: flex;
    width: 100%;
    max-width: 880px;
    min-height: 560px;
    background: var(--surface);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 60px -20px rgba(120,90,20,0.22), 0 0 0 1px rgba(200,155,60,0.10);
}

/* Left brand panel */
.auth-brand {
    flex: 1;
    background: linear-gradient(155deg, var(--gold-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
    color: #fff;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-brand::before {
    content: "";
    position: absolute;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    top: -120px; right: -100px;
}
.auth-brand::after {
    content: "";
    position: absolute;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
    bottom: -80px; left: -60px;
}
.auth-brand-top { position: relative; z-index: 1; }
.auth-brand-bottom { position: relative; z-index: 1; }
.auth-brand h2 {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.35;
    margin: 2.5rem 0 0.75rem;
    text-shadow: 0 1px 12px rgba(0,0,0,0.08);
}
.auth-brand p {
    font-size: 14px;
    opacity: 0.92;
    line-height: 1.6;
    max-width: 320px;
    margin: 0;
}
.auth-brand-quote {
    font-size: 13px;
    opacity: 0.85;
    border-left: 2px solid rgba(255,255,255,0.55);
    padding-left: 12px;
    line-height: 1.5;
}

/* Right form panel */
.auth-form-panel {
    flex: 1;
    padding: 3rem 2.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-form-panel h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.auth-subtext {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 28px;
    line-height: 1.5;
}

.login-logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(145deg, var(--gold-soft), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px;
    box-shadow: 0 4px 10px rgba(166,124,37,0.4);
}
.auth-brand .logo-mark { background: rgba(255,255,255,0.22); box-shadow: none; }
.logo-title { font-weight: 700; font-size: 14px; letter-spacing: 0.6px; }
.logo-subtitle { font-size: 10px; opacity: 0.75; letter-spacing: 1.6px; }

.form-error {
    background: #FCEBEB; color: #8A2323;
    border: 1px solid #F3CACA;
    border-radius: 10px; padding: 11px 14px;
    font-size: 13px; margin-bottom: 1.25rem;
    display: flex; align-items: center; gap: 8px;
}
.form-success {
    background: var(--primary-light); color: #6B4E12;
    border: 1px solid #EAD6A0;
    border-radius: 10px; padding: 14px 16px;
    font-size: 13px; line-height: 1.7; margin-bottom: 1.25rem;
}
.form-success strong { font-weight: 700; }

form.auth-form label {
    display: block; font-size: 12.5px; font-weight: 600;
    color: var(--text-secondary); margin: 16px 0 6px;
    text-transform: uppercase; letter-spacing: 0.03em;
}
form.auth-form label:first-of-type { margin-top: 0; }
form.auth-form input {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--border); border-radius: 10px;
    font-size: 14.5px; font-family: inherit;
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(200,155,60,0.16);
}
form.auth-form input::placeholder { color: var(--text-muted); }

.btn-primary {
    width: 100%; margin-top: 26px; padding: 13px;
    background: linear-gradient(135deg, var(--gold-soft), var(--primary) 60%, var(--primary-dark));
    color: #fff;
    border: none; border-radius: 10px;
    font-size: 14.5px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 20px -6px rgba(166,124,37,0.55);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.auth-footnote {
    margin-top: 22px; font-size: 12.5px; color: var(--text-muted); text-align: center;
}

@media (max-width: 720px) {
    .auth-shell { flex-direction: column; max-width: 420px; min-height: 0; }
    .auth-brand { padding: 2rem; }
    .auth-brand h2 { font-size: 20px; margin-top: 1.5rem; }
    .auth-form-panel { padding: 2rem; }
}

/* ============ App shell (dashboard etc.) ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--surface-tint);
    border-right: 0.5px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex; flex-direction: column;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 1.5rem; }
.sidebar-section-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
    color: var(--text-muted); padding: 0 10px 8px;
}
.nav-item {
    display: block; padding: 9px 10px; border-radius: var(--radius);
    font-size: 14px; color: var(--text-secondary);
    text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.sidebar-divider { border-top: 0.5px solid var(--border); margin: 12px 0; }
.upgrade-card {
    margin-top: auto;
    background: linear-gradient(155deg, var(--gold-soft), var(--primary-dark));
    color: #fff;
    border-radius: 12px; padding: 1rem;
}
.upgrade-title { font-weight: 700; font-size: 14px; margin: 0 0 4px; }
.upgrade-text { font-size: 12px; opacity: 0.9; margin: 0 0 12px; }
.btn-upgrade {
    display: block; text-align: center; background: #fff; color: var(--primary-dark);
    border-radius: 8px; padding: 8px; font-size: 13px; font-weight: 600;
    text-decoration: none;
}

.main { flex: 1; padding: 1.5rem 2rem; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.topbar h1 { font-size: 22px; margin: 0 0 4px; }
.topbar-subtext { font-size: 13px; color: var(--text-secondary); margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.icon-btn {
    position: relative; background: none; border: none; font-size: 18px; cursor: pointer;
}
.badge {
    position: absolute; top: -4px; right: -6px;
    background: var(--primary); color: #fff;
    font-size: 10px; padding: 1px 5px; border-radius: 10px;
}
.user-menu { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.avatar-circle {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(145deg, var(--gold-soft), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.logout-link { font-size: 12px; color: var(--text-muted); text-decoration: none; margin-left: 6px; }

/* Stat cards */
.stat-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 14px; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface); border: 0.5px solid var(--border); border-radius: 14px;
    padding: 1rem; display: flex; gap: 12px; align-items: flex-start;
}
.stat-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.icon-purple { background: var(--primary-light); }
.icon-green { background: var(--green-bg); }
.icon-orange { background: var(--orange-bg); }
.icon-blue { background: #E6F1FB; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin: 0 0 2px; }
.stat-value { font-size: 22px; font-weight: 700; margin: 0; }
.stat-note { font-size: 12px; color: var(--orange); margin: 2px 0 0; }

/* Panels */
.panel-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.panel {
    background: var(--surface-tint); border-radius: 14px; padding: 1.25rem;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-header h2 { font-size: 15px; margin: 0; }
.panel-link { font-size: 12px; color: var(--primary-dark); text-decoration: none; font-weight: 600; }
.empty-state { font-size: 13px; color: var(--text-muted); }
.row-card {
    background: var(--surface); border: 0.5px solid var(--border); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 8px;
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.row-title { font-size: 13px; font-weight: 600; margin: 0; }
.row-meta { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; }
.row-right { text-align: right; }
.row-rate { font-size: 12px; font-weight: 600; margin: 0; color: var(--green); }
.row-match { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; }
.status-pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.status-in_progress { background: #E6F1FB; color: #0C447C; }
.status-review { background: var(--orange-bg); color: #854F0B; }
.status-done { background: var(--green-bg); color: #27500A; }
.pay-status { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.pay-paid { background: var(--green-bg); color: #27500A; }
.pay-pending { background: var(--orange-bg); color: #854F0B; }

@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .panel-grid { grid-template-columns: 1fr; }
}

/* ============ Sub-page shared styles ============ */
.content-card {
    background: var(--surface-tint); border-radius: 14px;
    padding: 1.5rem; margin-bottom: 1.25rem;
}
.content-card h2 { font-size: 16px; margin: 0 0 4px; }
.content-card .card-subtext { font-size: 13px; color: var(--text-secondary); margin: 0 0 16px; }

.list-row {
    background: var(--surface); border: 0.5px solid var(--border); border-radius: 10px;
    padding: 14px 16px; margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap;
}
.list-row .list-title { font-size: 14px; font-weight: 600; margin: 0; }
.list-row .list-meta { font-size: 12px; color: var(--text-muted); margin: 3px 0 0; }
.progress-track {
    width: 100%; height: 6px; background: var(--border); border-radius: 4px; margin-top: 8px; overflow: hidden;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold-soft), var(--primary-dark)); border-radius: 4px; }

table.simple-table { width: 100%; border-collapse: collapse; }
table.simple-table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); font-weight: 600; padding: 0 12px 10px;
}
table.simple-table td {
    background: var(--surface); padding: 12px; font-size: 13.5px;
    border-top: 0.5px solid var(--border);
}
table.simple-table tr td:first-child { border-radius: 10px 0 0 10px; }
table.simple-table tr td:last-child { border-radius: 0 10px 10px 0; }

.form-standalone {
    background: var(--surface); border: 0.5px solid var(--border); border-radius: 14px;
    padding: 1.5rem; max-width: 480px;
}
.form-standalone label {
    display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
    margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.03em;
}
.form-standalone label:first-of-type { margin-top: 0; }
.form-standalone input, .form-standalone textarea {
    width: 100%; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 9px;
    font-size: 14px; font-family: inherit; background: var(--surface);
}
.form-standalone input:focus, .form-standalone textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(200,155,60,0.14);
}
.btn-standalone {
    margin-top: 18px; padding: 11px 22px;
    background: linear-gradient(135deg, var(--gold-soft), var(--primary) 60%, var(--primary-dark));
    color: #fff; border: none; border-radius: 9px; font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.btn-standalone:hover { filter: brightness(1.05); }

.placeholder-panel {
    background: var(--surface-tint); border-radius: 16px;
    padding: 3.5rem 2rem; text-align: center;
}
.placeholder-icon {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
    background: linear-gradient(145deg, var(--gold-soft), var(--primary-dark));
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.placeholder-panel h2 { font-size: 18px; margin: 0 0 6px; }
.placeholder-panel p { font-size: 13.5px; color: var(--text-secondary); max-width: 400px; margin: 0 auto; }

.badge-soon {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
    color: var(--primary-dark); background: var(--primary-light);
    padding: 3px 10px; border-radius: 20px; margin-bottom: 10px;
}

.avatar-lg {
    width: 64px; height: 64px; border-radius: 50%;
    background: linear-gradient(145deg, var(--gold-soft), var(--primary-dark));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700; margin-bottom: 4px;
}

.tab-row { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
    padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
    text-decoration: none;
}
.tab-btn.active { background: var(--primary-light); color: var(--primary-dark); border-color: transparent; }

/* ============ Enterprise dashboard ============ */
.ent-topbar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; gap: 16px; flex-wrap: wrap;
}
.ent-search {
    flex: 1; max-width: 340px; padding: 9px 14px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 13px; color: var(--text-muted); background: var(--surface);
}
.btn-new-need {
    padding: 10px 18px; border-radius: 9px; border: none; font-size: 13.5px; font-weight: 600;
    background: linear-gradient(135deg, var(--gold-soft), var(--primary) 60%, var(--primary-dark));
    color: #fff; cursor: pointer; white-space: nowrap;
}

.ent-stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; margin-bottom: 1.25rem; }
.ent-stat-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: 14px; padding: 1rem; }
.ent-stat-card .stat-label { margin-bottom: 8px; }
.ent-stat-card .stat-value { font-size: 24px; }
.ent-stat-card .stat-note { color: var(--green); }
.ent-stat-card .stat-note.down { color: var(--green); }

.ent-panel-row { display: grid; grid-template-columns: 2fr 1.3fr; gap: 16px; margin-bottom: 16px; }
.ent-panel-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* Pipeline */
.pipeline-track { display: flex; align-items: center; margin-bottom: 18px; }
.pipeline-node {
    width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
    color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pipeline-node.muted { background: var(--border); color: var(--text-muted); }
.pipeline-line { flex: 1; height: 2px; background: var(--border); margin: 0 6px; }
.pipeline-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin: -12px 0 16px; text-align: center; }
.pipeline-labels span { flex: 1; }

/* AI recommendation card */
.ai-rec-item { display: flex; gap: 12px; padding: 12px 0; border-top: 0.5px solid var(--border); }
.ai-rec-item:first-of-type { border-top: none; padding-top: 0; }
.ai-rec-icon {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.ai-rec-title { font-size: 13px; font-weight: 600; margin: 0 0 2px; }
.ai-rec-text { font-size: 12px; color: var(--text-secondary); margin: 0; }
.ai-rec-tag {
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
    background: var(--primary-light); color: var(--primary-dark); white-space: nowrap;
}

/* Alerts */
.alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 0.5px solid var(--border); }
.alert-item:first-of-type { border-top: none; padding-top: 0; }
.alert-icon {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}

/* Mini bar chart */
.mini-bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.mini-bar-group { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.mini-bar { flex: 1; border-radius: 3px 3px 0 0; }
.mini-bar.budget { background: var(--primary-light); }
.mini-bar.actual { background: linear-gradient(180deg, var(--gold-soft), var(--primary-dark)); }
.mini-bar-labels { display: flex; gap: 10px; margin-top: 8px; }
.mini-bar-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--text-muted); }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut {
    width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--primary-dark) 0% 45%, var(--gold-soft) 45% 70%, #E6D8B8 70% 85%, var(--border) 85% 95%, #D8D3C4 95% 100%);
}
.donut-center {
    width: 74px; height: 74px; border-radius: 50%; background: var(--surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-center strong { font-size: 15px; }
.donut-center span { font-size: 10px; color: var(--text-muted); }
.donut-legend { font-size: 12px; }
.donut-legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Gauge */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.gauge {
    width: 130px; height: 65px; border-radius: 130px 130px 0 0; overflow: hidden; position: relative;
    background: conic-gradient(from 180deg, var(--primary-dark) 0% 76%, var(--border) 76% 100%);
    mask: radial-gradient(circle at 50% 100%, transparent 55%, black 56%);
    -webkit-mask: radial-gradient(circle at 50% 100%, transparent 55%, black 56%);
}
.gauge-value { text-align: center; margin-top: -6px; }
.gauge-value strong { font-size: 26px; }
.gauge-value span { font-size: 12px; color: var(--text-muted); }

.checkup-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.checkup-item { text-align: center; }
.checkup-item strong { font-size: 18px; display: block; }
.checkup-item span.label { font-size: 11px; color: var(--text-muted); }

/* Expert pool */
.expert-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 0.5px solid var(--border); }
.expert-row:first-of-type { border-top: none; padding-top: 0; }
.expert-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(145deg, var(--gold-soft), var(--primary-dark));
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.expert-match {
    margin-left: auto; font-size: 12px; font-weight: 700; color: var(--primary-dark);
    background: var(--primary-light); padding: 3px 9px; border-radius: 20px;
}

/* Webinar banner */
.webinar-banner {
    background: linear-gradient(155deg, var(--gold-soft), var(--primary-dark));
    color: #fff; border-radius: 14px; padding: 1.25rem; margin-top: 16px;
}
.webinar-banner h3 { font-size: 15px; margin: 4px 0 6px; }
.webinar-banner p { font-size: 12px; opacity: 0.9; margin: 0 0 12px; }
.webinar-btn {
    background: #fff; color: var(--primary-dark); border: none; border-radius: 8px;
    padding: 8px 16px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}

@media (max-width: 1100px) {
    .ent-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .ent-panel-row, .ent-panel-row-3 { grid-template-columns: 1fr; }
}
