/* Albion-style theme: dark leather chrome, parchment panels, silver-framed gold buttons. */
:root {
  --leather: #1b130c; --leather-2: #2c1e12; --chrome-text: #f0e2c0; --chrome-muted: #bfa982;
  --gold: #e8c872; --gold-deep: #c9a14a; --silver: #9c9aa3; --slate: #29282d; --slate-2: #3a3940;

  --card: #eadcbc; --soft: #dfcaa0; --text: #3b2a1a; --muted: #6e5a42; --faint: #8c7657;
  --border: #bfa272; --border-strong: #8a6d42;
  --accent: #7a4f12; --accent-bg: #f3d98f;
  --good: #3c6a1c; --good-bg: #cfe0a8; --bad: #9b2c20; --bad-bg: #efc0ad; --warn: #85560c; --warn-bg: #f2d49a;
  --radius: 8px;
  --font-display: "Cinzel", "Noto Serif Thai", Georgia, serif;
  --font-body: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--chrome-text); font: 16px/1.55 var(--font-body);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(201, 161, 74, .18), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .015) 0 2px, transparent 2px 7px),
    radial-gradient(ellipse at 50% 40%, var(--leather-2), var(--leather) 70%);
  background-attachment: fixed;
}
button, input, select { font: inherit; color: inherit; }

/* Silver-framed slate buttons with gold lettering, like the in-game "Unequip" button. */
button {
  background: linear-gradient(180deg, var(--slate-2), var(--slate)); color: var(--gold);
  border: 1px solid var(--silver); border-radius: 18px; padding: 6px 14px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 3px rgba(0, 0, 0, .45); letter-spacing: .2px;
}
button:hover { border-color: var(--gold); color: #ffe39a; }
button.primary { border: 1px solid var(--gold); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 0 0 2px rgba(232, 200, 114, .25), 0 2px 3px rgba(0, 0, 0, .45); font-weight: 600; }
button:disabled { opacity: .6; cursor: wait; }
input, select {
  background: #f7ecd4; border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 8px;
  width: 100%; min-width: 0; color: var(--text); box-shadow: inset 0 1px 3px rgba(90, 60, 20, .25);
}
input:focus, select:focus { outline: 2px solid var(--gold-deep); outline-offset: 0; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }

/* Header and tabs on leather */
.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 16px 6px; max-width: 1100px; margin: 0 auto; }
.brand-wrap { display: flex; align-items: center; gap: 10px; }
.crest { width: 38px; height: 38px; flex: none; }
.brand { font: 700 24px/1.1 var(--font-display); color: var(--gold); letter-spacing: 1.5px; text-shadow: 0 2px 0 rgba(0, 0, 0, .6); }
#hdrSub { color: var(--chrome-muted); }
/* Every control in the header is the same height, so the row reads as one bar and the round buttons stay round. */
.hdr-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.hdr-actions button { height: 34px; padding: 0 14px; font-size: 15px; line-height: 1; white-space: nowrap; }
.hdr-actions .seg button { padding: 0 12px; }
.hdr-actions button.icon { width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.hdr-actions button.icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tabs {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 0 16px; max-width: 1100px; margin: 4px auto 0;
  border-bottom: 1px solid rgba(201, 161, 74, .45); box-shadow: 0 1px 0 rgba(0, 0, 0, .6);
}
.tabs button {
  border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; background: none; box-shadow: none;
  color: var(--chrome-muted); padding: 9px 14px; font: 600 15px var(--font-display); letter-spacing: 1px;
}
.tabs button:hover { color: var(--gold); border-color: transparent; }
.tabs .ico {
  width: 19px; height: 19px; vertical-align: -4px; margin-right: 7px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .85;
}
.tabs button.on .ico { opacity: 1; filter: drop-shadow(0 0 3px rgba(232, 200, 114, .55)); }
.tabs button.on {
  color: var(--gold); background: linear-gradient(180deg, rgba(201, 161, 74, .22), rgba(201, 161, 74, .04));
  border-color: rgba(201, 161, 74, .55);
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.seg button { font-size: 15px; padding: 4px 12px; color: var(--chrome-muted); }
.seg button.on { color: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 200, 114, .25); }

/* Chips on parchment */
.chip {
  font-size: 14px; padding: 4px 11px; border-radius: 14px; border: 1px solid var(--border-strong);
  background: #f3e6c8; color: var(--text); box-shadow: 0 1px 0 rgba(90, 60, 20, .25); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.on { background: linear-gradient(180deg, var(--slate-2), var(--slate)); color: var(--gold); border-color: var(--silver); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.metrics { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin-bottom: 14px; }
.form { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: start; }
/* Settings fields: label on one line, input always on the same baseline, note below */
.fld { display: flex; flex-direction: column; }
.fld > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.fld .hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* Parchment panels */
.card, .metric {
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 250, 230, .55), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(150, 110, 50, .18), transparent 55%),
    var(--card);
}
.card {
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px 16px; min-width: 0;
  box-shadow: inset 0 0 0 3px rgba(234, 220, 188, .9), inset 0 0 0 4px rgba(138, 109, 66, .45), inset 0 0 28px rgba(120, 80, 30, .22), 0 4px 10px rgba(0, 0, 0, .45);
}
.metric {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 11px 14px;
  box-shadow: inset 0 0 18px rgba(120, 80, 30, .2), 0 2px 5px rgba(0, 0, 0, .4);
}
.card .metric { background: var(--soft); box-shadow: inset 0 0 14px rgba(120, 80, 30, .2); }
.metric .v { font: 700 26px/1.3 var(--font-display); color: var(--text); }
.card + .card, .grid + .card, .card + .grid, .metrics + .card { margin-top: 14px; }
.card h3 {
  font: 700 18px/1.3 var(--font-display); letter-spacing: .6px; color: #4a2f14; margin: 0 0 10px; padding-bottom: 7px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.card h3 select { font: 400 15px var(--font-body); letter-spacing: 0; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.row:last-child { border-bottom: none; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 14px; }
main > .toolbar .small, main > .empty { color: var(--chrome-muted); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
main > .toolbar .bad { color: #f2a08f; }
.pill { font-size: 14px; padding: 2px 9px; border-radius: 12px; white-space: nowrap; border: 1px solid currentColor; }
.pill.good { background: var(--good-bg); } .pill.bad { background: var(--bad-bg); } .pill.warn { background: var(--warn-bg); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* City names in faction colours */
.ct {
  display: inline-block; padding: 0 8px; border-radius: 10px; border: 1px solid; font-weight: 600; line-height: 1.5;
  white-space: nowrap; background: #efe6d2; border-color: var(--border-strong); color: var(--text);
}
.ct-thetford { background: #e3d3f0; border-color: #7b4fa6; color: #4d2a70; }
.ct-fort-sterling { background: #f7f8f9; border-color: #9aa3ab; color: #3f474e; }
.ct-lymhurst { background: #d6ebc8; border-color: #4f8a2e; color: #2f5a17; }
.ct-bridgewatch { background: #f7d8b5; border-color: #c46a1c; color: #7a3d08; }
.ct-martlock { background: #cfe0f3; border-color: #2f6fb0; color: #1d4a7a; }

/* Silver amounts */
.coin { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 3px; vertical-align: 0;
  background: radial-gradient(circle at 35% 35%, #ffffff, #b9b9c2 55%, #7d7c86); box-shadow: 0 0 0 1px #6a6970; }

/* Tier badge: roman numeral, tier colour text, enchant colour ring */
.tb {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 5px;
  margin-right: 5px; border-radius: 13px; background: #1d1b20; border: 2px solid #6d6a63;
  font: 700 12px/1 var(--font-display); vertical-align: -7px; box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.tb.t2 { color: #d9d2c3; } .tb.t3 { color: #8fd07a; } .tb.t4 { color: #7fb6f0; } .tb.t5 { color: #f07f6b; }
.tb.t6 { color: #f0a65a; } .tb.t7 { color: #f2dd6e; } .tb.t8 { color: #fbf7ea; }
.tb.e1 { border-color: #4caf50; } .tb.e2 { border-color: #3b82f6; } .tb.e3 { border-color: #a855f7; } .tb.e4 { border-color: #f5c542; }

/* Route plan */
.stop { border-left: 3px solid var(--gold-deep); padding: 6px 0 6px 12px; margin: 4px 0; }
.stop .city { font: 700 16px var(--font-display); color: #4a2f14; letter-spacing: .5px; }
.act { font-size: 15px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 2px 0; }
/* How-to opened from the ? button in the header */
button.icon { width: 34px; padding: 4px 0; text-align: center; font-weight: 700; }
.modal {
  position: fixed; inset: 0; background: rgba(12, 8, 4, .72); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 50;
}
.modal-box {
  background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 16px 20px; max-width: 760px; max-height: 80vh; overflow: auto;
  box-shadow: inset 0 0 0 3px rgba(234, 220, 188, .9), 0 10px 30px rgba(0, 0, 0, .6);
}
.modal-box h3 {
  font: 700 18px var(--font-display); color: #4a2f14; margin: 0 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.modal-box ul { margin: 0; padding-left: 20px; }
.modal-box li { margin: 7px 0; font-size: 15px; line-height: 1.6; }

.rf { padding: 2px 0 4px; }
.sub-act { font-size: 14px; color: var(--muted); padding: 1px 0 1px 26px; display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.tag { font-size: 13px; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; font-weight: 600; }
.tag.sell { background: var(--good-bg); color: var(--good); }
.tag.refine { background: var(--warn-bg); color: var(--warn); }
.tag.buy { background: #cfdcef; color: #1f4f86; }
.leg { font-size: 14px; color: var(--muted); padding: 4px 0 4px 15px; border-left: 3px dotted var(--border-strong); margin-left: 0; }
.bar { height: 7px; background: #cdb88e; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; margin-top: 3px; }
.bar > div { height: 100%; background: linear-gradient(180deg, #7fae4a, var(--good)); }
.rt {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 8px; font-size: 15px; background: rgba(255, 248, 228, .45);
}
.rt:hover { border-color: var(--border-strong); }
.rt.on { border: 2px solid var(--gold-deep); background: rgba(243, 217, 143, .45); }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
th { text-align: right; font: 700 14px var(--font-display); letter-spacing: .4px; color: #4a2f14; padding: 7px 6px; border-bottom: 2px solid var(--border-strong); }
td { text-align: right; padding: 6px; border-bottom: 1px dashed var(--border); }
tbody tr:nth-child(even) td { background: rgba(150, 110, 50, .07); }
th:first-child, td:first-child { text-align: left; }
td.cell { cursor: pointer; }
td.cell:hover { background: rgba(243, 217, 143, .5); }
td.best { color: var(--good); font-weight: 700; }
td.stale { color: var(--faint); }
td.manual { background: var(--warn-bg) !important; color: var(--warn); }
td.sel { outline: 2px solid var(--gold-deep); outline-offset: -2px; }
table.price-tbl { min-width: 0; table-layout: fixed; }
.price-tbl th, .price-tbl td { padding: 5px 3px; }
.price-tbl.fit input.pc { width: 100%; }
.price-tbl .grp { border-left: 2px solid var(--border-strong); }
.price-tbl th.city { text-align: center; border-bottom: 1px solid var(--border); }
.price-tbl th.sub { font: 600 13px var(--font-body); color: var(--muted); padding-top: 3px; text-align: right; }
/* Prices page: one compact bar plus a gear menu */
.pbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 10px; }
.pbar select { width: auto; max-width: 180px; padding: 4px 8px; font-size: 14px; }
.pbar input { width: auto; padding: 4px 8px; font-size: 14px; }
.pgrp { display: inline-flex; gap: 3px; flex-wrap: wrap; align-items: center; }
/* inline "label control" pair used on every page's control bar */
.il { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.cargo { display: inline-flex; gap: 4px; align-items: center; }
.cargo select { max-width: 170px; }
.chip.sm { font-size: 12px; padding: 2px 8px; }
.menu { position: relative; }
.menu .icon.on { border-color: var(--gold); }
.menu-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; max-width: 340px;
  background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; padding: 6px;
  box-shadow: inset 0 0 0 3px rgba(234, 220, 188, .9), 0 8px 24px rgba(0, 0, 0, .55);
}
.menu-h { font-size: 11px; letter-spacing: .5px; color: var(--faint); padding: 8px 8px 3px; text-transform: uppercase; }
.menu-i {
  display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 6px; box-shadow: none;
  color: var(--text); padding: 6px 8px; font-size: 14px;
}
.menu-i:hover { background: rgba(243, 217, 143, .5); color: var(--text); }
.menu-i.on { color: var(--good); font-weight: 600; }
.menu-t { font-size: 12px; color: var(--muted); padding: 4px 8px 8px; line-height: 1.6; }
.grp { margin-bottom: 26px; }
.grp-h { font: 700 17px/1.3 var(--font-display); letter-spacing: .04em; text-transform: uppercase; color: var(--gold); margin: 6px 0 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.grp-h .faint { text-transform: none; letter-spacing: 0; font: 400 13px var(--font-body); color: var(--chrome-muted); }
.savebar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 2px;
  background: linear-gradient(180deg, rgba(234, 220, 188, 0), var(--card) 35%); border-top: 1px solid var(--border);
}
.price-tbl thead th { position: sticky; top: 0; background: var(--card); z-index: 2; }
.price-tbl thead tr:nth-child(2) th { top: 30px; }
.price-tbl td.in { padding: 3px 2px; position: relative; }
/* number colour = where the price came from and how old it is */
input.pc.src-man { color: var(--text); }
input.pc.src-fresh { color: #1f5f8a; }
input.pc.src-warn { color: #a8620a; }
input.pc.src-old { color: #9a978e; font-weight: 500; }
.lg { font-size: 13px; padding: 0 3px; border-radius: 4px; }
.lg.src-man { color: var(--text); } .lg.src-fresh { color: #1f5f8a; } .lg.src-warn { color: #a8620a; } .lg.src-old { color: #9a978e; }
.best-l, input.pc.best { background: rgba(120, 190, 90, .28); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #3f9a2a; }
/* all-cities grid has narrow columns: slightly smaller digits so 5-digit prices never clip */
.price-tbl:not(.city-view) input.pc { font-size: 14px; padding: 5px 2px; }
.price-tbl:not(.city-view) input.pc.vol { font-size: 12px; }
.sb-legend { flex: 1 1 0; min-width: 0; font-size: 12px; line-height: 1.5; color: var(--muted); margin-right: 12px; }
.savebar #pCount { white-space: nowrap; margin-right: 4px; }
.sb-legend .lg { font-size: 12px; }
.price-tbl th:first-child, .price-tbl td:first-child { white-space: nowrap; width: 150px; }
.price-tbl tbody td:first-child { font-size: 15px; font-weight: 600; }
.price-tbl tbody tr:hover td { background: rgba(243, 217, 143, .28); }
/* city view: wide price columns, narrow volume, sub-captions under headers */
.price-tbl.city-view th:nth-child(2), .price-tbl.city-view th:nth-child(3) { width: 27%; }
.price-tbl.city-view th:nth-child(4) { width: 18%; }
.price-tbl th small { display: block; font: 400 11px var(--font-body); color: var(--muted); letter-spacing: 0; text-transform: none; }
/* age / source dot in front of the number */
.dot, .dot-l {
  position: absolute; left: 2px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%;
  background: var(--faint); box-shadow: 0 0 0 1px rgba(60, 40, 15, .35);
}
.dot-l { position: static; display: inline-block; margin: 0 4px 0 0; vertical-align: -1px; }
.dot.fresh, .dot-l.fresh { background: #3f9a2a; }
.dot.warn, .dot-l.warn { background: #e0a020; }
.dot.old, .dot-l.old { background: #b8b0a2; }
.dot.man, .dot-l.man { background: #2f6fb0; }
input.pc {
  width: 92px; padding: 5px 6px; text-align: right; font-size: 16px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; border: 1px solid transparent;
  background: transparent; box-shadow: none; border-radius: 6px; -moz-appearance: textfield;
}
input.pc::placeholder { font-weight: 400; color: var(--faint); font-size: 13px; }
input.pc::-webkit-outer-spin-button, input.pc::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.pc:hover { border-color: var(--border); background: rgba(255, 250, 230, .5); }
input.pc:focus { border-color: var(--gold-deep); background: #f7ecd4; outline: none; }
input.pc.manual { color: var(--text); }
input.pc.stale { color: var(--faint); font-weight: 500; }
input.pc.changed { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); text-decoration: none; }
.age { display: block; text-align: right; font-size: 11px; line-height: 1.3; padding-right: 5px; color: var(--faint); }
.age.fresh { color: var(--good); }
.age.warn { color: var(--warn); }
.age.old { color: var(--faint); opacity: .8; }
.age.man { color: var(--accent); }
input.pc.vol { color: var(--muted); font-style: normal; font-weight: 400; font-size: 13px; letter-spacing: -.2px; padding-left: 0; }
input.pc.vol.manual { color: var(--text); font-weight: 500; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
svg text { fill: var(--faint); font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 9px 16px; border-radius: 18px;
  background: linear-gradient(180deg, var(--slate-2), var(--slate)); color: var(--gold); border: 1px solid var(--silver);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .6); font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; }
.toast.bad { border-color: #e0715f; color: #ffb4a6; }

/* Signed-in user, sign-in screens, officer-only sections (guild version) */
.signed-out .tabs, .signed-out .hdr-actions { display: none; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--chrome-muted); font-size: 14px; }
.user-chip[hidden] { display: none; }
.user-chip #userName { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.auth { max-width: 520px; margin: 40px auto; text-align: left; }
.card.auth h3 { justify-content: center; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.grp.locked input:disabled, .grp.locked select:disabled, .grp.locked .chip:disabled { opacity: .75; cursor: not-allowed; }

/* ------------------------------------------------------------------ tablets and phones */

.tb { vertical-align: middle; margin-top: -2px; }
.fld .hint { font-size: 13px; }
.menu-h { font-size: 12px; }
.price-tbl th small { font-size: 12px; }
.age { font-size: 12px; }
.sb-legend, .sb-legend .lg { font-size: 13px; }
.legend-below { display: none; margin-top: 10px; }

/* Price mode as one dropdown; shown instead of the four buttons on phones. */
.mode-sel { display: none; }
.hdr-actions select {
  width: auto; height: 34px; padding: 0 8px; border-radius: 18px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, var(--slate-2), var(--slate)); color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 200, 114, .25);
}

/* Fingers, not a mouse: bigger targets, and 16px text in every field so Safari on iPhone/iPad
   does not zoom the page each time a field is tapped. */
@media (pointer: coarse), (max-width: 900px) {
  input, select, textarea, .pbar select, .pbar input, .card h3 select, input.pc, input.pc.vol,
  .price-tbl:not(.city-view) input.pc, .price-tbl:not(.city-view) input.pc.vol, .hdr-actions select { font-size: 16px; }
  input, select { min-height: 40px; }
  .pbar select, .pbar input { padding: 6px 8px; }
  .price-tbl:not(.city-view) input.pc, .price-tbl:not(.city-view) input.pc.vol { padding: 5px 1px; letter-spacing: -.3px; }
  .chip { min-height: 40px; padding: 6px 14px; }
  .chip.sm { min-height: 38px; min-width: 40px; padding: 4px 11px; font-size: 14px; }
  .pgrp { gap: 5px; }
  .il { font-size: 14px; }
  .hdr-actions button, .hdr-actions select { height: 38px; }
  .hdr-actions button.icon { width: 38px; }
  .menu-i { padding: 11px 10px; font-size: 15px; }
  .rt { padding: 11px 12px; }
  .toolbar button, .savebar button, .pbar > button { min-height: 40px; }
  #page button.icon { width: 40px; min-height: 40px; }
}

/* iPad portrait and narrow windows: header and tabs each stay on one line. */
@media (max-width: 900px) {
  .brand { font-size: 20px; letter-spacing: 1px; }
  .crest { width: 32px; height: 32px; }
  .user-chip #userName { display: none; }
  .hdr-actions .seg button { padding: 0 10px; }
  .tabs { flex-wrap: nowrap; gap: 2px; }
  .tabs button { padding: 9px 9px; letter-spacing: .4px; font-size: 14px; white-space: nowrap; }
  .tabs .ico { margin-right: 5px; }
}

/* Phones: one-line header, menu as a bar along the bottom edge. */
@media (max-width: 640px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .top { flex-wrap: nowrap; padding: 10px 12px 8px; gap: 8px; }
  .brand { display: none; }
  .hdr-actions { flex-wrap: nowrap; }
  .hdr-actions .seg { display: none; }
  .mode-sel { display: block; }
  main { padding: 12px; }

  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-width: none; margin: 0;
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #33231a, var(--leather)); border-bottom: none;
    border-top: 1px solid rgba(201, 161, 74, .6); box-shadow: 0 -4px 12px rgba(0, 0, 0, .55);
  }
  .tabs button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px;
    padding: 5px 0; border: 1px solid transparent; border-radius: 9px; font: 600 11px/1.1 var(--font-body); letter-spacing: 0;
  }
  .tabs .ico { width: 23px; height: 23px; margin: 0; vertical-align: 0; }
  .signed-out { padding-bottom: 0; }

  /* Things pinned to the bottom sit above the menu bar. */
  .savebar { bottom: calc(62px + env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: flex-end; }
  .savebar .sb-legend { display: none; }
  .legend-below { display: block; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .modal { padding: 12px; }
  .modal-box { max-height: 76vh; }

  /* Gear menu opens across the card instead of running off the right edge. */
  .pbar { position: relative; }
  .menu { position: static; }
  .menu-pop { left: 0; right: 0; min-width: 0; max-width: none; }

  /* One-city price table: narrow item column, the name already carries the tier. */
  .price-tbl.city-view th:first-child, .price-tbl.city-view td:first-child { width: 36%; white-space: normal; }
  .price-tbl.city-view tbody td:first-child { font-size: 14px; line-height: 1.25; }
  .price-tbl.city-view td:first-child .tb { display: none; }
  .price-tbl.city-view th:nth-child(2), .price-tbl.city-view th:nth-child(3) { width: 22%; }
  .price-tbl.city-view th:nth-child(4) { width: 20%; }
  .price-tbl.city-view th { font-size: 13px; letter-spacing: 0; }
  .price-tbl.city-view input.pc, .price-tbl.city-view input.pc.vol { padding: 5px 2px; letter-spacing: -.3px; }

  /* Settings › cities: one block per city instead of a table that scrolls sideways. */
  table.cities-tbl { min-width: 0; }
  .cities-tbl thead { display: none; }
  .cities-tbl tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
  .cities-tbl td { display: block; text-align: left; padding: 0; border: none; background: none !important; }
  .cities-tbl td:first-child { grid-column: 1 / -1; }
  .cities-tbl td[data-label]::before { content: attr(data-label); display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }

  .card { padding: 12px 12px; }
  .card.auth { margin: 24px auto; }
}
