@font-face { font-family: 'Space Grotesk'; src: url('/fonts/space-grotesk.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/ibm-plex-mono.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/ibm-plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --navy: #191B34; --navy-2: #1F2240; --navy-3: #272B4F; --navy-4: #33385F;
  --line: rgba(255,255,255,.09); --line-2: rgba(255,255,255,.16);
  --text: #F2F3F8; --text-2: #B7BACF; --text-3: #8A8EA8;
  --orange: #E85D1F; --orange-2: #BF4A11; --orange-soft: rgba(232,93,31,.14);
  --green: #22C988; --green-soft: rgba(34,201,136,.13);
  --amber: #E8B23C; --amber-soft: rgba(232,178,60,.13);
  --red: #F0705F; --red-soft: rgba(240,112,95,.13);
  --r: .75rem; --r-s: .5rem;
  --gut: clamp(1rem, .6rem + 1.8vw, 2rem);
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: clamp(15px, 14px + .25vw, 17px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--navy); color: var(--text); font: 400 1rem/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
a { color: var(--orange); text-underline-offset: .15em; }
svg.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mut { color: var(--text-2); } .dim { color: var(--text-3); font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* One focus ring, one border, everywhere. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: var(--r-s); }
input:focus-visible, textarea:focus-visible { outline: none; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--navy-2); border-right: 1px solid var(--line); padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .5rem; }
.brand img { height: 2.1rem; width: auto; display: block; background: #fff; border-radius: var(--r-s); padding: .35rem .55rem; }
.brand span { font: 500 .7rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--r-s); color: var(--text-2); text-decoration: none; font-size: .94rem; transition: background .15s, color .15s; }
.nav a:hover { background: var(--navy-3); color: var(--text); }
.nav a.on { background: var(--orange-soft); color: var(--text); }
.nav a.on svg { color: var(--orange); }
.side-foot { margin-top: auto; font-size: .78rem; color: var(--text-3); padding: .5rem .7rem; }
.side-foot b { display: block; font-weight: 500; color: var(--text-2); }
.main { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: .75rem; padding: .9rem var(--gut); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(25,27,52,.92); backdrop-filter: blur(8px); z-index: 20; }
.top .ttl { font: 600 1.15rem var(--display); }
.top .upd { margin-left: auto; font-size: .8rem; color: var(--text-3); white-space: nowrap; }
.top .menu-btn { display: none; }
.content { padding: clamp(1rem, .7rem + 1.5vw, 1.75rem) var(--gut) 2.5rem; flex: 1; display: flex; flex-direction: column; gap: 1.25rem; max-width: 80rem; width: 100%; }
.foot { padding: 1rem var(--gut) 1.5rem; font-size: .78rem; color: var(--text-3); border-top: 1px solid var(--line); }
.scrim { display: none; }

/* ---- cards and stats ---- */
.card { background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(.9rem, .7rem + .6vw, 1.25rem); }
.card > h2 { font-size: 1rem; margin-bottom: .85rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .9rem; }
.stat { display: flex; flex-direction: column; gap: .35rem; position: relative; overflow: hidden; }
.stat .lbl { font-size: .84rem; color: var(--text-2); display: flex; align-items: center; gap: .45rem; }
.stat .val { font: 600 clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem)/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat.hot .val { color: var(--orange); } .stat.good .val { color: var(--green); }
.two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: var(--r-s); font-size: .9rem; background: var(--amber-soft); color: var(--text); }
.notice svg { color: var(--amber); margin-top: .15em; }
.notice.ok { background: var(--green-soft); } .notice.ok svg { color: var(--green); }
.notice.hot { background: var(--orange-soft); justify-content: space-between; align-items: center; flex-wrap: wrap; } .notice.hot svg { color: var(--orange); margin-top: 0; }
.notice .row { display: flex; gap: .6rem; align-items: center; }

/* ---- bars ---- */
.bar-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 2rem; gap: .6rem; align-items: center; font-size: .88rem; padding: .22rem 0; }
.bar-row .track, .prog .track { height: .5rem; background: var(--navy-4); border-radius: 9rem; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--orange); border-radius: 9rem; }
.prog { display: flex; align-items: center; gap: .6rem; min-width: 7rem; }
.prog .track { flex: 1; }
.prog .fill { height: 100%; border-radius: 9rem; background-image: linear-gradient(90deg, var(--orange), var(--orange-2) 35%, #C89A2E 70%, var(--green)); background-repeat: no-repeat; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.prog .pc { font: 500 .8rem var(--mono); color: var(--text-2); min-width: 2.6rem; text-align: right; }

/* ---- activity ---- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); font-size: .9rem; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed svg { color: var(--text-3); margin-top: .2em; }
.feed time { display: block; font-size: .78rem; color: var(--text-3); }

/* ---- tables: rows on desktop, cards on a phone ---- */
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-weight: 500; font-size: .78rem; color: var(--text-3); padding: 0 .75rem .55rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t th:first-child, table.t td:first-child { padding-left: 0; }
table.t th:last-child, table.t td:last-child { padding-right: 0; }
table.t .r { text-align: right; }
.fac b { font-weight: 500; display: block; } .fac span { font-size: .8rem; color: var(--text-3); }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 9rem; font-size: .78rem; background: var(--navy-4); color: var(--text-2); white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: #FF8A52; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--text-3); font-size: .92rem; }
.empty svg { width: 1.8rem; height: 1.8rem; display: block; margin: 0 auto .5rem; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: 500 .9rem var(--body); padding: .55rem .95rem; border-radius: var(--r-s); border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap; min-height: 2.5rem; }
.btn:hover { background: var(--navy-3); }
.btn.pri { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.pri:hover { background: var(--orange-2); border-color: var(--orange-2); }
.btn.sm { padding: .3rem .7rem; min-height: 2rem; font-size: .84rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > label, .field > .flabel { font-size: .84rem; color: var(--text-2); }
.in { font: 400 .95rem var(--body); color: var(--text); background: var(--navy); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: .55rem .7rem; width: 100%; min-height: 2.5rem; }
.in:focus { border-color: var(--orange); }
textarea.in { min-height: 5rem; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .85rem; }
.form-grid .full { grid-column: 1 / -1; }
.acts { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1rem; }
.bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.bar .grow { flex: 1; min-width: min(100%, 12rem); }
[data-list] { margin-top: 1rem; }
td[data-label="Paid on"], td[data-label="Date"], td[data-label="Target"], td[data-label="Completed"], td[data-label="Signed"], td[data-label="Added"] { white-space: nowrap; }
.err { color: var(--red); font-size: .88rem; min-height: 1.2em; }

/* custom dropdown */
.dd { position: relative; min-width: 11rem; }
.dd-btn { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; font: 400 .92rem var(--body); color: var(--text); background: var(--navy); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: .5rem .7rem; min-height: 2.5rem; cursor: pointer; text-align: left; }
.dd-btn:focus-visible { outline: none; border-color: var(--orange); }
.dd.open .dd-btn { border-color: var(--orange); }
.dd-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + .3rem); background: var(--navy-3); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: .25rem; display: none; max-height: 16rem; overflow-y: auto; box-shadow: 0 .75rem 2rem rgba(0,0,0,.35); }
.dd.open .dd-list { display: block; }
.dd-opt { padding: .45rem .6rem; border-radius: .35rem; font-size: .9rem; cursor: pointer; color: var(--text-2); }
.dd-opt:hover, .dd-opt.act { background: var(--navy-4); color: var(--text); }
.dd-opt[aria-selected="true"] { color: var(--orange); }

/* dialogs */
.dlg-w { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(10,11,25,.65); overflow-y: auto; }
.dlg { background: var(--navy-2); border: 1px solid var(--line-2); border-radius: var(--r); width: min(36rem, 100%); padding: clamp(1rem, .8rem + .8vw, 1.5rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.dlg h2 { font-size: 1.15rem; margin-bottom: .35rem; }
.dlg p { margin: 0 0 .9rem; color: var(--text-2); font-size: .92rem; }
.toast { position: fixed; bottom: 1.25rem; left: 50%; translate: -50% 0; z-index: 80; background: var(--navy-4); border: 1px solid var(--line-2); padding: .55rem 1rem; border-radius: var(--r-s); font-size: .9rem; max-width: calc(100vw - 2rem); }

/* ---- sign in ---- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.25rem; gap: 1rem; background: radial-gradient(60rem 30rem at 50% -10%, rgba(232,93,31,.14), transparent 70%), var(--navy); }
.auth-card { width: min(26rem, 100%); background: var(--navy-2); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1.25rem, 1rem + 1.2vw, 2rem); display: flex; flex-direction: column; gap: .9rem; }
.auth-card img.logo { height: 2.75rem; width: auto; align-self: flex-start; background: #fff; border-radius: var(--r-s); padding: .4rem .65rem; }
.auth-card h1 { font-size: 1.45rem; }
.auth-card p { margin: 0; color: var(--text-2); font-size: .92rem; }
.link { background: none; border: 0; color: var(--text-2); font: 400 .86rem var(--body); cursor: pointer; padding: .2rem; text-decoration: underline; text-underline-offset: .2em; }
.link:hover { color: var(--text); }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--text-2); }
.check input { accent-color: var(--orange); width: 1.05rem; height: 1.05rem; }
.footline { font-size: .78rem; color: var(--text-3); }

@media (max-width: 62rem) { .two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 52rem) {
  .shell { display: block; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: min(17rem, 82vw); translate: -100% 0; transition: translate .2s ease; }
  .shell.nav-open .side { translate: 0 0; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(10,11,25,.55); }
  .top .menu-btn { display: inline-flex; padding: .35rem; min-height: 2.25rem; border: 0; }
  .top .upd { font-size: .72rem; white-space: normal; text-align: right; max-width: 45%; }
}
/* Tables collapse into labelled cards. */
@media (max-width: 44rem) {
  table.t, table.t tbody, table.t tr, table.t td { display: block; width: 100%; }
  table.t thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.t tr { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  table.t tr:last-child { border-bottom: 0; }
  table.t td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .2rem 0; border: 0; text-align: right; }
  table.t td::before { content: attr(data-label); color: var(--text-3); font-size: .8rem; text-align: left; flex: none; }
  table.t td:first-child { display: block; text-align: left; padding-bottom: .35rem; }
  table.t td:first-child::before { content: none; }
  table.t td.r { text-align: right; }
  table.t td:empty { display: none; }
  .prog { flex: 1; max-width: 62%; }
  .bar .dd { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
