/* indiledger's web console ("Console", design/web-ui/README.md). Every
   colour is a token, redefined per theme; the theme is a class on <html>
   (theme.js). Token values are console.html's. */

@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }

:root.theme-dark {
  --bg: #0E1116; --panel: #161B22; --raised: #1B212A;
  --line: #1F2630; --line2: #2A313C; --line3: #3A4250;
  --text: #E6EDF3; --strong: #FFFFFF; --muted: #9AA4B2; --soft: #C9D1D9;
  --accent: #4D8FFF; --accent-ink: #061226; --accent-text: #4D8FFF;
  --mark: #4D8FFF; --badge: #17142B; --brand-ink: #FFFFFF;
  --sel-bg: #241F45; --sel-line: #3D3772;
  --run: #3FB950; --run-text: #3FB950; --run-ink: #04260F; --run-bg: #0F1A14; --run-line: #1E3A2A;
  --warn: #E3B341; --warn-bg: #2A2410; --danger: #F47067; --pos: #3FB950; --nav-on: #1F2630;
  color-scheme: dark;
}
:root.theme-light {
  --bg: #FFFFFF; --panel: #F6F8FA; --raised: #FFFFFF;
  --line: #E7EAEE; --line2: #D5DAE0; --line3: #B8C0CA;
  --text: #1F2328; --strong: #0B0D10; --muted: #59636E; --soft: #3D444D;
  --accent: #241F45; --accent-ink: #FFFFFF; --accent-text: #241F45;
  --mark: #4D8FFF; --badge: #241F45; --brand-ink: #241F45;
  --sel-bg: #EDEBF5; --sel-line: #C8C3E0;
  --run: #1A7F37; --run-text: #1A7F37; --run-ink: #FFFFFF; --run-bg: #EFF8F1; --run-line: #C7E6CF;
  --warn: #7A5000; --warn-bg: #FFF4D6; --danger: #C2261F; --pos: #1A7F37; --nav-on: #EEF1F4;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent-text); }
button, input { font: inherit; }
button { cursor: pointer; }
code { font-family: inherit; color: var(--soft); }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.strong { color: var(--strong); }
.small { font-size: 13px; }
.num { text-align: right; }
.tnum { font-variant-numeric: tabular-nums; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.od { color: var(--danger); }
.pos { color: var(--pos); }
.warn-text { color: var(--warn); }

.key {
  display: inline-block; min-width: 18px; padding: 1px 6px; border: 1px solid var(--line3); border-bottom-width: 2px;
  border-radius: 4px; font-size: 12px; color: var(--soft); text-align: center; background: var(--raised); line-height: 1.4;
}
.key-on {
  display: inline-block; min-width: 18px; padding: 1px 6px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 4px; font-size: 12px; text-align: center; background: color-mix(in srgb, currentColor 14%, transparent); line-height: 1.4;
}

.btn, .btn-pri, .btn-run, .btn-danger {
  border-radius: 6px; padding: 8px 12px; font-size: 13px; min-height: 40px;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none;
}
.btn { background: var(--raised); color: var(--text); border: 1px solid var(--line3); }
.btn-pri { background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 600; padding: 8px 14px; }
.btn-run { background: var(--run); color: var(--run-ink); border: 0; font-weight: 600; padding: 10px 16px; min-height: 44px; }
.btn-danger { background: var(--danger); color: var(--bg); border: 0; font-weight: 600; }
.btn-tall { min-height: 44px; padding: 10px 14px; }
.btn-small { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.btn-quiet { background: transparent; color: var(--muted); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 10px; font-size: 13px; min-height: 36px; }

/* Header */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.top-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.badge { fill: var(--badge); }
.wordmark { font-weight: 600; font-size: 16px; }
.wm-indi { color: var(--brand-ink); }
.wm-ledger { color: #4D8FFF; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.navl { text-decoration: none; color: var(--soft); padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.navl.on { color: var(--strong); background: var(--nav-on); }
.count { color: var(--warn); }
.theme-toggle { width: 40px; height: 36px; border-radius: 6px; border: 1px solid var(--line2); background: transparent; color: var(--soft); display: grid; place-items: center; margin-left: 4px; }
.theme-dark .icon-moon, .theme-light .icon-sun { display: none; }
.icon-sun, .icon-moon { display: grid; }

/* Timer bar */
.timer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.timer.running { background: var(--run-bg); border-bottom-color: var(--run-line); }
.timer.stopped { justify-content: space-between; }
.run-label { display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--run); box-shadow: 0 0 0 4px color-mix(in srgb, var(--run) 22%, transparent); }
.run-word { color: var(--run-text); font-weight: 600; font-size: 13px; letter-spacing: .08em; }
.clock { font-size: 32px; font-weight: 500; color: var(--strong); }
.timer-work { flex: 1 1 320px; min-width: 0; }
.timer-work .work { font-size: 15px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* What the last action did */
.say { margin: 0; padding: 10px 24px; font-size: 13px; border-bottom: 1px solid var(--line); color: var(--text); }
.say-fail { color: var(--danger); }

/* Body: the entries, and money at a glance beside them (stacking below ~1000px) */
.body { display: flex; flex-wrap: wrap; flex: 1; }
.main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.rangebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.range-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arrow { background: transparent; border: 1px solid var(--line2); color: var(--soft); border-radius: 6px; width: 44px; height: 36px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; background: var(--panel); border-radius: 6px; padding: 3px; }
.tab { background: transparent; color: var(--muted); border: 0; border-radius: 4px; padding: 6px 10px; font-size: 13px; }
.tab.on { background: var(--line2); color: var(--strong); }
.range-sum .text { color: var(--text); }

.table-wrap { overflow-x: auto; }
.table { min-width: 900px; }
.row {
  display: grid; grid-template-columns: 32px 84px 96px 120px minmax(0, 2.2fr) minmax(0, 2fr) 64px 112px;
  gap: 12px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.row-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom-color: var(--line2); }
.row.sel { background: var(--sel-bg); }
.row.cur { box-shadow: inset 3px 0 0 var(--mark); }
.chk { width: 16px; height: 16px; accent-color: var(--mark); margin: 0; }
.empty { padding: 16px; margin: 0; }
.tag { font-size: 12px; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.t-run { color: var(--run-text); background: var(--run-bg); }
.t-open { color: var(--muted); border: 1px dashed var(--line3); }
.t-draft { color: var(--warn); background: var(--warn-bg); }
.t-inv { color: var(--accent-text); background: var(--sel-bg); }
.t-nb { color: var(--muted); background: var(--panel); }

.h1 { margin: 0; font-size: 15px; font-weight: 600; color: var(--strong); }
.main-full { border-right: 0; }
.accent { color: var(--accent-text); }
.row-inv { grid-template-columns: 140px minmax(0, 1.6fr) 200px 130px minmax(0, 1fr) 120px; }
.row-inv .num, .row-bank .num { white-space: nowrap; }
.row-bank { grid-template-columns: 32px 96px minmax(0, 1fr) 130px minmax(0, 2fr) minmax(0, 2fr); }
.about { margin: 0; padding: 10px 16px; min-height: 2.6em; }

.selbar {
  margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--sel-bg); border-top: 1px solid var(--sel-line); font-size: 13px;
}
.selactions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Money at a glance */
.panel { flex: 1 1 340px; min-width: 0; padding: 16px 20px; display: flex; flex-direction: column; gap: 22px; }
.panel section > p { margin: 0; }
.h2 { margin: 0 0 10px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.h2 .key { text-transform: none; letter-spacing: normal; }
.inv { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.inv-no { color: var(--accent-text); }
.due { display: block; font-size: 12px; }
.total { display: flex; justify-content: space-between; padding-top: 10px; font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.card-top { display: flex; justify-content: space-between; gap: 8px; }
.card-top .tnum { flex-shrink: 0; white-space: nowrap; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.card-actions .btn-quiet { display: inline-flex; align-items: center; text-decoration: none; }
.unbilled { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 14px; font-size: 13px; }
.span3 { grid-column: 1 / -1; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 24px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* Starting a timer */
dialog { background: var(--bg); color: var(--text); border: 1px solid var(--line3); border-radius: 8px; padding: 0; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: color-mix(in srgb, #000 55%, transparent); }
.picker { display: flex; flex-direction: column; gap: 12px; padding: 20px 20px 0; }
.pick-title { margin: 0; font-size: 15px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input { background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 10px 12px; color: var(--text); font-size: 14px; min-height: 40px; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.pick-opt { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; min-height: 40px; }
.pick-opt.hl { background: var(--sel-bg); box-shadow: inset 3px 0 0 var(--mark); }
.pick-none { margin: 0; }
.pick-actions { display: flex; gap: 8px; }
.picker .legend { margin: 0 -20px; }
.pay-form { display: flex; flex-direction: column; gap: 12px; }
.methods { border: 1px solid var(--line2); border-radius: 6px; margin: 0; padding: 8px 12px 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.field-label { font-size: 12px; color: var(--muted); padding: 0 4px; }
.method { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 13px; }
.method input { accent-color: var(--mark); margin: 0; }
.field textarea { background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 10px 12px; color: var(--text); font: inherit; font-size: 13px; resize: vertical; }
.row-line { grid-template-columns: 110px minmax(0, 1fr) 70px 90px 110px; }
.row-pay { grid-template-columns: minmax(0, 1fr); }
.row-imp { grid-template-columns: 150px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr); }
.field select { background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 10px 12px; color: var(--text); font: inherit; font-size: 14px; min-height: 40px; }
.field input[type=file] { padding: 8px 10px; font-size: 13px; }
/* A file dragged over the bank screen. */
.dropping #screen[data-screen=bank] { outline: 2px dashed var(--mark); outline-offset: -8px; }
.dropping #screen[data-screen=bank]::after { content: "Drop to import"; position: fixed; inset: auto 0 50% 0; text-align: center; font-size: 18px; font-weight: 600; color: var(--strong); pointer-events: none; }
.detail { padding: 4px 16px 8px; font-size: 13px; }
.detail p { margin: 6px 0; }
.detail a { color: var(--accent-text); word-break: break-all; }
.detail-h { padding: 12px 16px 0; margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; }
.check input { accent-color: var(--mark); margin: 0; width: 16px; height: 16px; }

/* Setup: a section's table, and its forms (two columns in a wider dialog) */
.row-customers { grid-template-columns: minmax(0, 1.4fr) 80px 80px 110px 110px minmax(0, 1.6fr); }
.row-projects { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 140px; }
.row-tasks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 130px 80px; }
.row-vendors { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr); }
.row-business { grid-template-columns: 220px minmax(0, 1fr); }
.row-payment-options { grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1.6fr); }
.row-accounts { grid-template-columns: minmax(0, 1.2fr) 70px 80px 90px 110px 110px minmax(0, 2fr); }
.row-categories { grid-template-columns: minmax(0, 1fr) 120px; }
.row-providers { grid-template-columns: 90px 130px minmax(0, 1.2fr) 150px 70px 140px minmax(0, 1.4fr); }
.row-events { grid-template-columns: 140px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr); }
.form-grid .wide { grid-column: 1 / -1; }
dialog:has(.form-grid) { width: min(760px, calc(100vw - 32px)); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-height: 62vh; overflow-y: auto; padding: 2px; }

/* The command bar, a command's output, the help */
.bar { flex: 1 1 340px; max-width: 760px; min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 0 12px; min-height: 40px; }
.bar:focus-within { border-color: var(--mark); }
.bar input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font: inherit; font-size: 13px; padding: 8px 0; }
.bar input::placeholder { color: var(--muted); }
.bar-key { white-space: nowrap; cursor: text; }
.legend-btn { background: transparent; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
dialog:has(.out) { width: min(1000px, calc(100vw - 32px)); }
.out { margin: 0; max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; font: inherit; font-size: 13px; line-height: 1.5; white-space: pre; }
.keys { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; font-size: 13px; }
.keys div { display: flex; gap: 10px; align-items: baseline; }
.keys dt { min-width: 72px; }
.keys dd { margin: 0; }

/* Login, and screens the web doesn't have yet */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 24px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .say { padding: 0; border: 0; }
.login-form .btn-pri { justify-content: center; }
.notyet { padding: 32px 24px; max-width: 720px; }

@media (max-width: 600px) {
  .top, .timer, .say, .legend { padding-left: 16px; padding-right: 16px; }
  .field-row, .form-grid { grid-template-columns: 1fr; }
  .clock { font-size: 26px; }
}
