/* ============================================================================
   Better Trends — Vendor Portal · "calm supplier portal" design system
   Distinct from the DMS: warm-neutral ground, teal accent, Fraunces display +
   Manrope UI, soft rounded surfaces, airy top-nav (no sidebar).
   ============================================================================ */

:root {
    /* Palette */
    --ink:        #18262f;   /* near-navy text */
    --ink-soft:   #3c4d59;
    --muted:      #6a7783;
    --muted-2:    #97a2ac;
    --bg:         #f4f3ef;   /* warm off-white page */
    --bg-2:       #eeece6;
    --surface:    #ffffff;
    --line:       #e7e4dd;   /* warm hairline */
    --line-2:     #efece5;

    --brand:      #0f776e;   /* teal-700 */
    --brand-ink:  #0a5c55;
    --brand-2:    #14867c;
    --brand-soft: #e4f1ef;
    --brand-tint: #f0f7f6;

    --clay:       #b5623b;   /* warm secondary accent (CTAs / "needs you") */
    --clay-soft:  #f6e9e2;

    --ok:         #2f7a55;   --ok-soft:  #e5f1ea;
    --warn:       #a9741a;   --warn-soft:#f6ecd7;
    --danger:     #b5433b;   --danger-soft:#f6e3e1;
    --info:       #2c6b8f;   --info-soft:#e2eef4;

    --radius:   16px;
    --radius-sm:10px;
    --shadow:   0 1px 2px rgba(24,38,47,.04), 0 10px 30px -18px rgba(24,38,47,.28);
    --shadow-sm:0 1px 2px rgba(24,38,47,.05);

    --font-ui:  "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
    /* The portal commits to its light, calm identity; no dark theme for now. */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-ui);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { color: var(--brand); }

h1, h2, h3, h4, h5 { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
.display { font-family: var(--font-display); }

.text-muted { color: var(--muted); }
.text-brand { color: var(--brand); }
.small { font-size: 13px; }
.tiny  { font-size: 11.5px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }

/* ── Top nav ──────────────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1120px; margin: 0 auto; padding: 0 24px;
    height: 64px; display: flex; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: 8px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--brand-2), var(--brand-ink));
    color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px;
    box-shadow: 0 4px 12px -4px rgba(15,119,110,.5);
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand-name small { display: block; font-family: var(--font-ui); font-weight: 600; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); line-height: 1; margin-top: 1px; }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.nav-link {
    padding: 7px 13px; border-radius: 9px; color: var(--ink-soft); font-weight: 600; font-size: 14px;
    line-height: 1; transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--bg-2); color: var(--ink); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-ink); }

.topbar-spacer { flex: 1 1 auto; }

.usermenu { position: relative; }
.usermenu-btn {
    display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    cursor: pointer; color: var(--ink); font-family: var(--font-ui);
}
.usermenu-btn:hover { border-color: var(--brand); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
    background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center;
    font-weight: 800; font-size: 12px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.usermenu-meta { text-align: left; line-height: 1.15; padding-right: 4px; }
.usermenu-meta b { font-size: 13px; font-weight: 700; display: block; }
.usermenu-meta span { font-size: 11px; color: var(--muted); }
.usermenu-pop {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); padding: 6px; display: none;
}
.usermenu.open .usermenu-pop { display: block; }
.usermenu-pop a, .usermenu-pop button {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    padding: 9px 11px; border: 0; background: none; border-radius: 8px; color: var(--ink-soft);
    font: inherit; font-size: 14px; cursor: pointer;
}
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--bg-2); color: var(--ink); }
.usermenu-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 4px; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 30px 24px 64px; }
.page-head { margin-bottom: 22px; }
.page-title { font-size: 30px; }
.page-sub { color: var(--muted); margin-top: 4px; }

.row { display: flex; flex-wrap: wrap; gap: 18px; }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .topbar-inner { padding: 0 16px; } .wrap { padding: 22px 16px 48px; } .nav-links { display: none; } }

/* ── Card ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-hd { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; }
.card-hd h3 { font-size: 17px; }
.card-lift { transition: box-shadow .15s, transform .15s, border-color .15s; }
.card-lift:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--line); }

/* ── Stat tile ────────────────────────────────────────────────────────── */
.stat { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.stat-ico {
    width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: 22px;
    background: var(--brand-tint); color: var(--brand);
}
.stat-ico.clay { background: var(--clay-soft); color: var(--clay); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-ico.ok   { background: var(--ok-soft);   color: var(--ok); }
.stat-ico.info { background: var(--info-soft); color: var(--info); }
.stat-num { font-family: var(--font-display); font-size: 27px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-ui); font-weight: 700; font-size: 14px; line-height: 1;
    padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    cursor: pointer; transition: background .13s, border-color .13s, color .13s, box-shadow .13s;
    white-space: nowrap;
}
.btn i { font-size: 18px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(15,119,110,.6); }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-clay { background: var(--clay); color: #fff; }
.btn-clay:hover { background: #9c522f; color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-soft:hover { background: #d6ebe8; }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Pills / badges ───────────────────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 700; letter-spacing: .01em; background: var(--bg-2); color: var(--ink-soft);
}
.pill.dot::before { content:""; width:6px; height:6px; border-radius:50%; background: currentColor; }
.pill-inquiry  { background: var(--warn-soft); color: var(--warn); }
.pill-issued   { background: var(--brand-soft); color: var(--brand-ink); }
.pill-complete { background: var(--ok-soft); color: var(--ok); }
.pill-draft    { background: var(--bg-2); color: var(--muted); }
.pill-danger   { background: var(--danger-soft); color: var(--danger); }
.pill-info     { background: var(--info-soft); color: var(--info); }

/* ── Table ────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted-2); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--brand-tint); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.table-center th, .table-center td, .table-center .num { text-align: center; }

.thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); background: var(--bg-2); }
.thumb-ph { display: grid; place-items: center; color: var(--muted-2); font-size: 20px; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.input, .select, textarea.input {
    width: 100%; font-family: var(--font-ui); font-size: 15px; color: var(--ink);
    padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, textarea.input:focus {
    outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.input-sm { padding: 8px 11px; font-size: 14px; }
.help { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.alert i { font-size: 19px; margin-top: 1px; }
.alert-ok    { background: var(--ok-soft);   color: #235c40; }
.alert-error { background: var(--danger-soft); color: #8f332d; }
.alert-warn  { background: var(--warn-soft); color: #7d560f; }
.alert-info  { background: var(--brand-tint); color: var(--brand-ink); border: 1px solid var(--brand-soft); }

/* ── Action banner (the dashboard signature) ─────────────────────────── */
.action-strip {
    background: linear-gradient(135deg, #fff, var(--clay-soft));
    border: 1px solid #eddfd7; border-radius: var(--radius);
    padding: 18px 22px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm);
}
.action-strip .ico { width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--clay); display: grid; place-items: center; font-size: 23px; flex: 0 0 auto; box-shadow: var(--shadow-sm); }

/* ── Timeline (ex-factory / activity) ─────────────────────────────────── */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: 14px; padding-bottom: 16px; position: relative; }
.tl li:not(:last-child)::before { content:""; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.tl .tl-dot { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); font-size: 16px; z-index: 1; }

/* ── Misc ─────────────────────────────────────────────────────────────── */
.divide { border: 0; border-top: 1px solid var(--line-2); margin: 18px 0; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack-1 > * + * { margin-top: 6px; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ico { font-size: 40px; color: var(--brand); opacity: .7; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 22px; }
.kv .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); font-weight: 700; }
.kv .v { font-weight: 600; margin-top: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 11px 15px; font-weight: 700; font-size: 14px; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tab .count { font-size: 11px; background: var(--bg-2); color: var(--muted); border-radius: 999px; padding: 1px 7px; margin-left: 5px; }
.tabpane { display: none; } .tabpane.active { display: block; }

/* ── Sidebar layout (added: portal is growing into multiple modules) ─────── */
body.has-side { display: flex; min-height: 100vh; overflow-x: hidden; }
.sidebar {
    position: sticky; top: 0; align-self: flex-start;
    width: 244px; flex: 0 0 244px; height: 100vh;
    background: var(--surface); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .brand { margin: 4px 8px 18px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-link {
    display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
    color: var(--ink-soft); font-weight: 600; font-size: 14.5px; font-family: var(--font-ui);
    border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
    transition: background .12s, color .12s;
}
.side-link:hover { background: var(--bg-2); color: var(--ink); }
.side-link.active { background: var(--brand-soft); color: var(--brand-ink); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-2); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px 12px; }
.side-user-meta { line-height: 1.2; min-width: 0; }
.side-user-meta b { font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-meta span { font-size: 11.5px; color: var(--muted); }
.side-signout { color: var(--muted); }
.side-signout:hover { color: var(--danger); background: var(--danger-soft); }

.main { flex: 1 1 auto; min-width: 0; display: block; }
.main > .wrap { max-width: 1160px; }
.topbar-lite, .side-toggle, .brand-lite { display: none; }

@media (max-width: 900px) {
    body.has-side { display: block; }
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
        transition: transform .2s ease; box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .topbar-lite {
        display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px;
        position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.9);
        backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
    }
    .side-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px;
        border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-soft); cursor: pointer; }
    .brand-lite { display: inline-flex; }
}

/* ── KPI 5-up + value line ────────────────────────────────────────────── */
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px)  { .grid-5 { grid-template-columns: 1fr; } }
.stat-val { font-size: 13px; font-weight: 700; color: var(--brand-ink); margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-ico.danger { background: var(--danger-soft); color: var(--danger); }
