/* =============================================================================
   AI Search Rankings — Partners / Client / Operations Portal
   Design System  ·  white-dominant · deep-teal authority · calm · spacious
   Tokens are taken verbatim from the project spec. No purple anywhere.
   ========================================================================== */

:root {
    /* ---- Core color tokens (from spec) ---- */
    --teal:           #003737; /* primary CTA, active, authority */
    --teal-deep:      #004545; /* rare high-contrast panels */
    --teal-700:       #005d5d;
    --teal-50:        #e9f4f2;
    --teal-100:       #d7ebe8;
    --surface:        #ffffff; /* cards, forms */
    --surface-soft:   #f7faf9; /* app background */
    --border:         #dbe7e2; /* card + input borders */
    --border-strong:  #c4d6d0;
    --text:           #0f172a; /* primary text */
    --text-soft:      #334155; /* secondary text */
    --text-muted:     #282e38;
    --success:        #064e3b;
    --success-bg:     #e7f3ee;
    --warning:        #9b0000;
    --warning-bg:     #fbeede;
    --danger:         #ca0101;
    --danger-bg:      #fbe9e9;
    --info:           #00494a;
    --info-bg:        #e3f1f0;

    /* ---- Radius ---- */
    --r-sm: 8px;
    --r:    12px;
    --r-lg: 16px;
    --r-xl: 22px;

    /* ---- Shadows (soft, premium) ---- */
    --shadow-sm: 0 1px 2px rgba(15, 36, 34, .05);
    --shadow:    0 4px 16px rgba(15, 36, 34, .06);
    --shadow-md: 0 10px 30px rgba(15, 36, 34, .08);
    --shadow-lg: 0 24px 60px rgba(0, 55, 55, .14);

    /* ---- Spacing rhythm ---- */
    --gap:    24px;
    --pad-card: 32px;

    --sidebar-w: 264px;
    --topbar-h:  68px;

    --ease: cubic-bezier(.4, 0, .2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface-soft);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0 0 1em; color: var(--text-soft); }
a  { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .82rem; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--teal-700); outline-offset: 2px; border-radius: 4px; }

/* =============================================================================
   App shell
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 10px;
    padding: 22px 22px 18px;
    font-weight: 800; font-size: 1.02rem; color: var(--teal);
    letter-spacing: -.02em;
}
.sidebar__brand .brandmark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--teal); color: #fff;
    display: grid; place-items: center; flex: 0 0 34px;
}
.sidebar__role {
    margin: 0 22px 14px; padding: 6px 10px;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--teal-deep); background: var(--teal-50);
    border-radius: 999px; display: inline-block;
}
.sidebar__nav { padding: 6px 12px 20px; flex: 1; }
.sidebar__group-label {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); padding: 16px 12px 6px;
}
.navlink {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: var(--text-soft); font-weight: 500; font-size: .92rem;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.navlink:hover { background: var(--surface-soft); color: var(--text); text-decoration: none; }
.navlink.is-active { background: var(--teal); color: #fff; }
.navlink.is-active .ico { color: #fff; }
.navlink .ico { color: var(--teal-700); flex: 0 0 20px; }
.navlink__badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--warning-bg); color: var(--warning);
    font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}
.navlink.is-active .navlink__badge { background: rgba(255,255,255,.22); color: #fff; }

.sidebar__foot { padding: 14px 16px 20px; border-top: 1px solid var(--border); }
.sidebar__support {
    font-size: .82rem; color: var(--text-muted); line-height: 1.5;
}
.sidebar__support a { font-weight: 600; }

/* ---- Main column ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 32px;
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.topbar__crumbs { font-size: .85rem; color: var(--text-muted); }
.topbar__crumbs a { color: var(--text-soft); }
.topbar__spacer { flex: 1; }
.topbar__phone {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: .88rem; color: var(--teal-deep);
    padding: 8px 12px; border-radius: var(--r-sm);
}
.topbar__phone:hover { background: var(--teal-50); text-decoration: none; }

.notif { position: relative; }
.notif__btn {
    width: 42px; height: 42px; border-radius: var(--r-sm);
    border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; color: var(--text-soft);
    transition: background .15s var(--ease);
}
.notif__btn:hover { background: var(--surface-soft); }
.notif__dot {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700;
    display: grid; place-items: center; border: 2px solid var(--surface);
}
.notif__panel {
    position: absolute; right: 0; top: 52px; width: 340px; max-width: 90vw;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
    box-shadow: var(--shadow-md); padding: 8px; z-index: 50; display: none;
}
.notif__panel.is-open { display: block; }
.notif__item { padding: 12px; border-radius: var(--r-sm); }
.notif__item:hover { background: var(--surface-soft); }
.notif__item strong { display: block; font-size: .88rem; color: var(--text); }
.notif__item span { font-size: .8rem; color: var(--text-muted); }

.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--teal); color: #fff; font-weight: 700; font-size: .85rem;
    display: grid; place-items: center; flex: 0 0 40px;
}
.usermenu__meta { line-height: 1.2; }
.usermenu__name { font-weight: 600; font-size: .88rem; }
.usermenu__role { font-size: .76rem; color: var(--text-muted); }

/* ---- Page canvas ---- */
.page { padding: 32px; max-width: 1240px; width: 100%; margin: 0 auto; flex: 1; }
.page__head { margin-bottom: 24px; }
.page__title { font-size: 1.55rem; margin-bottom: 4px; }
.page__desc { color: var(--text-muted); font-size: .96rem; max-width: 70ch; margin: 0; }

.section { margin-top: 40px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section__title { font-size: 1.12rem; }
.section__hint { font-size: .85rem; color: var(--text-muted); }

/* =============================================================================
   Cards & grids
   ========================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--pad-card);
    box-shadow: var(--shadow-sm);
}
.card--tight { padding: 20px; }
.card--flush { padding: 0; overflow: hidden; }
.card__title { font-size: 1.5rem; margin-bottom: 15px; }
.card__hint { font-size: .85rem; color: var(--text-muted); margin: 0 0 16px; }

.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--6 { grid-template-columns: repeat(6, 1fr); }
.grid--sidebar-main { grid-template-columns: 1.6fr 1fr; }
.grid--main-sidebar { grid-template-columns: 1fr 1.6fr; }

/* ---- Stat cards ---- */
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 20px;
    display: flex; flex-direction: column; gap: 6px;
}
.stat__label { font-size: 1.1rem; color: var(--teal); font-weight: 700; }
.stat__value { font-size: 0.9rem; font-weight: 500; letter-spacing: -.02em; color: var(--text); }
.stat__meta { font-size: .8rem; color: var(--text-muted); }
.stat__meta.is-up { color: var(--success); }
.stat__meta.is-down { color: var(--danger); }
.stat--accent { background: var(--teal); border-color: var(--teal); }
.stat--accent .stat__label, .stat--accent .stat__meta { color: rgba(255,255,255,.78); }
.stat--accent .stat__value { color: #fff; }

/* =============================================================================
   Current Status card  (the No-Confusion anchor — on every screen)
   ========================================================================== */
.status-card {
    background: linear-gradient(180deg, #ffffff 0%, var(--teal-50) 220%);
    border: 1px solid var(--border);
    border-left: 5px solid var(--teal);
    border-radius: var(--r-lg);
    padding: 28px var(--pad-card);
    box-shadow: var(--shadow);
}
.status-card__grid { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.status-card__rows { display: flex; flex-direction: column; gap: 14px; }
.status-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.status-row__k { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #003737; padding-top: 2px; }
.status-row__v { color: var(--text); font-weight: 500; }
.status-row__v small { display: block; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.status-card__cta { text-align: right; }

/* =============================================================================
   Badges, pills, dots
   ========================================================================== */
.badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px; border-radius: 999px;
    font-size: .78rem; font-weight: 600; white-space: nowrap;
    border: 1px solid transparent;
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge--neutral  { background: #eef2f1; color: var(--text-soft); border-color: var(--border); }
.badge--progress { background: var(--info-bg); color: var(--info); border-color: #cce5e4; }
.badge--waiting  { background: var(--warning-bg); color: var(--warning); border-color: #f1ddc2; }
.badge--review   { background: var(--teal-50); color: var(--teal-deep); border-color: var(--teal-100); }
.badge--success  { background: var(--success-bg); color: var(--success); border-color: #cfe7dd; }
.badge--danger   { background: var(--danger-bg); color: var(--danger); border-color: #f1cccc; }

.pill {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .01em;
}
.pill--waiting  { background: var(--warning-bg); color: var(--warning); }
.pill--review   { background: var(--teal-50); color: var(--teal-deep); }
.pill--progress { background: var(--info-bg); color: var(--info); }
.pill--neutral  { background: #eef2f1; color: var(--text-muted); }

/* =============================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    min-height: 52px; padding: 0 22px;
    border-radius: var(--r); border: 1px solid transparent;
    font-family: inherit; font-size: .95rem; font-weight: 600; line-height: 1;
    cursor: pointer; text-align: center; white-space: nowrap;
    transition: background .15s var(--ease), box-shadow .15s var(--ease), transform .05s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--teal); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--teal-deep); box-shadow: var(--shadow); }
.btn--secondary { background: var(--surface); color: var(--teal-deep); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-soft); }
.btn--ghost { background: transparent; color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-soft); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #6a1717; }
.btn--success { background: var(--success); color: #fff; }
.btn--success:hover { background: #053f30; }
.btn--sm { min-height: 40px; padding: 0 15px; font-size: .85rem; border-radius: var(--r-sm); }
.btn--lg { min-height: 56px; padding: 0 30px; font-size: 1rem; }
.btn--block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* =============================================================================
   Forms  (generous, premium spacing — never a database form)
   ========================================================================== */
.form { max-width: 680px; }
.field { margin-bottom: 24px; }
.field__label { display: block; font-weight: 600; font-size: .9rem; color: var(--text); margin-bottom: 8px; }
.field__req { color: var(--danger); }
.field__help { font-size: .83rem; color: var(--text-muted); margin: 8px 0 0; }
.field__group { margin-bottom: 36px; }
.field__group > h3 { margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

.input, .select, .textarea {
    width: 100%; min-height: 54px; padding: 14px 16px;
    border: 1px solid var(--border-strong); border-radius: var(--r);
    background: var(--surface); color: var(--text); font-family: inherit; font-size: .98rem;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--teal-700);
    box-shadow: 0 0 0 4px rgba(0, 93, 93, .13);
}
.input::placeholder, .textarea::placeholder { color: #9aa9a4; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.field__error { font-size: .82rem; color: var(--danger); margin-top: 8px; font-weight: 500; }

.checkline { display: flex; gap: 12px; align-items: flex-start; }
.checkline input[type="checkbox"] { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--teal); flex: 0 0 22px; }
.checkline label { font-size: .92rem; color: var(--text-soft); }

.choice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice {
    border: 1px solid var(--border-strong); border-radius: var(--r); padding: 16px;
    cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
    display: flex; gap: 12px; align-items: center;
}
.choice:hover { background: var(--surface-soft); }
.choice input { accent-color: var(--teal); width: 20px; height: 20px; }
.choice.is-selected { border-color: var(--teal); background: var(--teal-50); }

/* =============================================================================
   Wizard (one step at a time)
   ========================================================================== */
.wizard { max-width: 620px; margin: 0 auto; }
.wizard__progress { margin-bottom: 28px; }
.wizard__steps { display: flex; gap: 8px; }
.wizard__step { flex: 1; height: 6px; border-radius: 999px; background: var(--border); }
.wizard__step.is-done { background: var(--teal); }
.wizard__step.is-current { background: var(--teal-700); }
.wizard__count { font-size: .82rem; color: var(--text-muted); font-weight: 600; margin-top: 10px; }
.wizard__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 44px; box-shadow: var(--shadow); }
.wizard__title { font-size: 1.5rem; margin-bottom: 8px; }
.wizard__lede { color: var(--text-soft); margin-bottom: 28px; }
.wizard__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; }
.wizard__back { color: var(--text-muted); font-weight: 600; }

/* =============================================================================
   Tables  ->  cards on mobile
   ========================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
    text-align: left; padding: 14px 18px; font-size: .74rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted); font-weight: 700;
    border-bottom: 1px solid var(--border); background: var(--surface-soft); white-space: nowrap;
}
table.data td { padding: 16px 18px; border-bottom: 1px solid var(--border); color: var(--text-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fbfdfc; }
.data__primary { font-weight: 600; color: var(--text);font-size: 1.1rem; }
.data__sub { font-size: .9rem; color: var(--teal); }

/* =============================================================================
   Timeline (phases)
   ========================================================================== */
.timeline { display: flex; gap: 0; }
.tl-step { flex: 1; text-align: center; position: relative; padding-top: 30px; }
.tl-step::before {
    content: ''; position: absolute; top: 9px; left: -50%; width: 100%; height: 3px;
    background: var(--border);
}
.tl-step:first-child::before { display: none; }
.tl-step__dot {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 20px; height: 20px; border-radius: 50%; background: var(--surface);
    border: 3px solid var(--border); z-index: 1;
}
.tl-step.is-complete .tl-step__dot { background: var(--teal); border-color: var(--teal); }
.tl-step.is-complete::before { background: var(--teal); }
.tl-step.is-current .tl-step__dot { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-50); }
.tl-step.is-waiting .tl-step__dot { border-color: var(--warning); background: var(--warning-bg); }
.tl-step__label { font-size: .78rem; color: var(--text-soft); font-weight: 600; padding: 0 6px; }
.tl-step__status { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* =============================================================================
   Progress bar & ring
   ========================================================================== */
.progress { height: 12px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress__bar { height: 100%; border-radius: 999px; background: var(--teal); transition: width .5s var(--ease); }
.progress__label { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }

.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%;
    background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--border) 0);
    display: grid; place-items: center; }
.ring::before { content: ''; position: absolute; width: 86px; height: 86px; border-radius: 50%; background: var(--surface); }
.ring__val { position: relative; font-weight: 800; font-size: 1.4rem; color: var(--teal); }

/* =============================================================================
   Charts (CSS-driven bars — clear, not decorative)
   ========================================================================== */
.chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 46px; gap: 12px; align-items: center; }
.bar-row__label { font-size: .85rem; color: var(--text-soft); font-weight: 500; }
.bar-track { height: 26px; border-radius: var(--r-sm); background: var(--surface-soft); border: 1px solid var(--border); overflow: hidden; }
.bar-fill { height: 100%; background: var(--teal); border-radius: var(--r-sm) 0 0 var(--r-sm); transition: width .5s var(--ease); }
.bar-fill.is-self { background: var(--teal); }
.bar-fill.is-other { background: var(--border-strong); }
.bar-row__val { font-size: .82rem; font-weight: 700; color: var(--text); text-align: right; }
.chart__note {
    margin-top: 16px; padding: 14px 16px; border-radius: var(--r);
    background: var(--surface-soft); border: 1px solid var(--border);
    font-size: .86rem; color: var(--text-soft);
}
.chart__note strong { color: var(--text); }

/* =============================================================================
   Deliverable / approval cards
   ========================================================================== */
.doc-card { display: flex; flex-direction: column; gap: 12px; }
.doc-card__head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.doc-card__type { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.doc-card__title { font-size: 1.04rem; font-weight: 700; }
.doc-card__desc { font-size: .88rem; color: var(--text-soft); margin: 0; }
.doc-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.doc-card__meta { font-size: .78rem; color: var(--text-muted); }

/* =============================================================================
   Needed-from-you / next-step lists
   ========================================================================== */
.need-list { display: flex; flex-direction: column; gap: 0; }
.need-item {
    display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
    padding: 16px 0; border-bottom: 1px solid var(--border);
}
.need-item:last-child { border-bottom: none; }
.need-item__title { font-weight: 600; color: var(--text); }
.need-item__why { font-size: .83rem; color: var(--text-muted); margin-top: 2px; }

/* =============================================================================
   Activity log
   ========================================================================== */
.activity { display: flex; flex-direction: column; }
.act-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: none; }
.act-item__icon { width: 34px; height: 34px; border-radius: 50%; background: var(--teal-50); color: var(--teal-deep); display: grid; place-items: center; }
.act-item__body { font-size: .9rem; color: var(--text); }
.act-item__actor { font-weight: 600; }
.act-item__time { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }

/* =============================================================================
   Empty states (never look broken)
   ========================================================================== */
.empty { text-align: center; padding: 44px 24px; }
.empty__icon { width: 56px; height: 56px; border-radius: 16px; background: var(--teal-50); color: var(--teal-deep); display: grid; place-items: center; margin: 0 auto 16px; }
.empty__title { font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty__text { font-size: .9rem; color: var(--text-muted); max-width: 42ch; margin: 0 auto 18px; }

/* =============================================================================
   Hints / callouts
   ========================================================================== */
.hint { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); font-size: .88rem; }
.hint--info    { background: var(--info-bg); color: var(--info); }
.hint--waiting { background: var(--warning-bg); color: var(--warning); }
.hint--success { background: var(--success-bg); color: var(--success); }
.hint__icon { flex: 0 0 20px; }
.hint strong { display: block; }

/* =============================================================================
   Flash messages
   ========================================================================== */
.flash-stack { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.flash {
    display: flex; gap: 12px; align-items: start; padding: 14px 16px;
    border-radius: var(--r); box-shadow: var(--shadow-md); background: var(--surface);
    border-left: 4px solid var(--teal); font-size: .9rem; animation: flash-in .25s var(--ease);
}
.flash--success { border-left-color: var(--success); }
.flash--error   { border-left-color: var(--danger); }
.flash--info    { border-left-color: var(--teal-700); }
.flash__close { margin-left: auto; cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 1.1rem; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* =============================================================================
   Public chrome (login, onboarding)
   ========================================================================== */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface-soft); }
.public__top { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px; }
.public__brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--teal); font-size: 1.05rem; }
.public__brand .brandmark { width: 36px; height: 36px; border-radius: 9px; background: var(--teal); color: #fff; display: grid; place-items: center; }
.public__main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px 56px; }
.public__foot { text-align: center; padding: 20px; font-size: .8rem; color: var(--text-muted); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 40px; box-shadow: var(--shadow-md); }
.auth-card__title { font-size: 1.4rem; margin-bottom: 6px; }
.auth-card__lede { color: var(--text-muted); margin-bottom: 26px; font-size: .92rem; }
.trust-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; }
.trust-strip li { list-style: none; font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

/* =============================================================================
   Utilities
   ========================================================================== */
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.center { text-align: center; }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hide { display: none !important; }
.ico { display: inline-flex; vertical-align: middle; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); font-size: .74rem; font-weight: 600; color: var(--text-soft); }

/* skip link */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--teal); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r) 0; z-index: 999; }
.skip-link:focus { left: 0; }

/* =============================================================================
   Mobile-first responsiveness
   ========================================================================== */
.menu-toggle { display: none; width: 42px; height: 42px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.sidebar__backdrop { display: none; }

@media (max-width: 1080px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .grid--6 { grid-template-columns: repeat(3, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
    .grid--sidebar-main, .grid--main-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    :root { --pad-card: 22px; }
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 80; transform: translateX(-100%);
        transition: transform .25s var(--ease); box-shadow: var(--shadow-lg);
    }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .sidebar__backdrop { display: block; position: fixed; inset: 0; background: rgba(15,36,34,.35); z-index: 70; }
    .menu-toggle { display: grid; place-items: center; }
    .topbar { padding: 0 16px; }
    .page { padding: 20px 16px 96px; }
    .grid--2, .grid--3, .grid--4, .grid--6 { grid-template-columns: 1fr; }
    .status-card__grid { grid-template-columns: 1fr; }
    .status-card__cta { text-align: left; }
    .status-row { grid-template-columns: 1fr; gap: 4px; }
    .status-row__k { padding-top: 0; }

    /* Timeline -> vertical */
    .timeline { flex-direction: column; gap: 0; }
    .tl-step { text-align: left; padding: 0 0 22px 34px; }
    .tl-step::before { top: -50%; left: 9px; width: 3px; height: 100%; }
    .tl-step__dot { top: 2px; left: 9px; transform: none; }
    .tl-step__label { padding: 0; }

    /* Tables -> cards */
    table.data, table.data thead, table.data tbody, table.data th, table.data td, table.data tr { display: block; }
    table.data thead { position: absolute; left: -9999px; }
    table.data tr { border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 12px; padding: 8px 4px; background: var(--surface); }
    table.data td { border: none; padding: 8px 16px; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
    table.data td::before { content: attr(data-label); font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: .7rem; letter-spacing: .04em; text-align: left; }

    .bar-row { grid-template-columns: 110px 1fr 40px; }
    .btn { width: 100%; }
    .btn--sm, .btn-row .btn { width: auto; }

    /* Sticky bottom CTA holder */
    .sticky-cta {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
        border-top: 1px solid var(--border); padding: 12px 16px;
        display: flex; gap: 10px;
    }
    .sticky-cta .btn { flex: 1; }
}

@media (min-width: 861px) { .sticky-cta { display: none; } .desktop-hide { display: none; } }
@media (max-width: 860px) { .desktop-hide-mobile { display: none !important; } }

/* =============================================================================
   Enhanced tables (sort · search · paginate)
   ========================================================================== */
.table-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.table-search { max-width: 300px; min-height: 44px; padding: 10px 14px; }
table.data th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.th-sort:hover { color: var(--text); background: #eef4f2; }
table.data th[aria-sort] { color: var(--teal-deep); }
table.data th[aria-sort="ascending"]::after { content: " ▲"; font-size: .68em; }
table.data th[aria-sort="descending"]::after { content: " ▼"; font-size: .68em; }
.table-pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 14px; }
.table-pageinfo { font-size: .82rem; color: var(--text-muted); font-weight: 600; }
@media (max-width: 860px) { table.data th.th-sort { pointer-events: none; } .table-toolbar { justify-content: stretch; } .table-search { max-width: none; width: 100%; } }

/* =============================================================================
   Tooltips & contextual help (pure CSS, accessible on hover + focus)
   ========================================================================== */
.tip { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: help; vertical-align: middle; }
.tip:hover, .tip:focus-visible { color: var(--teal-deep); }
[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(4px);
    background: var(--text); color: #fff; padding: 9px 12px; border-radius: 10px;
    font-size: .78rem; font-weight: 500; line-height: 1.45; letter-spacing: 0; text-transform: none;
    width: max-content; max-width: 260px; white-space: normal; text-align: left;
    box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; z-index: 120; transition: opacity .15s var(--ease), transform .15s var(--ease);
}
[data-tip]::before {
    content: ''; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--text); opacity: 0; pointer-events: none; z-index: 120; transition: opacity .15s var(--ease);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after, [data-tip]:hover::before, [data-tip]:focus-visible::before { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =============================================================================
   AI suggestion chips (Source of Truth assist)
   ========================================================================== */
.ai-assist { background: linear-gradient(180deg, var(--teal-50) 0%, #ffffff 100%); border: 1px solid var(--teal-100); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 24px; }
.ai-assist__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ai-assist__head .ico { color: var(--teal-deep); }
.ai-assist__title { font-weight: 700; color: var(--teal-deep); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-soft);
    font-size: .85rem; font-weight: 500; cursor: pointer; transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.chip:hover { border-color: var(--teal-700); background: var(--teal-50); }
.chip.is-added { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.is-added::before { content: '✓ '; font-weight: 700; }
.ai-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--teal-100); border-top-color: var(--teal); border-radius: 50%; animation: ai-spin .7s linear infinite; vertical-align: middle; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* =============================================================================
   Micro-interactions & polish (calm, never flashy)
   ========================================================================== */
/* Clickable table rows lift subtly */
table.data tr[onclick] { transition: background .12s var(--ease), box-shadow .12s var(--ease); }
table.data tr[onclick]:hover td { background: var(--teal-50); }

/* Interactive stat cards lift */
a.stat { transition: box-shadow .15s var(--ease), transform .12s var(--ease), border-color .15s var(--ease); }
a.stat:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); text-decoration: none; }
a.stat.stat--accent:hover { box-shadow: var(--shadow-md); }

/* Doc / package cards lift gently */
.card { transition: box-shadow .15s var(--ease); }

/* Native disclosure markers off (we style summaries as buttons) */
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ''; }
details[open] > summary { margin-bottom: 4px; }
details > form, details > div { animation: reveal .2s var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Gentle page entrance */
.page > .page__head + *, .page > .status-card { animation: page-in .28s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Inputs: clearer hover affordance */
.input:hover:not(:focus), .select:hover:not(:focus), .textarea:hover:not(:focus) { border-color: var(--teal-700); }

/* Chips & nav focus rings */
.chip:focus-visible, .navlink:focus-visible, .tag:focus-visible { outline: 3px solid var(--teal-700); outline-offset: 2px; }

/* Sticky table header on tall tables */
.table-wrap { max-height: none; }

/* =============================================================================
   Kinetic UI system — calm momentum, never flashy
   ========================================================================== */
/* Scroll reveal */
[data-reveal] { opacity: 0; transform: translateY(12px); }
[data-reveal].is-revealed { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }

/* Count-up values render tabular for stable width */
.stat__value [data-countup], [data-countup] { font-variant-numeric: tabular-nums; }

/* Active progress: subtle living glow + sheen to signal live processing */
.progress__bar { position: relative; overflow: hidden; }
.progress--live .progress__bar { box-shadow: 0 0 0 0 rgba(0, 93, 93, .5); animation: prog-glow 2.4s var(--ease) infinite; }
.progress--live .progress__bar::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    transform: translateX(-100%); animation: prog-sheen 2.4s var(--ease) infinite;
}
@keyframes prog-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(0,93,93,.35); } 50% { box-shadow: 0 0 10px 1px rgba(0,93,93,.28); } }
@keyframes prog-sheen { 0% { transform: translateX(-100%); } 60%,100% { transform: translateX(100%); } }

/* Hover-to-reveal row utility actions */
.need-item--hover { border-radius: var(--r-sm); transition: background .14s var(--ease); padding-left: 8px; padding-right: 8px; margin: 0 -8px; }
.need-item--hover:hover { background: var(--surface-soft); }
.reveal-action { opacity: 0; transform: translateX(4px); transition: opacity .14s var(--ease), transform .14s var(--ease); }
.need-item--hover:hover .reveal-action,
.need-item--hover:focus-within .reveal-action { opacity: 1; transform: none; }
@media (hover: none) { .reveal-action { opacity: 1; transform: none; } }

/* Richer status badge micro-card on hover (extends [data-tip]) */
.badge[title] { cursor: help; }

/* Urgency shading for warm/critical priorities (warm amber→red, never purple) */
.badge--urgent, .pill--urgent { background: #fff1e8; color: #9a3412; border: 1px solid #f6cfa9; }
.heat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.heat--hot  { background: linear-gradient(135deg, #fde7d6, #fbd9c2); color: #9a3412; }
.heat--warm { background: #fef3e2; color: #92500f; }
.heat--cold { background: #eef2f1; color: var(--text-muted); }

/* Score ring micro-gauge inside rows */
.gauge { --p: 0; --c: var(--teal); width: 40px; height: 40px; border-radius: 50%; position: relative;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border) 0); display: grid; place-items: center; flex: 0 0 40px; }
.gauge::before { content: ''; position: absolute; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); }
.gauge__val { position: relative; font-size: .68rem; font-weight: 800; color: var(--text); }

/* =============================================================================
   Pricing catalog (mirrors the public pricing page)
   ========================================================================== */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; align-items: start; }
.pricing-card {
    position: relative; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 32px 28px; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
}
.pricing-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.pricing-card--featured { border-color: var(--teal); box-shadow: 0 14px 40px rgba(0,55,55,.12); }
.pricing-card--current { border-color: var(--success); }
.pricing-card__flag {
    position: absolute; top: -12px; left: 28px; background: var(--teal); color: #fff;
    font-size: .72rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; letter-spacing: .02em;
}
.pricing-card__flag--current { left: auto; right: 28px; background: var(--success); }
.pricing-card__eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--teal-deep); font-size: .8rem; font-weight: 600; margin-bottom: 12px; }
.pricing-card__name { font-size: 1.3rem; margin: 0 0 6px; }
.pricing-card__price { font-size: 2.2rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1; }
.pricing-card__price span { display: block; font-size: .8rem; font-weight: 500; color: var(--text-muted); margin-top: 6px; }
.pricing-card__tagline { color: var(--text-soft); font-size: .92rem; margin: 14px 0 18px; }
.pricing-card__features { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.pricing-card__features li { display: flex; gap: 10px; font-size: .89rem; color: var(--text-soft); line-height: 1.45; }
.pricing-card__features .ico { color: var(--teal); flex: 0 0 17px; margin-top: 2px; }
.pricing-card__cta .btn { width: 100%; }
.pricing-card__detail { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: .85rem; font-weight: 600; }
@media (max-width: 1080px) { .pricing-grid { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; } }

/* Brand section icons (white-background illustrations) — only on white surfaces */
.section-ico { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 4px; flex: 0 0 44px; box-shadow: var(--shadow-sm); }
.section-head-ico { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.section-head-ico .card__title { line-height: 1.2; }
.feature-ico { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 3px; flex: 0 0 34px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    a.stat:hover, table.data tr[onclick]:hover { transform: none; }
    [data-reveal] { opacity: 1; transform: none; }
    .progress--live .progress__bar::after { display: none; }
    .reveal-action { opacity: 1; transform: none; }
}
