@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --ink: #12324a;        /* navy: headings, nav */
  --text: #243b4a;
  --muted: #6b7c8a;
  --rule: #d9e1e7;
  --ground: #f3f6f8;
  --paper: #ffffff;
  --pay: #1b7f5a;        /* payable / positive */
  --pay-soft: #e3f3ec;
  --flag: #b4690e;       /* needs attention */
  --flag-soft: #fbf0df;
  --bad: #b23a3a;
  --bad-soft: #f9e5e5;
  --link: #145a8c;
  --radius: 4px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; color: var(--text);
  background: var(--ground); font-variant-numeric: tabular-nums; line-height: 1.45;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; font-weight: 600; color: var(--ink); margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--ink); margin: 1.75rem 0 .5rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .4rem; }
p { margin: .35rem 0; }
.sub { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.rail { background: var(--ink); color: #dbe6ee; padding: 1.25rem 0; position: sticky; top: 0; height: 100vh; }
.rail .brand { color: #fff; font-weight: 600; font-size: 1.1rem; padding: 0 1.25rem .9rem; letter-spacing: .01em; }
.rail .brand span { display: block; font-weight: 400; font-size: .8rem; color: #9fb6c6; }
.rail a { display: block; padding: .5rem 1.25rem; color: #dbe6ee; }
.rail a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.rail a.active { background: rgba(255,255,255,.14); color: #fff; border-left: 3px solid #7cc7a3; padding-left: calc(1.25rem - 3px); }
.rail .group { margin-top: 1rem; padding: 0 1.25rem .3rem; font-size: .75rem; color: #9fb6c6; }
.rail .who { position: absolute; bottom: 1rem; padding: 0 1.25rem; font-size: .8rem; color: #9fb6c6; }
.rail .who a { display: inline; padding: 0; color: #fff; }
main { padding: 1.75rem 2.25rem 3rem; max-width: 1180px; }
.topbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { display: flex; gap: .25rem; overflow-x: auto; background: var(--ink); padding: .6rem .75rem; position: sticky; top: 0; z-index: 5; }
  .topbar .brand { color: #fff; font-weight: 600; padding: .35rem .5rem; white-space: nowrap; }
  .topbar a { color: #dbe6ee; padding: .35rem .6rem; border-radius: var(--radius); white-space: nowrap; font-size: .9rem; }
  .topbar a.active { background: rgba(255,255,255,.16); color: #fff; }
  main { padding: 1.1rem 1rem 3rem; }
}

/* ---------- content blocks ---------- */
.flash { padding: .7rem 1rem; border-left: 4px solid var(--pay); background: var(--pay-soft); margin-bottom: 1.25rem; }
.flash.warn { border-color: var(--flag); background: var(--flag-soft); }
.flash.bad { border-color: var(--bad); background: var(--bad-soft); }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.25rem; margin: .75rem 0 1rem; }
.stats { display: flex; flex-wrap: wrap; gap: 1.75rem; margin: 1rem 0 .5rem; }
.stats div b { display: block; font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.stats div span { color: var(--muted); font-size: .85rem; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; align-items: center; }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; background: var(--paper); font-size: .92rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; border-bottom: 2px solid var(--rule); white-space: nowrap; }
td.num, th.num { text-align: right; }
tr.needs td { background: #fffaf2; }
tr.muted td { color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.table-wrap table { border: 0; }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 500; }
.pill.ok { background: var(--pay-soft); color: var(--pay); }
.pill.warn { background: var(--flag-soft); color: var(--flag); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.grey { background: #e7edf1; color: var(--muted); }

/* ---------- forms ---------- */
form.stack label, .field label { display: block; font-size: .82rem; color: var(--muted); margin: .6rem 0 .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=file], select, textarea {
  font: inherit; padding: .45rem .55rem; border: 1px solid #b9c6d0; border-radius: var(--radius); background: #fff; width: 100%; max-width: 420px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9fd3bb; outline-offset: 1px; }
textarea { min-height: 80px; }
.inline-fields { display: flex; flex-wrap: wrap; gap: .75rem; }
.inline-fields > div { flex: 1 1 150px; }
button, .btn {
  font: inherit; font-weight: 500; padding: .5rem .95rem; border-radius: var(--radius); border: 1px solid var(--ink);
  background: var(--ink); color: #fff; cursor: pointer; display: inline-block; line-height: 1.2;
}
button:hover, .btn:hover { background: #0d2637; text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--ink); }
.btn.secondary:hover, button.secondary:hover { background: var(--ground); }
.btn.danger, button.danger { background: var(--bad); border-color: var(--bad); }
.btn.small, button.small { padding: .3rem .6rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.check { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.check input { width: auto; }

/* ---------- the week strip (the one memorable element) ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; margin: 1rem 0; }
.week .day { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .6rem .5rem; min-height: 96px; }
.week .day .d { font-size: .78rem; color: var(--muted); }
.week .day .n { font-size: 1.2rem; font-weight: 600; color: var(--ink); margin: .15rem 0; }
.week .day .bar { height: 6px; background: #e7edf1; border-radius: 3px; overflow: hidden; margin: .35rem 0 .3rem; }
.week .day .bar i { display: block; height: 100%; background: var(--pay); }
.week .day.off { background: var(--ground); }
.week .day.flagged { border-color: var(--flag); }
.week .day .t { font-size: .75rem; color: var(--muted); }
@media (max-width: 700px) { .week { grid-template-columns: repeat(4, 1fr); } }

/* ---------- misc ---------- */
.login { max-width: 380px; margin: 8vh auto; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.75rem 1.75rem 1.5rem; }
.login h1 { font-size: 1.3rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1.25rem; font-size: .92rem; }
.kv div:nth-child(odd) { color: var(--muted); }
details summary { cursor: pointer; color: var(--link); }
ul.plain { list-style: none; padding: 0; margin: .25rem 0; }
ul.plain li { padding: .25rem 0; border-bottom: 1px solid var(--rule); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) { .flash { animation: in .25s ease-out; } }
@keyframes in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
