:root {
  --ink: #121212;
  --muted: #6d6a63;
  --paper: #f5f2eb;
  --surface: #fffdf8;
  --line: #ded8cd;
  --accent: #d4ff57;
  --accent-ink: #172000;
  --danger: #a7352d;
  --warning: #8a5a00;
  --success: #246b43;
  --sidebar: #171713;
  --sidebar-muted: #a9a89f;
  --shadow: 0 18px 50px rgba(31, 29, 23, .08);
}
* { box-sizing: border-box; }
html { font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 1.05rem "Bricolage Grotesque", sans-serif; letter-spacing: -.02em; }
.brand img { border-radius: 9px; }
.brand--sidebar { color: white; margin-bottom: 28px; }
.brand b { font-weight: 700; }
.eyebrow { margin: 0 0 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.muted { color: var(--muted); }
.auth-page { display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 20% 10%, #ecffd1 0, transparent 30%), var(--paper); }
.auth-shell { width: min(100%, 470px); }
.auth-shell > .brand { margin-bottom: 22px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font: 700 2rem/1 "Bricolage Grotesque", sans-serif; margin: 0 0 10px; letter-spacing: -.04em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #ece8de; border-radius: 12px; padding: 4px; margin-bottom: 28px; }
.auth-tab { border: 0; padding: 10px; border-radius: 9px; background: transparent; cursor: pointer; color: var(--muted); }
.auth-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.stack { display: grid; gap: 16px; margin-top: 22px; }
.stack label, .form-grid label { display: grid; gap: 7px; font-size: .82rem; font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
legend { padding: 0 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.radio-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; padding: 6px 0; font-weight: 500 !important; }
input, select, textarea { width: 100%; border: 1px solid #cbc4b8; background: white; color: var(--ink); border-radius: 10px; padding: 11px 12px; outline: none; }
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8b8a70; box-shadow: 0 0 0 3px rgba(212,255,87,.25); }
.password-field { position: relative; display: block; width: 100%; }
.password-field > input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #6d6a63; cursor: pointer; }
.password-toggle:hover { background: #f0ede5; color: var(--ink); }
.password-toggle:focus-visible { outline: 2px solid #8b8a70; outline-offset: 2px; }
.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle__hide { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle__show { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle__hide { display: block; }
.primary-button, .secondary-button, .danger-button, .text-button, .icon-button, .notification-button { border: 0; border-radius: 10px; cursor: pointer; }
.primary-button { background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 12px 16px; }
.secondary-button { background: #ebe7dd; color: var(--ink); font-weight: 650; padding: 10px 14px; }
.danger-button { background: #f7e1de; color: var(--danger); font-weight: 650; padding: 10px 14px; }
.text-button { background: transparent; padding: 8px 0; text-decoration: underline; color: var(--muted); }
.icon-button { background: transparent; font-size: 1.7rem; }
button:disabled { opacity: .55; cursor: wait; }
.form-message, .global-message { min-height: 22px; margin: 14px 0 0; font-size: .84rem; color: var(--success); }
.form-message.is-error, .global-message.is-error { color: var(--danger); }
.portal-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.portal-sidebar { background: var(--sidebar); color: white; padding: 24px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.account-card { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; margin-bottom: 18px; }
.account-card strong, .account-card small { display: block; }
.account-card strong { font-size: .86rem; }
.account-card small { color: var(--sidebar-muted); font-size: .72rem; margin-top: 3px; }
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--accent); box-shadow: 0 0 0 4px rgba(212,255,87,.12); }
.portal-nav { display: grid; gap: 5px; }
.portal-nav button { text-align: left; border: 0; background: transparent; color: var(--sidebar-muted); padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.portal-nav button:hover, .portal-nav button.is-active { color: white; background: rgba(255,255,255,.08); }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--sidebar-muted); font-size: .78rem; }
.sidebar-foot .text-button { color: var(--sidebar-muted); }
.portal-main { padding: 28px 34px 60px; min-width: 0; }
.portal-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.portal-topbar h1 { font: 700 2.1rem/1 "Bricolage Grotesque", sans-serif; margin: 0; letter-spacing: -.04em; }
.notification-button { background: var(--surface); border: 1px solid var(--line); padding: 10px 13px; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 20px; background: var(--ink); color: white; margin-left: 5px; font-size: .72rem; }
.global-message { margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .loading-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 8px 22px rgba(30,25,18,.035); }
.card h2, .card h3 { font-family: "Bricolage Grotesque", sans-serif; letter-spacing: -.025em; margin-top: 0; }
.card h2 { font-size: 1.25rem; }
.card h3 { font-size: 1rem; }
.metric { font: 700 2rem "Bricolage Grotesque", sans-serif; }
.metric-label { color: var(--muted); font-size: .78rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 12px; }
.section-head h2 { margin: 0; font: 700 1.2rem "Bricolage Grotesque", sans-serif; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #eee9df; vertical-align: top; }
th { color: var(--muted); font-weight: 650; background: #faf8f2; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { padding: 6px 9px; font-size: .72rem; }
.pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; background: #ece8df; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.pill.ACTIVE, .pill.APPROVED, .pill.WON, .pill.PAID, .pill.CONFIRMED, .pill.QUALIFIED, .pill.REVEALED { background: #e0f2e7; color: var(--success); }
.pill.REJECTED, .pill.LOST, .pill.FAILED, .pill.CANCELLED { background: #f6e0dd; color: var(--danger); }
.pill.PENDING, .pill.PENDING_REVIEW, .pill.PROPOSED, .pill.INVITED, .pill.PROCESSING { background: #fff0cf; color: var(--warning); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.notice { border-left: 3px solid var(--accent); background: #f4f8e8; padding: 12px 14px; border-radius: 8px; font-size: .82rem; }
.empty { color: var(--muted); padding: 18px; text-align: center; }
pre.json { overflow: auto; font-size: .72rem; background: #1b1b18; color: #e9eadf; padding: 14px; border-radius: 12px; }
.notification-drawer { width: min(520px, calc(100vw - 24px)); max-height: 82vh; border: 1px solid var(--line); border-radius: 18px; padding: 0; box-shadow: var(--shadow); }
.notification-drawer::backdrop { background: rgba(20,20,17,.45); }
.notification-drawer > header { display: flex; align-items: center; justify-content: space-between; padding: 18px; border-bottom: 1px solid var(--line); }
.notification-drawer h2 { margin: 0; font: 700 1.25rem "Bricolage Grotesque", sans-serif; }
.notification-actions { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.notification-item { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.notification-item.is-unread { background: #fbffe9; }
.notification-item h3 { margin: 0 0 5px; font-size: .88rem; }
.notification-item p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.notification-item time { display: block; margin-top: 7px; color: #918d83; font-size: .68rem; }
@media (max-width: 900px) {
  .portal-layout { grid-template-columns: 1fr; }
  .portal-sidebar { position: static; height: auto; }
  .portal-nav { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .portal-nav button { white-space: nowrap; }
  .sidebar-foot { margin-top: 18px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .portal-main { padding: 22px 14px 44px; }
  .portal-topbar { align-items: flex-start; }
  .portal-topbar h1 { font-size: 1.7rem; }
  .notification-button { font-size: 0; }
  .notification-button .badge { font-size: .72rem; margin: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
