/* Partner portal.
   Sign-in page: the look of ribbonfinance.com.au (cream, near-black, bronze,
   Playfair Display headings, square buttons).
   Inside: the look of the staff system (Inter, white panels on a light grey
   ground, blue accents, rounded cards, a sidebar on the left). */
:root {
  --bg: #f7f8fa; --panel: #ffffff; --panel-strong: #f3f4f6; --line: #d7dde6; --line-soft: #e5e9f0;
  --text: #14171f; --muted: #525866; --faint: #7c8491;
  --brand: #3b82f6; --brand-strong: #2563eb; --brand-soft: #eaf1ff;
  --success: #15803d; --success-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fff4dc; --danger: #b42318; --danger-soft: #fde8e8;
  --radius: 12px; --shadow: 0 8px 24px rgba(15, 23, 42, 0.08); --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --font-sans: "Inter", "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Playfair Display", Georgia, "Noto Serif SC", serif;
  --cream: #f7f4f1; --ink: #0d0d0d; --bronze: #b49274; --bronze-deep: #8c6d52;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: var(--font-sans); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand-strong); }
[hidden] { display: none !important; }
.boot { padding: 48px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- sign-in (company website style) ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--cream); color: var(--ink); }
.signin-story { background: var(--ink); color: var(--cream); padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.signin-story::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 15% 110%, rgba(180, 146, 116, 0.28), transparent 55%), radial-gradient(ellipse at 100% -10%, rgba(180, 146, 116, 0.14), transparent 50%); pointer-events: none; }
.signin-story > * { position: relative; }
.signin-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.signin-brand img { width: 46px; height: 46px; object-fit: contain; background: var(--cream); padding: 5px; }
.signin-brand strong { font-family: var(--font-display); font-size: 22px; font-weight: 700; display: block; line-height: 1.1; }
.signin-brand span { color: var(--bronze); font-size: 12px; letter-spacing: 0.32em; }
.overline { color: var(--bronze); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; font-weight: 500; margin: 0 0 18px; }
.signin-story h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.16; margin: 0 0 18px; max-width: 15ch; }
.signin-story p.lead { color: rgba(247, 244, 241, 0.66); font-size: 17px; max-width: 44ch; margin: 0; }
.signin-points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid rgba(247, 244, 241, 0.16); }
.signin-points li { padding: 18px 18px 0 0; }
.signin-points b { display: block; font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }
.signin-points span { color: rgba(247, 244, 241, 0.6); font-size: 13.5px; }
.signin-panel { padding: 40px 64px; display: flex; flex-direction: column; }
.signin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.signin-top a { color: var(--ink); text-decoration: none; letter-spacing: 0.04em; }
.signin-top a:hover { text-decoration: underline; }
.lang { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.lang button { border: 0; background: transparent; cursor: pointer; padding: 6px 2px; color: rgba(13, 13, 13, 0.45); letter-spacing: 0.06em; }
.lang button.on { color: var(--bronze-deep); font-weight: 600; }
.lang i { width: 1px; height: 14px; background: rgba(13, 13, 13, 0.25); }
.signin-form { margin: auto 0; width: 100%; max-width: 400px; align-self: center; display: grid; gap: 18px; padding: 32px 0; }
.signin-form h2 { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin: 0; line-height: 1.2; }
.signin-form p.sub { margin: -8px 0 6px; color: rgba(13, 13, 13, 0.62); }
.s-field { display: grid; gap: 6px; }
.s-field span { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(13, 13, 13, 0.6); }
.s-field input { height: 50px; border: 1px solid rgba(13, 13, 13, 0.22); background: #fff; padding: 0 14px; border-radius: 0; outline: none; width: 100%; }
.s-field input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(180, 146, 116, 0.35); }
.s-button { height: 52px; border: 0; border-radius: 0; background: var(--ink); color: var(--cream); font-weight: 500; letter-spacing: 0.06em; cursor: pointer; font-size: 15px; }
.s-button:hover { background: #262626; }
.s-button:focus-visible { outline: 3px solid var(--bronze); outline-offset: 2px; }
.s-button[disabled] { opacity: 0.6; cursor: default; }
.s-error { background: #fbeaea; color: #8a1c1c; border-left: 3px solid #b42318; padding: 10px 14px; font-size: 14px; }
.s-note { font-size: 13px; color: rgba(13, 13, 13, 0.6); border-top: 1px solid rgba(13, 13, 13, 0.12); padding-top: 16px; }
.signin-foot { font-size: 12px; color: rgba(13, 13, 13, 0.5); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- inside (staff system style) ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 28%), linear-gradient(135deg, #f7f8fa 0%, #f4f7fb 42%, #eef2f7 100%); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line-soft); padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-head { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.sidebar-head img { width: 30px; height: 30px; object-fit: contain; }
.badge { padding: 2px 6px; font-size: 0.64rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.account { padding: 6px 8px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(59, 130, 246, 0.12); border-radius: 10px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 26px; }
.account-copy { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.2; }
.account-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; }
.account-copy span { font-size: 0.7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 10px 8px 2px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7280; }
.nav-tab { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); font-weight: 600; cursor: pointer; font-size: 0.9rem; }
.nav-tab:hover { background: #eef2f7; }
.nav-tab.is-active { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.14); color: var(--brand-strong); }
.nav-tab small { font-size: 0.62rem; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.sidebar-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 0.8rem; }
.sidebar-foot .lang button { color: var(--faint); }
.sidebar-foot .lang button.on { color: var(--brand-strong); }
.main { padding: 18px 26px 40px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.eyebrow { margin: 0 0 4px; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.topbar h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-button { display: none; }
.button { min-height: 36px; padding: 6px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 0.86rem; }
.button:hover { background: #f3f4f6; }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-strong); }
.button[disabled] { opacity: 0.6; cursor: default; }
.button:focus-visible, .nav-tab:focus-visible, .chip:focus-visible, .field input:focus-visible { outline: 3px solid rgba(59, 130, 246, 0.35); outline-offset: 1px; }
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: rgba(59, 130, 246, 0.1); color: var(--brand-strong); font-size: 0.74rem; font-weight: 600; white-space: nowrap; }
.pill.settled { background: var(--success-soft); color: var(--success); }
.pill.closed { background: #eef0f3; color: #525866; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 1rem; }
.card .sub, .sub { color: var(--muted); font-size: 0.82rem; margin: 0; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi .label { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi.focus { border-color: rgba(59, 130, 246, 0.35); background: linear-gradient(180deg, #f5f9ff, #fff 70%); }
.kpi .delta { font-size: 0.78rem; font-weight: 600; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-bottom: 14px; align-items: start; }
.chart-scroll { overflow-x: auto; margin-top: 10px; }
.chart { width: 100%; height: auto; display: block; }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.chart text { font-family: var(--font-sans); font-size: 11px; fill: var(--muted); }
.chart .bar { fill: var(--brand); } .chart .bar.now { fill: var(--brand-strong); } .chart .bar.zero { fill: #e5e9f0; }
.chart text.count { font-size: 12px; font-weight: 700; fill: var(--text); } .chart text.count.none { font-weight: 400; fill: #b6bfcc; }
.legend { display: flex; gap: 14px; font-size: 0.76rem; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pipe { display: grid; gap: 9px; margin-top: 12px; }
.pipe-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 0.84rem; }
.pipe-row .track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.pipe-row .track i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.list { display: grid; gap: 0; margin-top: 8px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); cursor: pointer; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%; }
.list-row:first-child { border-top: 0; }
.list-row:hover strong { color: var(--brand-strong); }
.list-row small { color: var(--muted); font-size: 0.78rem; }
.list-row .right { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 0.88rem; padding: 18px 0 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { flex: 1 1 240px; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; background: #fff; min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--brand-soft); border-color: rgba(59, 130, 246, 0.4); color: var(--brand-strong); }
.table-card { padding: 0; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.data th { text-align: left; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #f8fafc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td small { display: block; color: var(--muted); font-size: 0.76rem; }
table.data td.date { white-space: nowrap; }
.table-foot { padding: 10px 14px; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--line-soft); background: #fbfcfe; }
.soon { display: grid; gap: 14px; max-width: 760px; }
.soon .card h3 { font-size: 1.1rem; }
.soon ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; display: grid; gap: 4px; }
.field { display: grid; gap: 5px; font-size: 0.82rem; color: var(--muted); }
.field input { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; background: #fff; color: var(--text); width: 100%; }
.form { display: grid; gap: 12px; max-width: 420px; }
.notice { padding: 10px 12px; border-radius: 9px; font-size: 0.86rem; }
.notice.err { background: var(--danger-soft); color: var(--danger); } .notice.ok { background: var(--success-soft); color: var(--success); } .notice.info { background: var(--brand-soft); color: #1e3a8a; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 0.9rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; justify-content: flex-end; z-index: 30; }
.drawer { width: min(520px, 100%); height: 100%; background: var(--panel); box-shadow: -20px 0 50px rgba(15, 23, 42, 0.2); padding: 20px 22px 28px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer h2 { margin: 0; font-size: 1.25rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 0.88rem; }
.steps li i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); justify-self: center; }
.steps li.done i { background: var(--success); border-color: var(--success); }
.steps li.done b { font-weight: 600; } .steps li:not(.done) b { font-weight: 500; color: var(--muted); }
.steps li span { color: var(--muted); font-variant-numeric: tabular-nums; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .card { width: min(460px, 100%); display: grid; gap: 14px; padding: 24px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-story { padding: 28px 24px; gap: 22px; } .signin-story h1 { font-size: 28px; } .signin-points { display: none; } .signin-story p.lead { font-size: 15px; }
  .signin-panel { padding: 22px 24px 28px; } .signin-form { padding: 22px 0; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; width: 264px; transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 10; }
  .menu-button { display: inline-flex; }
  .main { padding: 14px 14px 32px; }
  .kpis, .kpis.three { grid-template-columns: minmax(0, 1fr); }
  .topbar h1 { font-size: 1.25rem; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
  table.data td { padding: 2px 0; border: 0; }
  table.data td.num { text-align: left; }
  table.data td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.76rem; }
  table.data td.blank { display: none; }
  .halves { grid-template-columns: minmax(0, 1fr); }
  .chart { min-width: 600px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; } .kv dt { margin-top: 8px; font-size: 0.78rem; }
}
