/* iPOS Partner Portal — visual system.
 *
 * Direction: "warm, grounded field tool". Partner staff work rural-customer
 * referral leads from agrodealers toward an earned commission. iPOS navy is the
 * brand INK; surfaces are warm stone (not cold grey); one sprout-green accent
 * marks "active / earned". Craft comes from subtle layering — whisper-quiet
 * surface elevation + low-opacity warm borders — not from heavy lines or shadow.
 *
 * No build step. Self-hosted variable fonts. Status hues keep their cross-surface
 * meaning (new / in-progress / closed) so a record reads the same everywhere.
 */

/* ───── Fonts (self-hosted, offline-safe, same-origin) ──────────────────────── */
@font-face {
    font-family: 'Hanken Grotesk';
    src: url('fonts/hanken-grotesk.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-display: swap;
    font-style: normal;
}
@font-face {
    font-family: 'Geist Mono';
    src: url('fonts/geist-mono.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-display: swap;
    font-style: normal;
}

/* ───── Tokens ──────────────────────────────────────────────────────────────── */
:root {
    /* Brand ink (iPOS navy) */
    --ink:        #002C4B;
    --ink-2:      #0A3A5C;
    --ink-soft:   #E4EBF0;

    /* Warm neutral surfaces — elevation by lightness only, never hue */
    --canvas:     #F6F3EE;   /* page */
    --surface-1:  #FFFDFB;   /* card */
    --surface-2:  #F4F0EA;   /* inset (inputs, wells) */
    --surface-3:  #FFFFFF;   /* raised (menus, modals) */

    /* Text — 4 levels */
    --text-1:     #241F1A;
    --text-2:     #5C534A;
    --text-3:     #8A8076;
    --text-muted: #B4A99D;
    --on-ink:     #F4F7F9;

    /* Borders — low opacity warm, found only when looked for */
    --border-1:   rgba(45, 35, 24, 0.10);
    --border-2:   rgba(45, 35, 24, 0.06);
    --border-strong: rgba(45, 35, 24, 0.16);

    /* Accent — sprout (active / earned) */
    --sprout:     #3B8A57;
    --sprout-ink: #235C38;
    --sprout-soft:#E7F1E9;

    /* Attention — amber (new leads, unprovisioned) */
    --amber:      #B97E16;
    --amber-soft: #F6ECD7;

    /* Danger / sand-clay */
    --danger:     #AE4E2B;
    --danger-soft:#F6E6DE;

    /* Status (cross-surface meaning, warm-retinted) */
    --st-new-bg:      #DDE8F4;  --st-new-fg:      #28527E;
    --st-working-bg:  #E7E1F2;  --st-working-fg:  #56407F;
    --st-closed-bg:   #DCEFE1;  --st-closed-fg:   var(--sprout-ink);

    /* Radii */
    --r-sm: 9px; --r-md: 13px; --r-lg: 18px; --r-pill: 999px;

    /* Depth — one soft, warm-tinted tier */
    --shadow-xs: 0 1px 2px rgba(45, 35, 24, 0.05);
    --shadow-sm: 0 1px 2px rgba(45,35,24,.04), 0 2px 6px rgba(45,35,24,.05);
    --shadow-md: 0 8px 26px -8px rgba(45, 35, 24, 0.16);
    --ring:      0 0 0 3px rgba(59, 138, 87, 0.28);   /* sprout focus */
    --ring-ink:  0 0 0 3px rgba(0, 44, 75, 0.16);

    /* Spacing base = 4px */
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ───── Reset-ish ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-1);
    background:
        radial-gradient(1200px 480px at 88% -8%, rgba(59,138,87,0.05), transparent 60%),
        radial-gradient(900px 420px at -6% 4%, rgba(0,44,75,0.04), transparent 55%),
        var(--canvas);
    background-attachment: fixed;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.006em;
}
.hidden { display: none !important; }
.mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
h1, h2, h3 { letter-spacing: -0.02em; color: var(--text-1); }

/* ───── Header band ─────────────────────────────────────────────────────────── */
.brand {
    background: linear-gradient(180deg, var(--ink-2), var(--ink));
    color: var(--on-ink);
    border-bottom: 1px solid rgba(0,0,0,0.25);
}
.brand-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 15px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand .logo { height: 26px; width: auto; display: block; }
.brand .brand-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    opacity: 0.82;
    padding-left: 12px;
    margin-left: 2px;
    border-left: 1px solid rgba(255,255,255,0.22);
}
.brand .logout {
    margin-left: auto;
    background: rgba(255,255,255,0.06);
    color: var(--on-ink);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 7px 15px;
    border-radius: var(--r-pill);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s var(--ease);
}
.brand .logout:hover { background: rgba(255, 255, 255, 0.14); }

/* ───── Layout ──────────────────────────────────────────────────────────────── */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 24px 72px;
}
section h2 { font-size: 19px; margin: 0; }

/* ───── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
}
.muted { color: var(--text-3); font-size: 14px; }

/* ───── Login ───────────────────────────────────────────────────────────────── */
#login-view { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.login-card {
    width: 100%;
    max-width: 408px;
    padding: 34px 32px 32px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--ink), var(--sprout));
}
.login-mark {
    width: 46px; height: 46px; border-radius: 14px;
    background: linear-gradient(180deg, var(--ink-2), var(--ink));
    display: grid; place-items: center; margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.login-mark svg { width: 24px; height: 24px; color: #fff; }
.login-card h1 { margin: 0 0 6px; font-size: 23px; font-weight: 700; }

/* ───── Forms ───────────────────────────────────────────────────────────────── */
.field { display: block; margin-top: 16px; }
.field > span {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    letter-spacing: 0.005em;
}
.field select,
.field textarea,
.field input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    font: inherit;
    font-size: 14.5px;
    color: var(--text-1);
    background: var(--surface-2);
    transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease), background 0.14s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted); }
.field textarea { resize: vertical; min-height: 70px; }
.field select:focus,
.field textarea:focus,
.field input:focus {
    outline: none;
    background: var(--surface-1);
    border-color: var(--sprout);
    box-shadow: var(--ring);
}

button.primary {
    width: 100%;
    margin-top: 22px;
    background: linear-gradient(180deg, var(--ink-2), var(--ink));
    color: #fff;
    border: 1px solid rgba(0,0,0,0.2);
    padding: 12px 18px;
    border-radius: var(--r-sm);
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: transform 0.12s var(--ease), filter 0.14s var(--ease);
}
button.primary:hover { filter: brightness(1.08); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }

button.ghost {
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    padding: 8px 15px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    display: inline-flex; align-items: center; gap: 7px;
    transition: background 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}
button.ghost:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border-strong); }
button.ghost svg { width: 15px; height: 15px; }

/* ───── Feedback ────────────────────────────────────────────────────────────── */
.error, .form-msg, .success-msg {
    margin-top: 14px; padding: 11px 13px; border-radius: var(--r-sm);
    font-size: 13.5px; font-weight: 500;
    border: 1px solid transparent;
}
.error, .form-msg-err {
    background: var(--danger-soft); color: var(--danger); border-color: rgba(174,78,43,.18);
}
.form-msg-ok, .success-msg {
    background: var(--sprout-soft); color: var(--sprout-ink); border-color: rgba(59,138,87,.20);
}
.success-msg { margin: 0 0 6px; }

/* ───── Primary nav ─────────────────────────────────────────────────────────── */
.portal-nav {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: 2px 0 26px;
    padding: 5px;
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
}
.nav-btn {
    background: transparent; border: none;
    padding: 8px 14px;
    border-radius: 9px;
    font: inherit; font-size: 13.5px; font-weight: 600;
    color: var(--text-3);
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.nav-btn svg { width: 16px; height: 16px; opacity: 0.85; }
.nav-btn:hover { color: var(--text-1); background: var(--surface-2); }
.nav-btn.active {
    color: var(--ink);
    background: var(--ink-soft);
}

/* ───── Pipeline (the signature) ────────────────────────────────────────────── */
.pipeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}
.stage {
    background: var(--surface-1);
    padding: 16px 18px 17px;
    position: relative;
    display: flex; flex-direction: column; gap: 7px;
}
.stage-head { display: flex; align-items: center; gap: 8px; }
.stage-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.stage-name {
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--text-3);
}
.stage-num {
    font-size: 30px; font-weight: 700; line-height: 1; color: var(--text-1);
    letter-spacing: -0.03em;
}
.stage-foot { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
/* connective chevron between stages */
.stage:not(:last-child)::after {
    content: ""; position: absolute; right: -6px; top: 50%; z-index: 2;
    width: 11px; height: 11px; transform: translateY(-50%) rotate(45deg);
    background: var(--surface-1);
    border-top: 1px solid var(--border-1); border-right: 1px solid var(--border-1);
}
.stage.s-total .stage-dot { background: var(--ink); }
.stage.s-total { background: linear-gradient(180deg, #fff, var(--surface-2)); }
.stage.s-new   .stage-dot { background: var(--amber); }
.stage.s-new   .stage-num { color: var(--amber); }
.stage.s-work  .stage-dot { background: var(--st-working-fg); }
.stage.s-closed .stage-dot { background: var(--sprout); }
.stage.s-closed .stage-num { color: var(--sprout-ink); }

/* ───── Section header ──────────────────────────────────────────────────────── */
.dashboard-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin: 2px 0 14px;
}
.dashboard-header h2 { font-size: 18px; }

/* ───── List toolbar: search box + actions ──────────────────────────────────── */
.toolbar-actions { display: flex; align-items: center; gap: 10px; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box .search-icon {
    position: absolute; left: 11px;
    width: 15px; height: 15px;
    color: var(--text-3);
    pointer-events: none;
    transition: color 0.14s var(--ease);
}
.search-box input {
    font: inherit; font-size: 13px;
    color: var(--text-1);
    background: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    padding: 8px 12px 8px 33px;
    width: 230px; max-width: 52vw;
    transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease), background 0.14s var(--ease);
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus {
    outline: none;
    background: var(--surface-1);
    border-color: var(--sprout);
    box-shadow: var(--ring);
}
.search-box:focus-within .search-icon { color: var(--sprout); }
/* Hide the native clear affordance — it clashes with the warm field styling. */
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* ───── Pagination footer ────────────────────────────────────────────────────── */
.pager {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 13px 16px;
    border-top: 1px solid var(--border-2);
}
.pager-range { color: var(--text-3); font-size: 13px; }
.pager-controls { display: flex; align-items: center; gap: 8px; }
.pager-page { color: var(--text-2); font-size: 13px; padding: 0 2px; }
.pager-btn { padding: 6px 13px; font-size: 13px; }
button.ghost:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost:disabled:hover {
    background: var(--surface-1);
    color: var(--text-2);
    border-color: var(--border-1);
}

/* ───── Referrals list (lead rows) ──────────────────────────────────────────── */
#referrals-wrap {
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left;
    background: var(--surface-2);
    color: var(--text-3);
    font-weight: 700; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
    padding: 11px 18px;
    border-bottom: 1px solid var(--border-1);
}
tbody td { padding: 13px 18px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
.status-col { width: 196px; }
.commission-col { width: 168px; text-align: right; white-space: nowrap; }

/* customer cell: avatar + name/phone */
.lead-cell { display: flex; align-items: center; gap: 12px; }
.lead-avatar {
    width: 34px; height: 34px; border-radius: 11px; flex: none;
    display: grid; place-items: center;
    background: var(--ink-soft); color: var(--ink);
    font-size: 13px; font-weight: 700;
}
.lead-main { display: flex; flex-direction: column; line-height: 1.3; }
.lead-name { font-weight: 600; color: var(--text-1); }
.lead-phone { font-size: 12.5px; color: var(--text-3); }
.cell-sub { color: var(--text-2); }
.cell-meta { color: var(--text-3); font-size: 13px; }

/* ───── Expandable referral detail (notes + signature) ──────────────────────── */
td.expandable { cursor: pointer; }
td.expandable:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--sprout); }
.lead-chevron { margin-left: auto; color: var(--text-3); display: inline-flex; transition: transform 0.16s var(--ease), color 0.14s var(--ease); }
.lead-chevron svg { width: 16px; height: 16px; }
td.expandable:hover .lead-chevron { color: var(--text-1); }
td.expandable.open .lead-chevron { transform: rotate(180deg); color: var(--sprout); }

.referral-detail-row td { background: var(--surface-2); padding: 0; border-bottom: 1px solid var(--border-2); }
.referral-detail {
    display: flex; gap: 32px; flex-wrap: wrap;
    padding: 16px 18px 18px;
}
.detail-block { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.detail-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-3);
}
.detail-value { color: var(--text-1); font-size: 14px; white-space: pre-wrap; max-width: 60ch; }
.detail-value.muted { color: var(--text-3); }
.signature-img {
    max-width: 260px; max-height: 120px; width: auto;
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    padding: 6px;
}
.detail-link { font-size: 12.5px; color: var(--sprout-ink); font-weight: 600; margin-top: 2px; width: fit-content; }
.detail-link:hover { text-decoration: underline; }

/* ───── Notification recipients (comm preferences) ──────────────────────────── */
.comm-pref-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 13px;
    background: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    margin-bottom: 8px;
}
.comm-pref-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.comm-pref-email { font-weight: 600; color: var(--text-1); overflow-wrap: anywhere; }
.comm-pref-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.link-action {
    background: none; border: none; padding: 0; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600;
    color: var(--sprout-ink);
    transition: color 0.14s var(--ease);
}
.link-action:hover { text-decoration: underline; }
.link-action.danger { color: var(--danger); }
.comm-pref-form { margin-top: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); margin: 2px 0 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--sprout); }

/* ───── Onboard wizard ──────────────────────────────────────────────────────── */
.wizard-steps {
    display: flex; gap: 8px; list-style: none; padding: 0;
    margin: 4px 0 20px;
}
.wizard-step-tab {
    display: flex; align-items: center; gap: 8px;
    flex: 1; min-width: 0;
    font-size: 13px; font-weight: 600; color: var(--text-3);
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    cursor: default;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color 0.14s var(--ease), background 0.14s var(--ease), border-color 0.14s var(--ease);
}
.wizard-num {
    display: grid; place-items: center; flex: none;
    width: 22px; height: 22px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
    background: var(--surface-3); color: var(--text-3);
    border: 1px solid var(--border-1);
}
.wizard-step-tab.active { color: var(--ink); background: var(--ink-soft); border-color: rgba(0,44,75,.18); }
.wizard-step-tab.active .wizard-num { background: var(--ink); color: #fff; border-color: var(--ink); }
.wizard-step-tab.done { color: var(--sprout-ink); cursor: pointer; }
.wizard-step-tab.done .wizard-num { background: var(--sprout); color: #fff; border-color: var(--sprout); }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: wizardin 0.18s var(--ease); }
@keyframes wizardin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.wizard-nav { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.wizard-nav #onboard-next, .wizard-nav #onboard-submit { margin-left: auto; }

/* commission as "earned" */
.commission-cell { display: inline-flex; align-items: baseline; gap: 9px; justify-content: flex-end; }
.commission-cell.muted { color: var(--text-muted); }
.commission-amount {
    font-family: 'Geist Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
    font-weight: 600; color: var(--sprout-ink); font-size: 14px;
}
.commission-amount::before { content: "KES "; color: var(--text-muted); font-size: 11px; font-weight: 500; }
.commission-edit {
    background: none; border: none; color: var(--text-3); cursor: pointer;
    font: inherit; font-size: 11.5px; font-weight: 600; padding: 0;
    border-bottom: 1px dashed var(--border-strong);
}
.commission-edit:hover { color: var(--ink); }

/* inline status control — coloured pill <select> */
.status-select {
    width: 100%;
    padding: 8px 30px 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em;
    cursor: pointer;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4 L6 8 L10 4' stroke='currentColor' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat; background-position: right 11px center; background-size: 11px;
    transition: box-shadow 0.14s var(--ease), filter 0.14s var(--ease);
}
.status-select:hover { filter: brightness(0.97); }
.status-select:focus { outline: none; box-shadow: var(--ring-ink); }
.status-select[data-status="submitted"]   { background-color: var(--st-new-bg);     color: var(--st-new-fg); }
.status-select[data-status="in_progress"]  { background-color: var(--st-working-bg); color: var(--st-working-fg); }
.status-select[data-status="closed"]       { background-color: var(--st-closed-bg);  color: var(--st-closed-fg); }

.pill { display: inline-block; padding: 3px 11px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; }
.pill-submitted   { background: var(--st-new-bg);     color: var(--st-new-fg); }
.pill-in_progress { background: var(--st-working-bg); color: var(--st-working-fg); }
.pill-closed      { background: var(--st-closed-bg);  color: var(--st-closed-fg); }

tr.saving { background: var(--sprout-soft) !important; }
tr.error-row .status-select { box-shadow: 0 0 0 1.5px var(--danger); }

/* ───── Empty / load states ─────────────────────────────────────────────────── */
#empty-state, #load-error { padding: 44px 24px; text-align: center; }
.state-illus {
    width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 15px;
    background: var(--surface-2); border: 1px solid var(--border-1);
    display: grid; place-items: center; color: var(--text-3);
}
.state-illus svg { width: 24px; height: 24px; }
#empty-state { color: var(--text-3); font-size: 14px; }

/* loading skeleton rows */
.skeleton-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-2); }
.sk { background: linear-gradient(90deg, var(--surface-2), #efeae3, var(--surface-2)); background-size: 200% 100%;
      animation: shimmer 1.3s linear infinite; border-radius: 7px; height: 12px; }
.sk-av { width: 34px; height: 34px; border-radius: 11px; flex: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───── Onboarding / self-service forms ─────────────────────────────────────── */
.form-narrow { max-width: 660px; margin: 0 auto 20px; }
.form-narrow + .form-narrow { margin-top: 0; }
.form-narrow h2 { margin: 0 0 4px; font-size: 19px; }
.form-section {
    margin: 26px 0 4px; padding-top: 18px;
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-3);
    border-top: 1px solid var(--border-2);
}
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

/* logo dropzone */
.logo-preview { margin-top: 10px; }
.logo-preview img {
    max-height: 76px; max-width: 190px;
    border: 1px solid var(--border-1); border-radius: var(--r-sm);
    padding: 8px; background: var(--surface-1); object-fit: contain;
}
.adduser-form { margin-top: 6px; }
.link-back {
    background: none; border: none; color: var(--ink); cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; padding: 0 0 14px;
    display: inline-flex; align-items: center; gap: 6px;
}
.link-back svg { width: 14px; height: 14px; }

/* ───── Manage partners ─────────────────────────────────────────────────────── */
.partner-row {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 6px; border-bottom: 1px solid var(--border-2);
}
.partner-row:last-child { border-bottom: none; }
.partner-row.clickable { cursor: pointer; border-radius: var(--r-md); padding: 13px 12px; transition: background 0.12s var(--ease); }
.partner-row.clickable:hover { background: var(--surface-2); }
.partner-logo {
    width: 40px; height: 40px; border-radius: 12px; flex: none; object-fit: cover;
    background: var(--surface-2); border: 1px solid var(--border-1);
    display: grid; place-items: center; color: var(--ink); font-weight: 700; font-size: 15px; overflow: hidden;
}
.partner-logo img { width: 100%; height: 100%; object-fit: cover; }
.partner-row-main { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.partner-row-name { font-weight: 600; font-size: 15px; color: var(--text-1); }
.partner-row-sub { font-size: 12.5px; color: var(--text-3); }
.badge {
    font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill);
    text-transform: uppercase; letter-spacing: 0.05em;
    display: inline-flex; align-items: center; gap: 5px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-ok { background: var(--sprout-soft); color: var(--sprout-ink); }
.badge-muted { background: var(--amber-soft); color: var(--amber); }

.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { display: flex; flex-direction: column; gap: 1px; padding: 11px 4px; border-bottom: 1px solid var(--border-2); }
.user-list li:last-child { border-bottom: none; }
.user-name { font-weight: 600; font-size: 14px; color: var(--text-1); }
.user-sub { font-size: 12.5px; color: var(--text-3); }

/* ───── Phone-sized screens ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
    .pipeline { grid-template-columns: repeat(2, 1fr); }
    .stage:not(:last-child)::after { display: none; }
    .field-row { flex-direction: column; gap: 0; }

    thead { display: none; }
    table, tbody, tr, td { display: block; width: 100%; }
    tbody tr { padding: 12px 4px; border-bottom: 1px solid var(--border-1); }
    tbody tr:hover { background: transparent; }
    tbody tr:last-child { border-bottom: none; }
    tbody td { padding: 5px 16px; border: none; }
    tbody td::before {
        content: attr(data-label);
        display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
        text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px;
    }
    .lead-cell td::before, td.status-col, td.commission-col { width: auto; }
    .status-col, .commission-col { width: auto; text-align: left; }
    .commission-cell { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
