@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
  --petrol: #054B4F;
  --petrol-2: #0A6367;
  --petrol-3: #00A78D;
  --cyan: #44C7F4;
  --paper: #F3F6F5;
  --surface: #FFFFFF;
  --ink: #1B2524;
  --muted: #5F6E6C;
  --line: #DCE4E2;
  --gold: #C8921B;
  --gold-soft: #F7EDD6;
  --blue: #2F5FA8;
  --blue-soft: #E4ECF8;
  --amber: #A86B12;
  --amber-soft: #FBEFD9;
  --red: #B5402F;
  --red-soft: #F8E3DF;
  --green: #2E7D5B;
  --green-soft: #DFF1E8;
  --radius-sm: 6px;
  --radius: 10px;
  font-family: 'Instrument Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
a { color: var(--petrol-3); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--petrol); color: #D7E5E3; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; color: #fff; }
.brand-mark { width: 34px; height: 40px; display: block; flex: none; }
.brand-seal { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--cyan); display: grid; place-items: center; font-weight: 700; color: var(--cyan); font-size: .85rem; }
.brand b { display: block; font-size: 1rem; }
.brand span { font-size: .78rem; color: #9FBAB7; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: var(--radius-sm); color: #D7E5E3; text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--petrol-2); }
.nav a.active { background: #fff; color: var(--petrol); }
.nav .count { background: var(--gold); color: #fff; font-size: .72rem; padding: 1px 7px; border-radius: 99px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--petrol-2); font-size: .85rem; }
.side-foot button { background: none; border: 0; color: #9FBAB7; padding: 6px 0 0; cursor: pointer; text-decoration: underline; }

.main { padding: 28px 36px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.grid > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ledger strip for key figures (not stat cards) */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.ledger > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.ledger > div:last-child { border-right: 0; }
.ledger .v { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ledger .l { color: var(--muted); font-size: .85rem; }
.ledger .wallet { background: var(--petrol); color: #fff; }
.ledger .wallet .l { color: #9FBAB7; }
.ledger a.hot { display: block; color: inherit; text-decoration: none; background: var(--red-soft); border-right: 1px solid var(--line); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #F7FAF9; }
.t .r { text-align: right; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--paper); color: var(--muted); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-gold { background: var(--gold-soft); color: #8A6210; }

/* ---------- forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--petrol); background: var(--petrol); color: #fff; padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; text-decoration: none; font-size: .92rem; }
.btn:hover { background: var(--petrol-2); }
.btn.ghost { background: transparent; color: var(--petrol); }
.btn.ghost:hover { background: #E8EFEE; }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.gold:hover { background: #B07F14; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.sm { padding: 5px 11px; font-size: .84rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .86rem; }
.field .hint { color: var(--muted); font-size: .8rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  border: 1px solid #C9D4D2; border-radius: var(--radius-sm); padding: 9px 11px; background: #fff; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.choice-set { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-set label { border: 1px solid #C9D4D2; border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; font-weight: 500; background: #fff; }
.choice-set input { position: absolute; opacity: 0; pointer-events: none; }
.choice-set label:has(input:checked) { border-color: var(--petrol); background: var(--petrol); color: #fff; }
.choice-set label:has(input:focus-visible) { outline: 3px solid var(--gold); }
.filebox { border: 1.5px dashed #B7C6C3; border-radius: var(--radius); padding: 14px; background: #FAFCFB; }
.filebox ul { margin: 8px 0 0; padding-left: 18px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 8px; }

/* ---------- wizard steps (a real sequence) ---------- */
.steps { display: flex; gap: 0; margin-bottom: 22px; counter-reset: s; flex-wrap: wrap; }
.steps li { list-style: none; flex: 1; min-width: 120px; padding: 10px 12px; border-bottom: 3px solid var(--line); color: var(--muted); font-weight: 500; font-size: .9rem; counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.done { border-color: var(--petrol-3); color: var(--petrol-3); }
.steps li.now { border-color: var(--gold); color: var(--ink); font-weight: 600; }
.steps { padding: 0; }

/* ---------- recommendations ---------- */
.rec { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.rec.best { border: 2px solid var(--petrol); }
.rec-top { display: flex; justify-content: space-between; gap: 10px; }
.score { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--petrol) calc(var(--s) * 1%), var(--line) 0); position: relative; }
.score span { width: 46px; height: 46px; background: #fff; border-radius: 50%; display: grid; place-items: center; font-size: .92rem; }
.rec ul { margin: 0; padding-left: 18px; font-size: .88rem; }
.rec .gaps li { color: var(--amber); }
.price { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- status track: the stamped route ---------- */
.track { display: flex; align-items: flex-start; margin: 10px 0 6px; overflow-x: auto; padding: 8px 2px 4px; }
.track .stop { flex: 1; min-width: 104px; text-align: center; position: relative; font-size: .8rem; color: var(--muted); }
.track .stop::before { content: ""; position: absolute; top: 19px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.track .stop:first-child::before { display: none; }
.track .stop.done::before, .track .stop.now::before { background: var(--petrol-3); }
.track .dot { width: 40px; height: 40px; margin: 0 auto 8px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; position: relative; z-index: 1; font-weight: 700; }
.track .done .dot { background: var(--petrol-3); border-color: var(--petrol-3); color: #fff; }
.track .now .dot { border: 3px double var(--gold); color: var(--gold); transform: rotate(-12deg); width: 46px; height: 46px; margin-top: -3px; background: var(--gold-soft); }
.track .now { color: var(--ink); font-weight: 600; }
.track .now.alert .dot { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.track .now.alert { color: var(--red); }
@media (prefers-reduced-motion: no-preference) {
  .track .now .dot { animation: stamp .5s cubic-bezier(.2,1.6,.4,1) both; }
  @keyframes stamp { from { transform: scale(1.8) rotate(-30deg); opacity: 0; } to { transform: rotate(-12deg); opacity: 1; } }
}

/* ---------- timeline / notes ---------- */
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; font-size: .9rem; }
.log li::before { content: ""; position: absolute; left: -5px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--petrol-3); }
.log li.internal::before { background: var(--gold); }
.note-internal { background: var(--gold-soft); border-radius: var(--radius-sm); padding: 2px 6px; font-size: .75rem; font-weight: 600; color: #8A6210; }

/* ---------- chat ---------- */
.chat-thread { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; padding: 4px 6px 4px 2px; margin-bottom: 14px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: var(--radius-sm); font-size: .88rem; line-height: 1.45; }
.bubble .who { display: block; font-size: .72rem; font-weight: 700; opacity: .75; margin-bottom: 2px; }
.bubble .when { display: block; font-size: .68rem; opacity: .6; margin-top: 4px; }
.bubble.theirs { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.bubble.mine { align-self: flex-end; background: var(--petrol-3); color: #fff; border-bottom-right-radius: 2px; }
.bubble.mine .who, .bubble.mine .when { opacity: .85; }
.bubble.internal { align-self: flex-start; background: var(--gold-soft); border: 1px dashed var(--gold); }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose textarea { flex: 1; min-height: 42px; max-height: 120px; resize: vertical; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.callout { border-left: 4px solid var(--red); background: var(--red-soft); padding: 14px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 18px; }
.callout.info { border-color: var(--gold); background: var(--gold-soft); }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); gap: 10px; font-size: .9rem; }
.doc-list li:last-child { border-bottom: 0; }

.bar-row { display: grid; grid-template-columns: 150px 1fr 36px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .88rem; }
.bar { height: 10px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--petrol-3); border-radius: 99px; }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* compare */
.compare-bar { position: sticky; bottom: 16px; background: var(--petrol); color: #fff; border-radius: var(--radius); padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.compare-table td, .compare-table th { min-width: 180px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 59, 58, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 24px; }

/* toast */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm); font-weight: 500; z-index: 60; display: none; }
#toast.err { background: var(--red); }

/* auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--petrol); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 2.4rem; max-width: 15ch; line-height: 1.1; }
.auth-art p { color: #BCD2CF; max-width: 42ch; margin-top: 16px; }
.auth-art .seal { position: absolute; right: -60px; bottom: -60px; width: 300px; height: 300px; border-radius: 50%; border: 10px double rgba(68, 199, 244, .35); }
.auth-art .route { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; font-size: .85rem; }
.auth-art .route span { border: 1px solid var(--petrol-3); padding: 5px 10px; border-radius: 99px; color: #D7E5E3; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: min(420px, 100%); }
.demo-creds { background: var(--gold-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .86rem; margin-top: 18px; }
.demo-creds button { background: none; border: 0; color: var(--petrol); text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 12px; }
  .brand { padding: 0 8px; }
  .nav { order: 3; display: flex; gap: 4px; width: 100%; overflow-x: auto; margin-top: 10px; scrollbar-width: none; }
  .nav a { white-space: nowrap; flex: none; gap: 6px; }
  .side-foot { margin: 0; border: 0; padding: 0 8px; text-align: right; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger > div, .ledger a.hot { border-bottom: 1px solid var(--line); }
  .ledger .v { font-size: 1.2rem; }
  .kv { grid-template-columns: 110px 1fr; }
  .main { padding: 20px 16px 60px; }
  .g2, .g3, .g-main { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 24px; }
  .auth-art h1 { font-size: 1.8rem; }
}
