:root {
  --ground: #0B0F14; --panel: #121821; --rail: #070A0E; --line: #223041; --line-soft: #1A2430;
  --text: #E6EDF3; --muted: #93A4B5; --accent: #4FE3C1; --on-accent: #04201A; --warn: #FFB454;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 15px; line-height: 1.45;
  color: var(--text); background: var(--ground); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
h1 { margin: 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 32px; font-weight: 600; }
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.rail { flex: 1 1 220px; background: var(--rail); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.brand { font-family: "Space Grotesk", Inter, sans-serif; font-weight: 600; font-size: 20px; padding: 0 8px; }
.pills { display: flex; gap: 8px; padding: 0 8px; }
.pills form { flex: 1; display: flex; }
.pill { flex: 1; min-height: 44px; border-radius: 8px; border: 1px solid #2C3D51; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { min-height: 44px; padding: 0 12px; border-radius: 8px; display: flex; align-items: center;
  color: var(--text); text-decoration: none; font-weight: 500; }
.nav a[aria-current="page"] { background: #14302A; }
.rail-foot { margin-top: auto; padding: 0 8px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
main { flex: 999 1 560px; min-width: 0; padding: 32px; }
.page { max-width: 1100px; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.sub { margin: 4px 0 0; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 24px 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: left; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); font-size: 12px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line-soft); }
td.name { font-weight: 500; }
td.dim { color: var(--muted); }
.empty { color: var(--muted); padding: 16px 0; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 8px; border: 0;
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.quiet { background: transparent; color: var(--text); border: 1px solid #2C3D51; }
.form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px;
  display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form input[type=text], .form input[type=number], .form input[type=password], .form input[type=date], .form input[type=file], .form select {
  min-height: 44px; width: 100%; max-width: 360px; padding: 0 12px; border-radius: 8px; border: 1px solid #2C3D51;
  background: var(--ground); color: var(--text); font: inherit; }
.form .helptext { display: block; font-size: 13px; color: var(--muted); }
.errorlist { margin: 0 0 4px; padding: 0; list-style: none; color: var(--warn); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.form.wide { max-width: none; }
.form input[type=file] { padding: 9px 12px; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #33230A; color: var(--warn); }
.badge.ok { background: #0F2E27; color: var(--accent); }
.notice { border: 1px solid var(--warn); color: var(--warn); border-radius: 8px; padding: 12px 16px; }
.lines { display: flex; flex-direction: column; gap: 12px; }
.lines .row > div { flex: 1 1 140px; }
.lines .row > div.wide { flex: 3 1 260px; }
.lines .row > div.narrow { flex: 0 0 auto; padding-bottom: 12px; }
.lines input, .lines select { max-width: none !important; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow-y: auto; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground);
  color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: grab; }
.dropzone { border: 1px dashed var(--accent); border-radius: 12px; padding: 16px; min-height: 120px;
  display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.line .name { flex: 1 1 200px; font-weight: 500; }
.line .cost { color: var(--muted); }
.linebox { background: var(--ground); border: 1px solid var(--accent); border-radius: 8px; padding: 16px;
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.linebox .pending-name { font-weight: 600; min-width: 140px; padding-bottom: 12px; }
.linebox input, .linebox select { width: 120px !important; }
[hidden] { display: none !important; }
td input[type=number] { min-height: 44px; width: 110px; padding: 0 12px; border-radius: 8px; border: 1px solid #2C3D51;
  background: var(--ground); color: var(--text); font: inherit; }
td.minus { color: var(--warn); font-weight: 600; }
td.plus { color: var(--accent); font-weight: 600; }
.groups { display: flex; flex-wrap: wrap; gap: 8px; }
.groups .pill { flex: 0 0 auto; padding: 0 14px; }
/* No up/down arrows on number fields: amounts are typed. */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form textarea { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground);
  color: var(--text); font: inherit; resize: vertical; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px;
  display: flex; flex-direction: column; gap: 12px; }
.card .asked { font-weight: 500; white-space: pre-wrap; }
.card .said { color: var(--muted); white-space: pre-wrap; }
.card ul { margin: 0; padding-left: 20px; }
.card li { margin: 2px 0; }
.btn.danger { color: var(--warn); border-color: var(--warn); margin-left: auto; }

/* Phones: the menu becomes a compact bar with a sideways-scrolling row of links,
   so the page itself is visible without scrolling past the whole menu. */
@media (max-width: 760px) {
  .shell { display: block; min-height: 0; }
  .rail { padding: 12px; gap: 10px; }
  .brand { font-size: 17px; padding: 0 4px; }
  .pills { padding: 0; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .nav a { flex: 0 0 auto; white-space: nowrap; border: 1px solid #2C3D51; }
  .rail-foot { margin-top: 0; padding: 0 4px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  main { padding: 16px; }
  h1 { font-size: 26px; }
  .form, .panel, .card { padding-left: 16px; padding-right: 16px; }
}
.linecard { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.linecard .row > div { flex: 1 1 140px; }
.linecard .row > div.wide { flex: 3 1 260px; }
.linecard .row > div.narrow { flex: 0 0 auto; padding-bottom: 12px; }
.linecard input, .linecard select { max-width: none !important; }
.ask { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; border: 1px solid var(--warn); border-radius: 8px; padding: 10px 14px; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; min-height: 32px; }
details[open] summary { margin-bottom: 8px; }

dialog.popup { position: fixed; top: 30%; z-index: 10; max-width: 420px; background: var(--panel); color: var(--text); border: 1px solid var(--warn); border-radius: 12px; padding: 20px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
details.reveal > summary.btn { display: inline-flex; align-items: center; list-style: none; color: var(--on-accent); font-size: inherit; }
details.reveal > summary.btn::-webkit-details-marker { display: none; }
details.reveal[open] > summary.btn { display: none; }
.nav a[draggable] { cursor: default; }  /* the plain arrow, not a hand (Olivier) */
.nav-problem { color: var(--warn); font-size: 13px; padding: 4px 12px; }
input[type=search] { min-height: 44px; width: 100%; max-width: 360px; padding: 0 12px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; }
form[role=search] { margin-bottom: 12px; }
.big { font-size: 28px; font-weight: 600; margin: 0; }
.big .sub { font-size: 14px; font-weight: 400; }
.form input[type=email] { min-height: 44px; width: 100%; max-width: 360px; padding: 0 12px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; }
td input[type=text] { min-height: 44px; width: 110px; padding: 0 12px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; }
td select { min-height: 44px; padding: 0 8px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; }
tr.low td.name { color: var(--warn); }
/* Charts. Three series colours, checked for colour-blind separation and contrast on the panel. */
:root { --food: #3987e5; --beverage: #d95926; --nonfood: #199e70; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 6px 0 0; vertical-align: baseline; }
.swatch.food, .stack .food, .ranks .track i { background: var(--food); }
.swatch.beverage, .stack .beverage { background: var(--beverage); }
.swatch.nonfood, .stack .nonfood { background: var(--nonfood); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 16px 0; }
.tile { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.tile strong { font-size: 26px; font-weight: 600; }
.chart { margin-bottom: 16px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.legend { color: var(--muted); font-size: 13px; }
.legend .swatch { margin-left: 14px; }
.columns { position: relative; display: flex; align-items: stretch; gap: 2px; height: 260px; padding-top: 22px; border-top: 1px solid var(--line-soft); overflow-x: auto; }
.columns .top { position: absolute; top: 2px; left: 0; font-size: 12px; color: var(--muted); }
.column { position: relative; flex: 1 0 28px; display: flex; flex-direction: column; align-items: center; outline: none; }
.stack { flex: 1; width: 100%; max-width: 24px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
.stack i { display: block; min-height: 2px; }
.stack i:first-child { border-radius: 4px 4px 0 0; }
.tick { font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 6px; }
.tip { display: none; position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); z-index: 5; min-width: 150px; background: var(--ground); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.tip span, .tip strong { display: block; white-space: nowrap; }
.column:hover .tip, .column:focus .tip { display: block; }
.column:hover .stack, .column:focus .stack { background: rgba(255, 255, 255, .04); }
.column:first-child .tip, .column:nth-child(2) .tip, .column:nth-child(3) .tip { left: 0; transform: none; }
.column:last-child .tip { left: auto; right: 0; transform: none; }
.ranks { display: grid; gap: 10px; }
.rank { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 110px; align-items: center; gap: 12px; }
.rank .track { height: 16px; }
.rank .track i { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.rank .amount { text-align: right; font-variant-numeric: tabular-nums; }
.late { color: var(--warn); }
td input[type=date] { min-height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; }
td form.row { flex-wrap: nowrap; gap: 8px; align-items: center; }
.panel > strong { display: block; margin-bottom: 8px; }
/* Tiles: a list shown like the apps on a phone screen. */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 20px 12px; padding: 12px 0; }
.app, .app > a { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; text-decoration: none; color: var(--text); }
.app .icon { width: 68px; height: 68px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 4px; background: #14302A; border: 1px solid #1F4A40; color: var(--accent); transition: transform .12s; }
.app .icon svg { width: 38px; height: 38px; }
a.app:hover .icon, .app > a:hover .icon, a.app:focus-visible .icon, .app > a:focus-visible .icon { transform: scale(1.06); border-color: var(--accent); }
.app-name { font-weight: 600; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.app-sub { font-size: 12px; color: var(--muted); }
.app .btn { min-height: 32px; padding: 0 12px; font-size: 13px; margin-top: 4px; }
table.even { table-layout: fixed; width: 100%; }  /* same columns in every section */
.form input[type=month] { min-height: 44px; width: 100%; max-width: 360px; padding: 0 12px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; }
details.reveal { margin-bottom: 12px; }
.venue-pick { display: flex; flex-direction: column; gap: 6px; }
.venue-pick label { font-size: 12px; color: var(--muted); }
.venue-pick select { min-height: 44px; width: 100%; padding: 0 10px; border-radius: 8px; border: 1px solid #2C3D51; background: var(--ground); color: var(--text); font: inherit; font-weight: 600; }
.rail .pills { flex-wrap: wrap; }
.rail .pill { white-space: nowrap; }
.tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
