:root {
  color-scheme: light;
  --navy:#11243e; --navy2:#1c3356; --orange:#e47117; --amber:#aa460d;
  --peach:#ffead9; --soft:#f3f6fa; --line:#dfe5ee; --muted:#53647d;
  --white:#fff; --red:#922b35; --green:#196448;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  color:var(--navy); background:var(--soft);
}
* { box-sizing:border-box }
[hidden] { display:none !important }
body { margin:0; min-height:100vh }
h1,h2,h3,p { margin:0 }
h1 { font-size:clamp(1.85rem,4vw,2.75rem); letter-spacing:-.052em; line-height:1.12 }
h2 { font-size:1.28rem; letter-spacing:-.035em }
h3 { font-size:1.05rem; letter-spacing:-.018em }
button,input,textarea,select { font:inherit }
button,a,input,textarea,select { -webkit-tap-highlight-color:transparent }
button { cursor:pointer }
button:disabled { cursor:wait; opacity:.65 }
:focus-visible { outline:3px solid #bd5a10; outline-offset:3px }
a { color:var(--navy2); text-underline-offset:.2em }
.button {
  display:inline-flex; align-items:center; justify-content:center; gap:.35rem;
  min-height:43px; border-radius:11px; border:1px solid transparent;
  background:var(--orange); color:#171f30; padding:.55rem .95rem;
  font-weight:750; font-size:.9rem; text-decoration:none; white-space:nowrap;
}
.button:hover { filter:brightness(.94) }
.button.secondary { background:white; color:var(--navy); border-color:var(--line) }
.button.danger { color:var(--red); background:#ffebec }
.button.small { padding:.35rem .65rem; min-height:36px }
.gate { width:min(58rem,calc(100% - 2rem)); margin:clamp(2rem,11vh,8rem) auto; display:grid; grid-template-columns:1fr 1.1fr; overflow:hidden; box-shadow:0 24px 70px #11243e18; border:1px solid var(--line); border-radius:24px; background:white }
.gate-brand { background:radial-gradient(circle at 105% 12%, #34517b, transparent 48%),var(--navy); padding:clamp(1.6rem,4vw,3.1rem); color:white; display:flex; flex-direction:column; gap:3rem; justify-content:space-between }
.gate-brand img,.brand img { border-radius:13px }
.gate-brand p { color:#dfe9f8; margin-top:.65rem; max-width:24ch }
.gate-brand .brand-kicker { color:#ffbc89; font-size:.84rem; font-weight:800; letter-spacing:.11em; margin-bottom:.32rem }
.gate-form { padding:clamp(1.45rem,4vw,3rem) }
.gate-form h2 { font-size:1.85rem; line-height:1.2; margin-bottom:.6rem }
.gate-form form { margin-top:1.35rem }
.gate-form .button { width:100% }
.gate-form .text-button { margin-top:1rem }
.text-button { background:none; padding:0; border:0; color:var(--navy2); text-decoration:underline; text-underline-offset:.2em }
.muted { color:var(--muted) }
.meta { font-size:.87rem; color:var(--muted) }
.workspace { display:grid; grid-template-columns:245px minmax(0,1fr); min-height:100vh }
.sidebar { position:sticky; top:0; height:100vh; display:flex; flex-direction:column; padding:1.45rem 1rem 1rem; background:var(--navy); color:white }
.brand { display:flex; align-items:center; gap:.7rem; margin:0 .35rem 2.2rem }
.brand strong { font-size:1.06rem; letter-spacing:-.027em }
.brand span { display:block; color:#b7c7df; font-size:.88rem }
#nav { display:grid; gap:.4rem }
#nav button,.sign-out { border:0; background:transparent; color:#dce7f7; font-weight:650; text-align:left; padding:.7rem .85rem; border-radius:10px; width:100% }
#nav button:hover,.sign-out:hover { background:#ffffff12 }
#nav button[aria-current="page"] { background:#2b4262; color:white; box-shadow:inset 3px 0 var(--orange) }
.sign-out { margin-top:auto }
.main { width:100%; max-width:95rem; margin:0 auto; padding:0 clamp(1rem,3.2vw,3rem) 3rem }
.topbar { min-height:70px; display:flex; justify-content:space-between; align-items:center; gap:1rem; border-bottom:1px solid var(--line); margin-bottom:1.65rem }
.topbar p { font-size:.9rem; color:var(--muted) }
.page-head { display:flex; justify-content:space-between; align-items:end; gap:1rem; flex-wrap:wrap; margin-bottom:1.25rem }
.page-head p { margin-top:.38rem; color:var(--muted) }
.hero { background:radial-gradient(circle at 95% -40%,#36547e,transparent 57%),var(--navy); color:white; border-radius:20px; padding:clamp(1.2rem,3vw,2rem); display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap; margin-bottom:1.2rem }
.hero p { color:#d8e5f7; margin-top:.44rem }
.hero .date { color:#ffbd8f; font-weight:750; margin:0 0 .42rem }
.metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.7rem; margin-bottom:1.35rem }
.metric { text-align:left; border:1px solid var(--line); background:white; color:var(--navy); padding:1rem; border-radius:14px; overflow-wrap:anywhere }
.metric:hover { border-color:var(--orange) }
.metric strong { display:block; font-size:clamp(1.15rem,2vw,1.8rem); letter-spacing:-.06em; font-variant-numeric:tabular-nums }
.metric span { display:block; color:var(--muted); font-size:.89rem; font-weight:660 }
.metric:last-child { background:var(--peach); border-color:#f8d7bc }
.panel { background:white; border:1px solid var(--line); border-radius:16px; padding:1.1rem; margin-bottom:.9rem; min-width:0 }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:.7rem; margin-bottom:.8rem; flex-wrap:wrap }
.panel p+p { margin-top:.4rem }
.panel h2 { margin-bottom:.35rem }
.table-wrap { width:100%; overflow-x:auto; background:white; border:1px solid var(--line); border-radius:14px }
table { width:100%; border-collapse:collapse; text-align:left }
th { font-size:.87rem; color:var(--muted); font-weight:750; background:#edf2f8 }
th,td { padding:.68rem .85rem; border-bottom:1px solid var(--line); vertical-align:middle }
tbody tr:last-child td { border-bottom:0 }
tbody tr:hover { background:#f8fafc }
td.amount { white-space:nowrap; font-variant-numeric:tabular-nums }
.empty { padding:1.1rem; color:var(--muted) }
.pill { display:inline-block; font-weight:750; padding:.23rem .57rem; border-radius:20px; font-size:.82rem; white-space:nowrap; color:var(--navy2); background:#e9eff9 }
.pill.warm { color:var(--amber); background:var(--peach) }
.pill.done { color:var(--green); background:#e7f5ed }
.pill.cancelled { color:var(--red); background:#ffebec }
.filters { display:flex; flex-wrap:wrap; gap:.7rem; align-items:end; margin-bottom:1rem }
.filters label { min-width:120px; flex:1 1 130px; margin:0 }
.filters label:first-child { flex-grow:1.65 }
label { display:grid; gap:.32rem; margin-bottom:.78rem; font-size:.92rem; font-weight:700 }
input,textarea,select {
  width:100%; min-height:43px; border:1px solid #c7d3e4; border-radius:10px; padding:.55rem .65rem;
  background:white; color:var(--navy); font-weight:400; min-width:0;
}
select { padding-right:1.4rem }
input[type=checkbox] { width:18px; min-height:18px; accent-color:var(--navy2) }
label.checkbox { display:flex; align-items:center; gap:.55rem }
textarea { resize:vertical; min-height:84px }
.notice,.form-message { padding:.7rem .85rem; border-radius:10px; background:#e7f5ed; color:var(--green); margin-bottom:1rem; overflow-wrap:anywhere }
.notice.error,.form-message { background:#ffebec; color:var(--red) }
.form-message:empty { display:none }
.grid2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem }
.action-row { display:flex; flex-wrap:wrap; align-items:center; gap:.55rem; margin-top:.65rem }
.stack > *+* { margin-top:.5rem }
.data-list { display:grid; gap:.5rem; margin:.65rem 0; padding:0 }
.data-list div { display:grid; grid-template-columns:7rem minmax(0,1fr); gap:.6rem }
.data-list dt { color:var(--muted); font-size:.9rem }
.data-list dd { margin:0; overflow-wrap:anywhere }
.rule-list { list-style:none; padding:0; margin:.5rem 0 }
.rule-list li { padding:.55rem 0; border-bottom:1px solid var(--line) }
.rule-list li:last-child { border:0 }
.inline-spread { display:flex; justify-content:space-between; flex-wrap:wrap; align-items:center; gap:.55rem }
dialog { width:min(42rem,calc(100% - 1.25rem)); max-height:calc(100% - 1.25rem); border:1px solid var(--line); border-radius:18px; color:var(--navy); padding:0; box-shadow:0 24px 65px #0b182835 }
dialog::backdrop { background:#0a1729aa }
.dialog-head { display:flex; justify-content:space-between; align-items:center; gap:.7rem; padding:1rem 1.2rem; background:#f2f6fb; border-bottom:1px solid var(--line) }
#dialog-body { padding:1.2rem }
.estimate-row { display:grid; grid-template-columns:1.2fr 1.5fr 1fr; gap:.55rem; margin-bottom:.45rem }
.balance { font-size:1.28rem; font-weight:800; color:var(--amber) }
@media(max-width:1100px) { .metrics { grid-template-columns:repeat(3,minmax(0,1fr)) } }
@media(max-width:780px) {
  .workspace { display:block } .sidebar { height:auto; position:static; padding:.75rem; flex-direction:row; align-items:center; flex-wrap:wrap; gap:.55rem }
  .brand { margin:0; flex:1 } .brand img { width:36px;height:36px }
  #nav { display:flex; width:100%; order:3; overflow:auto; gap:.3rem }
  #nav button,.sign-out { width:auto; white-space:nowrap; font-size:.9rem }
  .sign-out { margin:0 }
  .topbar { min-height:57px;margin-bottom:1.15rem }
}
@media(max-width:540px) {
  .gate { grid-template-columns:1fr;margin:1rem auto } .gate-brand { gap:1rem }
  .gate-brand img { width:52px;height:52px } .grid2 { grid-template-columns:1fr }
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)) }
  .metric:last-child { grid-column:1/-1 }
  .estimate-row { grid-template-columns:1fr 1fr }.estimate-row label:nth-child(2) { grid-column:1/-1;grid-row:2 }
}
