:root {
  --ink: #1B1F1D;
  --ink-2: #5B615E;
  --line: #DDE0DB;
  --bg: #F3F4F1;
  --card: #FFFFFF;
  --night: #111316;
  --blue: #159FF2;       /* brand blue: logo, accents on dark */
  --blue-ink: #0A6BB3;   /* readable blue for text/buttons on white */
  --blue-ink-2: #084E82;
  --blue-wash: #E1F1FD;
  --warn: #8A4A00;
  --warn-wash: #FFF4E5;
  --warn-line: #F0C98A;
  --bad: #A3261B;
  --bad-wash: #FDECEA;
  --radius: 14px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.4; }
a { color: var(--blue-ink); }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.splash { min-height: 100vh; display: grid; place-items: center; }

/* Layout */
.shell { min-height: 100vh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; background: var(--bg); }
.shell.wide { max-width: 1200px; }
.top { background: var(--night); color: #fff; padding: calc(16px + env(safe-area-inset-top)) 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { height: 26px; }
.hello { font-size: 15px; font-weight: 500; }
.big-number { font-family: var(--mono); font-size: 32px; font-weight: 500; }
.muted-on-dark { font-size: 13px; color: #C9CDD2; }
.main { padding: 20px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 0; }

/* Buttons */
.btn { min-height: 48px; border-radius: 12px; border: 1px solid #C9CDC7; background: var(--card); color: var(--ink); font-weight: 600; padding: 0 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-ink-2); }
.btn-dark { background: var(--night); border-color: var(--night); color: #fff; min-height: 64px; font-size: 18px; border-radius: var(--radius); width: 100%; }
.btn-small { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn-link { background: none; border: 0; color: var(--blue-ink); font-weight: 600; cursor: pointer; padding: 10px 4px; min-height: 44px; }
.btn-ghost-light { background: transparent; border: 1px solid #3A3F44; color: #fff; min-height: 40px; font-size: 14px; }

/* Cards & lists */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.warn-card { background: var(--warn-wash); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.warn-card h2 { margin: 0; font-size: 15px; color: var(--warn); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--ink-2); }
.amount { font-family: var(--mono); white-space: nowrap; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border-radius: 12px; padding: 12px 14px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: var(--blue-wash); color: var(--blue-ink-2); white-space: nowrap; }
.chip.warn { background: #FFF0DB; color: #7A4100; }
.chip.bad { background: var(--bad-wash); color: var(--bad); }
.empty { color: var(--ink-2); font-size: 14px; text-align: center; padding: 20px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--ink-2); }
.input, select.input, textarea.input { min-height: 48px; border: 1px solid #C9CDC7; border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--ink); width: 100%; }
.input:focus, .btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money { font-family: var(--mono); }
.error { background: var(--bad-wash); color: var(--bad); border-radius: 10px; padding: 12px; font-size: 14px; }
.notice { background: var(--blue-wash); color: var(--blue-ink-2); border-radius: 10px; padding: 12px; font-size: 14px; }

/* Receipt capture */
.drop { border: 2px dashed #B9BFC4; border-radius: var(--radius); background: #fff; padding: 22px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.preview { max-height: 320px; border-radius: 10px; object-fit: contain; background: #eef0ed; width: 100%; }
.pdf-badge { background: var(--night); color: #fff; padding: 22px; border-radius: 10px; width: 100%; text-align: center; font-weight: 600; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--night); }
.login-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; color: #fff; }
.login-box .slogan { color: #C9CDD2; font-size: 15px; margin: 0; }
.login-box .card { color: var(--ink); display: flex; flex-direction: column; gap: 14px; }

/* Bottom nav */
.nav { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); }
.nav button { background: none; border: 0; padding: 14px 10px; min-height: 52px; font-size: 13px; color: var(--ink-2); cursor: pointer; flex: 1; }
.nav button[aria-current="page"] { color: var(--blue-ink); font-weight: 700; }

/* Staff table */
.table-wrap { background: #fff; border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding: 12px 14px; font-weight: 600; }
td { padding: 12px 14px; border-top: 1px solid #ECEEEA; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-family: var(--mono); font-size: 26px; }
.stat .l { font-size: 13px; color: var(--ink-2); }

.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--blue-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Office view: let the dark header run edge to edge on wide screens */
.shell.wide .top { box-shadow: 0 0 0 100vmax var(--night); clip-path: inset(0 -100vmax); }

/* Office tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: transparent; border: 0; color: #C9CDD2; font: inherit; font-weight: 600; padding: 10px 14px; min-height: 44px; border-radius: 10px; cursor: pointer; }
.tab:hover { color: #fff; background: #1E2226; }
.tab[aria-current="page"] { color: #fff; background: #23282D; box-shadow: inset 0 -3px 0 var(--blue); }

/* Compact inputs inside tables */
.input-sm { min-height: 40px; padding: 6px 8px; font-size: 14px; width: auto; max-width: 220px; }
select.input-sm { min-width: 150px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.hint { font-size: 13px; color: var(--ink-2); font-weight: 400; }
.chip .x { background: none; border: 0; color: inherit; cursor: pointer; font-weight: 700; padding: 0 0 0 4px; }
.btn-small { min-height: 40px; }

/* Toast messages */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); }
