/* ---------------------------------------------------------------
   RxBridge demo — single stylesheet. Colours are tokens on :root so
   rebranding is a matter of changing a few lines here.
---------------------------------------------------------------- */
:root {
  --brand: #0e5a55;
  --brand-2: #127a72;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ef;
  --ink: #17211f;
  --ink-2: #4b5a57;
  --ink-3: #7b8a87;
  --line: #dde4e2;
  --bg: #f4f6f5;
  --card: #ffffff;
  --ok: #1f7a4a;      --ok-soft: #e2f3e9;
  --warn: #9a5b00;    --warn-soft: #fdf0d8;
  --bad: #b3261e;     --bad-soft: #fbe4e2;
  --info: #24589c;    --info-soft: #e3ecf9;
  --violet: #5b3fa0;  --violet-soft: #ece6f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 33, 30, .06), 0 1px 1px rgba(16, 33, 30, .04);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--brand) 236px, transparent 236px); }
.shell > div { min-width: 0; }
.side { background: var(--brand); color: var(--brand-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.logo { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: #fff; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex: none; }
.logo b { display: block; font-size: 15px; }
.logo span { display: block; font-size: 11px; opacity: .75; line-height: 1.2; }
.nav a { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.86); padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; background: #f2b84b; color: #3b2600; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; margin: 16px 10px 6px; }
.side-foot { margin-top: auto; font-size: 11.5px; opacity: .65; padding: 12px 10px 0; }

.top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .who { display: flex; flex-direction: column; line-height: 1.2; }
.top .who b { font-size: 14px; }
.top .who small { font-size: 12px; }
.top .grow { flex: 1; }
.bell { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--ink-2); }
.bell:hover { background: var(--bg); }
.bell .dot { position: absolute; top: 3px; right: 2px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 5px; min-width: 16px; text-align: center; }
.menu-btn { display: none; }
main { padding: 24px 28px 60px; max-width: 1280px; }
.demo-bar { background: #fff7e0; border-bottom: 1px solid #f0dfaa; color: #6b4b00; font-size: 12.5px; padding: 6px 28px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.demo-bar form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.demo-bar select { font-size: 12.5px; padding: 3px 6px; max-width: 320px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin: 0; max-width: 720px; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }

/* ---------- cards / grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .75rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-size: 12.5px; }
.kpi .s { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.kpi.accent { background: var(--brand); color: #fff; border-color: var(--brand); }
.kpi.accent .l, .kpi.accent .s { color: rgba(255,255,255,.8); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8fbfa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.prod b { display: block; }
.prod small { display: block; }

/* ---------- badges ---------- */
.b { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; line-height: 1.5; }
.b.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.b.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.b.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.b.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field small { display: block; font-weight: 400; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9d3d0; border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: var(--brand-2); }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfc; margin-bottom: 8px; cursor: pointer; }
.check input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--brand); }
.check.strong { border-color: #b9d8d3; background: var(--brand-soft); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { max-width: 260px; }
.filters select { width: auto; }
.inline { display: inline; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-2); text-decoration: none; color: #fff; }
.btn.ghost { background: #fff; color: var(--brand); border-color: #b9cfcb; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: #fff; color: var(--bad); border-color: #e9b9b5; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- alerts ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 500; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.note { border-left: 3px solid var(--info); background: var(--info-soft); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 13.5px; margin-bottom: 10px; color: #1d3f6e; }
.note.warn { border-color: var(--warn); background: var(--warn-soft); color: #5f3a00; }
.note.bad { border-color: var(--bad); background: var(--bad-soft); color: #7a1914; }
.note.ok { border-color: var(--ok); background: var(--ok-soft); color: #154f31; }
.empty { text-align: center; color: var(--ink-3); padding: 26px 10px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.notif.unread { background: #f3faf8; }
.notif-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 14px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- timeline ---------- */
.steps { display: flex; gap: 0; margin: 4px 0 18px; }
.step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--ink-3); }
.step::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step .dot { width: 24px; height: 24px; border-radius: 99px; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; margin: 0 auto 4px; position: relative; z-index: 1; font-size: 11px; font-weight: 700; }
.step.done { color: var(--ok); }
.step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done::before, .step.now::before { background: var(--ok); }
.step.now { color: var(--brand); font-weight: 600; }
.step.now .dot { border-color: var(--brand); color: var(--brand); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 99px; background: var(--brand-2); border: 2px solid #fff; }

/* ---------- bars ---------- */
.meter { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--brand-2); }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand-2); }
.chart .lbl { fill: var(--ink-3); font-size: 11px; }
.chart .val { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.chart .grid-l { stroke: var(--line); }

/* ---------- landing ---------- */
.landing { background: var(--bg); }
.hero { background: linear-gradient(160deg, #0b4a46 0%, #0e5a55 55%, #13766e 100%); color: #fff; padding: 22px 0 70px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.hero nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 56px; }
.hero h1 { font-size: 2.5rem; max-width: 760px; letter-spacing: -.025em; line-height: 1.12; margin-bottom: 16px; }
.hero p.lead { font-size: 1.1rem; max-width: 640px; opacity: .88; margin-bottom: 26px; }
.hero .btn { background: #fff; color: var(--brand); border-color: #fff; }
.hero .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.signals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: -40px; }
.signal { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: 0 6px 20px rgba(14, 90, 85, .08); }
.signal .tag { font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.section { padding: 48px 0 8px; }
.section h2 { font-size: 1.5rem; margin-bottom: 14px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: s; }
.flow div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; position: relative; }
.flow div::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: 8px; }
.is-not { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.footer { color: var(--ink-3); font-size: 12.5px; padding: 40px 0; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; background: linear-gradient(160deg, #0b4a46, #13766e); }
.auth-box { width: 100%; max-width: 980px; display: grid; grid-template-columns: 1fr 1.15fr; gap: 0; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-box.narrow { max-width: 440px; grid-template-columns: 1fr; }
.auth-form { padding: 32px; }
.auth-demo { background: #f6f9f8; border-left: 1px solid var(--line); padding: 28px; max-height: 640px; overflow-y: auto; }
.demo-user { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.demo-user:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.demo-user .av { width: 30px; height: 30px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.demo-user .grow { flex: 1; min-width: 0; }
.demo-user b { display: block; font-size: 13px; }
.demo-user small { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- print (transfer record) ---------- */
.record { background: #fff; max-width: 820px; margin: 24px auto; padding: 36px; border: 1px solid var(--line); }
.record table td, .record table th { padding: 6px 8px; }
.sig { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 12px; margin-top: 34px; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .record { border: 0; margin: 0; padding: 0; max-width: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .grid[style] { grid-template-columns: minmax(0, 1fr) !important; }
  .top .btn.ghost.sm[href] { display: none; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
  .top { padding: 10px 16px; }
  main { padding: 18px 16px 50px; }
  .demo-bar { padding: 6px 16px; }
  .g2, .g3, .g4, .signals, .flow, .is-not { grid-template-columns: minmax(0, 1fr); }
  .demo-bar select { max-width: 100%; }
  .span2 { grid-column: auto; }
  .auth-box { grid-template-columns: 1fr; }
  .auth-demo { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .hero h1 { font-size: 1.9rem; }
  .top .who small { display: none; }
}
