:root {
  --blue: #1f4e8c;
  --blue-l: #e8eef7;
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1b2430;
  --muted: #6b7685;
  --green: #1d7a46;
  --green-l: #e3f4ea;
  --red: #b42318;
  --red-l: #fde8e6;
  --amber: #a15c00;
  --amber-l: #fff2d9;
  --line: #dde3ea;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
header#top {
  background: var(--blue);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}
header#top .title { font-weight: 700; font-size: 18px; flex: 1; }
header#top .who { font-size: 14px; opacity: .9; }
header#top button { background: rgba(255,255,255,.15); color: #fff; border: 0; padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.pill { font-size: 13px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.18); white-space: nowrap; }
.pill.off { background: #f5b041; color: #3b2600; }
.pill.wait { background: #fff; color: var(--blue); }
nav#tabs { display: flex; gap: 6px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 52px; z-index: 4; }
nav#tabs:empty { display: none; }
nav#tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font-size: 15px; color: var(--muted); white-space: nowrap; }
nav#tabs button.on { background: var(--blue-l); color: var(--blue); font-weight: 600; }
main { max-width: 760px; margin: 0 auto; padding: 14px 12px 80px; }
h2 { font-size: 20px; margin: 6px 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
select, input[type=text], input[type=password], input[type=url], input[type=number], textarea {
  width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
textarea { min-height: 60px; }
button { font: inherit; cursor: pointer; }
.btn { display: block; width: 100%; border: 0; border-radius: 10px; padding: 14px; font-size: 17px; font-weight: 600; background: var(--blue); color: #fff; margin-top: 14px; }
.btn.sec { background: var(--blue-l); color: var(--blue); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn:disabled { opacity: .5; }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }
.qty { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.qty:last-child { border-bottom: 0; }
.qty .name { flex: 1; }
.qty .name small { display: block; color: var(--muted); }
.qty .ctl { display: flex; align-items: center; gap: 6px; }
.qty .ctl button { width: 46px; height: 46px; border-radius: 10px; border: 0; background: var(--blue-l); color: var(--blue); font-size: 24px; font-weight: 700; }
.qty .ctl input { width: 64px; text-align: center; padding: 10px 4px; font-size: 18px; font-weight: 600; }
.qty .now { min-width: 56px; text-align: right; font-weight: 700; font-size: 18px; }
.qty .diff { min-width: 48px; text-align: right; font-size: 14px; font-weight: 600; }
.pos { color: var(--green); }
.neg { color: var(--red); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
.scroll { overflow-x: auto; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.tag.ok { background: var(--green-l); color: var(--green); }
.tag.bad { background: var(--red-l); color: var(--red); }
.tag.wait { background: var(--amber-l); color: var(--amber); }
.deliv { border-left: 4px solid var(--amber); }
.deliv.ok { border-left-color: var(--green); }
.deliv.bad { border-left-color: var(--red); }
.deliv .lines { margin: 6px 0 0; padding: 0; list-style: none; font-size: 15px; }
.banner { background: var(--amber-l); color: var(--amber); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.banner.err { background: var(--red-l); color: var(--red); }
.edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.edit-row .full { grid-column: 1 / -1; }
.edit-row input, .edit-row select { padding: 8px 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 14px; }
.checks label { display: flex; align-items: center; gap: 4px; margin: 0; color: var(--text); }
.inline { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.linkbtn { background: none; border: 0; color: var(--blue); padding: 6px 0; text-decoration: underline; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #1b2430; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 20; max-width: 90vw; }
@media (min-width: 700px) {
  .qty .ctl button { width: 40px; height: 40px; }
}
.unit { display: inline-block; margin-top: 4px; border: 1px solid var(--line); background: #fff; color: var(--blue); border-radius: 99px; padding: 2px 10px; font-size: 13px; }
.status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--blue-l); color: var(--blue); }
.status.bíður { background: var(--amber-l); color: var(--amber); }
.status.lokaður, .status.hafnað { background: var(--red-l); color: var(--red); }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btnrow button { border: 0; border-radius: 8px; padding: 8px 12px; font-size: 14px; background: var(--blue-l); color: var(--blue); }
.btnrow button.green { background: var(--green); color: #fff; }
.btnrow button.red { background: var(--red-l); color: var(--red); }
.log { font-size: 13px; }
.log div { padding: 4px 0; border-bottom: 1px solid var(--line); }
.key { font-family: ui-monospace, monospace; word-break: break-all; background: var(--amber-l); padding: 10px; border-radius: 8px; }
.sticky { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 3; }
.sticky .btn { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
table.sub { background: var(--bg); border-radius: 8px; margin: 4px 0 8px; }
table.sub th, table.sub td { padding: 5px 8px; font-size: 13px; }
