:root {
  --bg: #f1f5f9;
  --card: #fff;
  --line: #e2e8f0;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 84px;
  -webkit-text-size-adjust: 100%;
}
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.bar { max-width: 720px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 17px; margin: 0; font-weight: 650; }
.sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
main { max-width: 720px; margin: 0 auto; padding: 14px; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
h2 { font-size: 14px; margin: 0 0 10px; font-weight: 650; }
label { display: block; }
label > span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
input, select {
  width: 100%; padding: 9px 10px; font-size: 15px; font-family: inherit;
  border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input.num { font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.grid2 > .full { grid-column: 1 / -1; }

.vendor { padding: 12px 0; border-top: 1px solid var(--line); }
.vendor:first-child { border-top: 0; }
.vhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vname { font-weight: 600; font-size: 14px; }
.vbill { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vacts { display: flex; gap: 6px; flex-shrink: 0; }
button {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; color: #334155; padding: 7px 11px; font-size: 13px; font-weight: 500;
}
button:disabled { opacity: .5; cursor: default; }
button:active { transform: scale(.98); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.vnote { font-size: 11px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.fields { margin-top: 9px; }
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.dock button { width: 100%; padding: 13px; font-size: 15px; }

/* dropdown */
.menu {
  max-width: 720px; margin: 8px auto 0; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(15,23,42,.14);
}
.menu .hdr { padding: 8px 12px; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); font-weight: 650; }
.menu button {
  display: block; width: 100%; text-align: left; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--line); padding: 12px; font-size: 14px;
}
.menu button:last-child { border-bottom: 0; }
.menu .hint { padding: 8px 12px; font-size: 11px; color: var(--muted); background: #f8fafc; }

.msg { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
.msg.ok { background: #ecfdf5; color: #065f46; }
.msg.err { background: #fef2f2; color: #991b1b; }

.chev { display: inline-block; transition: transform .15s; margin-left: 4px; }
.chev.up { transform: rotate(180deg); }

.spin { display: inline-block; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .6s linear infinite; vertical-align: -1px; }
@keyframes sp { to { transform: rotate(360deg); } }