:root {
  --bg: #eef0f3; --card: #fff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #1f3a5f; --green: #15803d; --amber: #b45309; --red: #b91c1c; --warnbg: #fef3c7;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; overflow-wrap: break-word; } /* never let the page scroll sideways */
button { font: inherit; }

header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  background: var(--brand); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
header small { display: block; opacity: .8; font-size: 13px; }
header .link { color: #fff; }
main { max-width: 720px; margin: 0 auto; padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { flex: 1; border: 0; background: none; padding: 8px 2px 10px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
nav button span { font-size: 21px; line-height: 1.1; }
nav button.on { color: var(--brand); font-weight: 700; }
nav button span { position: relative; }
.nb { position: absolute; top: -4px; left: 60%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font: 700 11px/18px system-ui, sans-serif; text-align: center; font-style: normal; }
.installcard { border: 2px solid var(--green); }
.installcard .steps { margin: 8px 0; padding-left: 22px; }
.installcard .steps li { margin-bottom: 6px; }
.installcard details summary { margin-top: 10px; }
.newcard { border: 2px solid #2563eb; }
.badge.new { background: #dbeafe; color: #1e40af; margin: 0 4px 0 0; text-transform: uppercase; font-size: 11px; }

h1 { color: var(--brand); text-align: center; }
h2 { margin: 2px 0 14px; font-size: 20px; }
h3 { margin: 0 0 8px; font-size: 16px; }
.card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.card.warn { background: var(--warnbg); }
.card p:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid #d1d5db; background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.btn.big { display: flex; width: 100%; padding: 18px; font-size: 19px; margin-top: 12px; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.red   { background: var(--red);   border-color: var(--red);   color: #fff; }
.btn:disabled { opacity: .35; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.98); }
.link { background: none; border: 0; color: var(--brand); text-decoration: underline; padding: 6px; cursor: pointer; font-size: 15px; }

label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 17px; color: var(--ink);
  padding: 12px; border: 1px solid #cbd0d8; border-radius: 10px; background: #fff; min-height: 48px; min-width: 0; }
input[type=date], input[type=time] { padding: 12px 8px; -webkit-appearance: none; appearance: none; }
textarea { min-height: 0; }
.field { margin-bottom: 12px; }
.flabel { font-size: 14px; font-weight: 600; color: #374151; display: flex; align-items: center; gap: 6px; }
.info { border: 0; background: none; color: var(--brand); font-size: 18px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.vathelp { background: #eff6ff; color: #1e3a8a; border-radius: 8px; padding: 8px 10px; margin: 6px 0 0; }
.seg { display: flex; margin-top: 4px; border: 1px solid #cbd0d8; border-radius: 10px; overflow: hidden; background: #fff; }
.seg label { position: relative; flex: 1; margin: 0; padding: 12px 0; text-align: center; font-size: 17px; font-weight: 700; color: #374151; cursor: pointer; }
.seg label + label { border-left: 1px solid #cbd0d8; }
.seg input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0;
  opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--brand); color: #fff; }
.seg label:has(input:focus-visible) { outline: 3px solid #93c5fd; outline-offset: -3px; }
.badge.vat21 { background: #f3f4f6; color: #374151; margin-left: 4px; }
.badge.vat9  { background: #ede9fe; color: #5b21b6; margin-left: 4px; }
tr.head th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px; border-bottom: 1px solid var(--line); }
th.n { text-align: right; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; cursor: pointer; }
label.check input { width: 24px; height: 24px; min-height: 0; margin: 0; flex: none; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }

.current .label { font-size: 13px; font-weight: 800; letter-spacing: .06em; color: var(--green); }
.current.lunch .label { color: var(--amber); }
.current .cust { font-size: 23px; font-weight: 700; margin: 4px 0 2px; }
details summary { cursor: pointer; color: var(--brand); margin-top: 16px; font-weight: 600; }
details label { margin-top: 10px; }

.entry { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); }
.entry.tap { cursor: pointer; }
.entry.tap:active { background: #f9fafb; }
.entry .row1 { display: flex; justify-content: space-between; gap: 8px; }
.entry .row2 { font-size: 14px; color: var(--muted); margin-top: 2px; }
.entry .notes { font-size: 14px; margin-top: 4px; font-style: italic; }
.hrs { font-weight: 700; white-space: nowrap; }
.daytitle { display: flex; justify-content: space-between; margin: 18px 4px 6px; font-size: 15px; color: #374151; font-weight: 600; }
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; text-align: center; }
.weeknav .btn { font-size: 22px; padding: 6px 16px; }
.weeknav small { display: block; color: var(--muted); }
.total { display: flex; justify-content: space-between; font-size: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.main td { font-weight: 700; }
tr.sub td { color: var(--muted); font-size: 14px; }
tr.sub td:first-child { padding-left: 18px; }
tr.grand td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--ink); }

.row-btns { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.row-form { display: flex; gap: 8px; align-items: stretch; }
.row-form input { margin: 0; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #e5e7eb; margin-left: 6px; }
.badge.no { background: #fee2e2; color: #991b1b; }
.badge.warnb { background: #fef3c7; color: #92400e; margin: 0; }

.demo { background: #fde68a; color: #78350f; font-size: 13px; font-weight: 600; text-align: center; padding: 5px; }
.login { max-width: 440px; margin: 0 auto; padding: 32px 18px; }

#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; transition: .2s; pointer-events: none;
  background: #111827; color: #fff; padding: 12px 18px; border-radius: 14px; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }
body.busy main { opacity: .6; pointer-events: none; }
