:root {
    /* Emerald + slate palette — fresh, not navy */
    --emerald:      #C29218;
    --emerald-dark: #9A7413;
    --emerald-deep: #7A5C0F;
    --emerald-tint: #FAF3DC;
    --slate-ink:    #0F172A;
    --slate-700:    #334155;
    --slate-500:    #64748B;
    --slate-300:    #CBD5E1;
    --slate-200:    #E2E8F0;
    --slate-100:    #F1F5F9;
    --slate-50:     #F8FAFC;
    --white:        #FFFFFF;
    --danger:       #E11D48;
    --warning:      #D97706;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-lg:    0 10px 30px rgba(15,23,42,.10);

    --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    color: var(--slate-ink);
    background: var(--slate-50);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--emerald-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; color: var(--slate-ink); }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.muted { color: var(--slate-500); }
.text-success { color: var(--emerald-dark); }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.mt-2 { margin-top: 16px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--slate-200); background: var(--white);
    color: var(--slate-700); font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none; transition: all .12s;
}
.btn:hover { border-color: var(--slate-300); text-decoration: none; }
.btn-primary {
    background: var(--emerald); border-color: var(--emerald);
    color: var(--white);
}
.btn-primary:hover { background: var(--emerald-dark); border-color: var(--emerald-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Auth / marketing pages ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center;
    justify-content: center; padding: 24px;
    background:
        radial-gradient(1200px 500px at 80% -10%, var(--emerald-tint), transparent),
        var(--slate-50);
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--white);
    border: 1px solid var(--slate-200); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 36px;
}
.auth-card .brand {
    font-family: var(--font-display); font-weight: 700; font-size: 22px;
    letter-spacing: -0.03em; margin-bottom: 4px; color: var(--slate-ink);
}
.auth-card .brand span { color: var(--emerald); }
.auth-card h1 { font-size: 22px; margin: 18px 0 4px; }
.auth-card .sub { color: var(--slate-500); font-size: 14px; margin-bottom: 20px; }

.form-field { margin-bottom: 14px; }
.form-field label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--slate-700); margin-bottom: 5px;
}
.form-field input, .form-field select, .form-field textarea {
    width: 100%; padding: 10px 12px; font-size: 14px;
    border: 1px solid var(--slate-300); border-radius: var(--radius-sm);
    font-family: inherit; color: var(--slate-ink); background: var(--white);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none; border-color: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-tint);
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; }
.flash-error { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.flash-success { background: var(--emerald-tint); color: var(--emerald-deep); border: 1px solid #A7F3D0; }

.auth-foot { margin-top: 18px; font-size: 13px; color: var(--slate-500); text-align: center; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; background: var(--slate-ink); color: var(--slate-300);
    display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar .brand {
    font-family: var(--font-display); font-weight: 700; font-size: 20px;
    color: var(--white); padding: 20px; letter-spacing: -0.03em;
}
.sidebar .brand span { color: var(--emerald); }
.sidebar nav { flex: 1; padding: 8px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    color: var(--slate-300); border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: var(--white); }
.sidebar nav a.active { background: var(--emerald); color: var(--white); }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar-foot a { color: var(--slate-300); }

.main { flex: 1; min-width: 0; }
.topbar {
    background: var(--white); border-bottom: 1px solid var(--slate-200);
    padding: 0 24px; height: 56px; display: flex; align-items: center;
    justify-content: space-between;
}
.topbar .ws-name { font-weight: 600; font-size: 14px; }
.topbar .trial-pill {
    background: var(--emerald-tint); color: var(--emerald-deep);
    padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.content { padding: 24px; max-width: 1200px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* ---------- Cards / stats ---------- */
.card {
    background: var(--white); border: 1px solid var(--slate-200);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
    background: var(--white); border: 1px solid var(--slate-200);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); }
.stat .value { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .value.emerald { color: var(--emerald-dark); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--slate-100); }
.tbl th { background: var(--slate-50); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--slate-500); font-weight: 600; }
.tbl tbody tr:hover { background: var(--slate-50); }

.stage-badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 500; background: var(--slate-100); color: var(--slate-700);
}
.stage-badge.won { background: var(--emerald-tint); color: var(--emerald-deep); }
.stage-badge.lost { background: #FEF2F2; color: var(--danger); }
.stage-badge.proposal { background: #EFF6FF; color: #1D4ED8; }
.stage-badge.qualified { background: #F5F3FF; color: #6D28D9; }

.empty-state { padding: 40px; text-align: center; color: var(--slate-500); }

/* ---------- Landing ---------- */
.lp-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; max-width: 1100px; margin: 0 auto; }
.lp-nav .brand { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.03em; }
.lp-nav .brand span { color: var(--emerald); }
.lp-hero { max-width: 1100px; margin: 0 auto; padding: 80px 32px; text-align: center; }
.lp-hero h1 { font-size: 56px; line-height: 1.05; margin-bottom: 20px; }
.lp-hero h1 .accent { color: var(--emerald); }
.lp-hero p { font-size: 20px; color: var(--slate-500); max-width: 600px; margin: 0 auto 32px; }
.lp-hero .cta-row { display: flex; gap: 12px; justify-content: center; }
.lp-hero .btn { padding: 13px 24px; font-size: 16px; }
.lp-features { max-width: 1100px; margin: 0 auto; padding: 40px 32px 80px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.lp-feature h3 { margin-bottom: 8px; }
.lp-feature p { color: var(--slate-500); font-size: 15px; }
.lp-price-note { font-size: 14px; color: var(--slate-500); margin-top: 14px; }

@media (max-width: 860px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .lp-features { grid-template-columns: 1fr; }
    .lp-hero h1 { font-size: 38px; }
    .sidebar { position: fixed; left: -230px; top: 0; bottom: 0; z-index: 50; transition: left .2s; }
    .sidebar.open { left: 0; }
    .hamburger { display: inline-flex !important; }
}
.hamburger { display: none; background: var(--slate-ink); color: #fff; border: none; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 18px; cursor: pointer; }

/* ---------- Pipeline kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { background: var(--slate-100); border-radius: var(--radius); min-width: 240px; max-width: 240px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.kanban-col-head { padding: 12px 14px; border-bottom: 1px solid var(--slate-200); position: sticky; top: 0; background: var(--slate-100); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col-head .name { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.kanban-col-head .meta { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.kanban-cards { padding: 10px; overflow-y: auto; flex: 1; min-height: 60px; }
.kanban-card { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; transition: box-shadow .12s, transform .04s; }
.kanban-card:hover { box-shadow: var(--shadow-lg); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .5; }
.kanban-card .co { font-weight: 600; font-size: 14px; color: var(--slate-ink); }
.kanban-card .person { font-size: 12px; color: var(--slate-500); margin-top: 1px; }
.kanban-card .row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.kanban-card .val { font-size: 13px; font-weight: 600; color: var(--emerald-dark); font-variant-numeric: tabular-nums; }
.kanban-card .assignee { font-size: 11px; color: var(--slate-500); }
.kanban-col.drag-over { outline: 2px dashed var(--emerald); outline-offset: -2px; }
.kanban-col.drag-over .kanban-cards { background: var(--emerald-tint); border-radius: var(--radius-sm); }
.kanban-empty { color: var(--slate-300); font-size: 13px; text-align: center; padding: 16px 0; }

/* ---------- Printable documents (quotes, invoices, agreements) ---------- */
.doc-sheet { max-width: 820px; }
@media print {
    .sidebar, .topbar, .no-print, .page-header .btn { display: none !important; }
    .main, .content { margin: 0 !important; padding: 0 !important; }
    .card, .doc-sheet { box-shadow: none !important; border: none !important; }
    body { background: #fff !important; }
    .stage-badge { border: 1px solid #ccc; }
}

/* ---------- Parameters tabs ---------- */
.param-tab:hover { color: var(--emerald-dark) !important; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--slate-200); border: 1px solid var(--slate-200); border-radius: var(--radius); overflow: hidden; }
.cal-head { background: var(--slate-100); padding: 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--slate-500); text-transform: uppercase; letter-spacing: .03em; }
.cal-cell { background: var(--white); min-height: 96px; padding: 4px 5px; position: relative; }
.cal-cell.other-month { background: #fafbfc; }
.cal-cell.other-month .cal-daynum { color: var(--slate-300); }
.cal-cell.today { background: var(--emerald-tint); }
.cal-daynum { display: inline-block; font-size: 12px; color: var(--slate-600); text-decoration: none; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px; }
.cal-daynum:hover { background: var(--emerald); color: #fff; }
.cal-event { font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.meeting { background: #7c3aed; }
.cal-event.followup { background: #2563eb; }
.cal-event.agreement { background: var(--emerald); }
.cal-event.invoice { background: #d97706; }
.cal-event.task { background: #64748b; }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 3px; }
.cal-dot.meeting { background: #7c3aed; }
.cal-dot.followup { background: #2563eb; }
.cal-dot.agreement { background: var(--emerald); }
.cal-dot.invoice { background: #d97706; }
.cal-dot.task { background: #64748b; }
