/* Tecsa CMD — colours and sizes from the "Tecsa CMD ekranları" design */
:root {
  --bg: #F7F6F3;
  --page: #EDEBE6;
  --card: #FFFFFF;
  --soft: #FBFAF8;
  --hover: #F2F0EC;
  --ink: #1B1F24;
  --ink-2: #3A3E44;
  --muted: #5C6066;
  --line: #D7D3CC;
  --line-soft: #E3E0DA;
  --accent: #9C2F1E;
  --accent-dark: #7A2416;
  --accent-soft: #FBEDEA;
  --ok: #1F5F3A;
  --ok-soft: #E3F1E8;
  --warn: #6B4A0F;
  --warn-soft: #FFF6E5;
  --info: #1D4E89;
  --info-soft: #E6EEF8;
  --radius: 12px;
  --nav-w: 240px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 15px; margin: 8px 0 0; }
:focus-visible { outline: 3px solid rgba(156, 47, 30, .35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); }
.grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); text-align: center; padding: 32px 16px; margin: 0; }
.loading, .loading-inline { color: var(--muted); }
.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.loading-inline { padding: 40px 24px; }

/* ---------- buttons ---------- */
.btn {
  min-height: 52px; border-radius: var(--radius); border: 1px solid transparent; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--card); color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn-small { min-height: 44px; font-size: 14px; padding: 0 16px; }
.btn-xs { min-height: 36px; font-size: 13px; padding: 0 12px; border-radius: 8px; }
.btn-danger { background: #A3261A; }
.btn-danger-ghost { color: #A3261A; border-color: #D9A59D; }
.btn-link { background: none; border: 0; padding: 8px 4px; cursor: pointer; font: inherit; color: var(--accent); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; color: var(--ink); flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { font-size: 12px; color: var(--muted); }
.input, .pw {
  min-height: 48px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); font-size: 16px; width: 100%;
}
.input { padding: 0 14px; }
select.input { padding-right: 8px; }
select.input[size] { padding: 6px; min-height: 140px; }
.textarea { padding: 10px 14px; resize: vertical; min-height: 72px; line-height: 1.4; }
.input:focus, .pw:focus-within { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(156, 47, 30, .15); }
.input:disabled { background: var(--hover); color: var(--muted); }
.pw { display: flex; align-items: center; padding-left: 14px; }
.pw input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; height: 46px; }
.pw button { width: 48px; height: 46px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.field[data-invalid] .input, .field[data-invalid] .pw { border-color: #A3261A; }
fieldset.plain { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.inline-field .input { min-height: 44px; width: auto; font-size: 14px; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.link-strong { font-size: 14px; font-weight: 600; }

.msg { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.45; }
.msg ul { margin: 6px 0; padding-left: 20px; }
.msg-err { background: var(--accent-soft); color: #8A2618; border: 1px solid #EBC4BC; }
.msg-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #BFDCC9; }
.msg:empty, .msg.form-msg:not(.msg-err):not(.msg-ok) { display: none; }
.notice { background: var(--warn-soft); border: 1px solid #F0DDB4; color: var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.notice.small { font-size: 13px; }

/* ---------- sign-in screens (phone first, a card on wider screens) ---------- */
.auth { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; background: var(--page); }
.auth-card { width: 100%; max-width: 440px; min-height: 100vh; background: var(--bg); padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 28px; }
@media (min-width: 600px) {
  .auth { align-items: center; padding: 40px 16px; }
  .auth-card { min-height: 0; border-radius: 28px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.06); padding: 24px 32px 32px; }
}
.langs { display: flex; justify-content: flex-end; gap: 4px; }
.langs button { height: 36px; min-width: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; }
.langs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.brand { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.brand-name { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.brand-name span, .logo span { color: var(--accent); }
.brand-sub { font-size: 15px; color: var(--muted); }
.auth h1 { font-size: 22px; font-weight: 700; }
.auth .lead { margin: -16px 0 0; color: var(--muted); }
.auth-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.auth-foot .q { font-size: 14px; color: var(--ink-2); }
.auth-foot .note { font-size: 12px; color: var(--muted); line-height: 1.45; max-width: 340px; }
.back { font-size: 14px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; align-self: flex-start; }

/* ---------- signed-in frame: top bar + menu on phones, side menu on computers ---------- */
.frame { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 8px 0 16px; background: var(--card); border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; color: var(--ink); }
.logo:hover { color: var(--ink); }
.who { display: flex; align-items: center; gap: 4px; }
.role { font-size: 12px; font-weight: 600; color: var(--muted); }
.menu-btn { width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 10px; }
.menu-btn:hover { background: var(--hover); }

.nav {
  position: fixed; z-index: 30; top: 60px; left: 0; right: 0; max-height: calc(100vh - 60px); overflow-y: auto;
  background: var(--card); border-bottom: 1px solid var(--line-soft); box-shadow: 0 16px 32px rgba(0,0,0,.12);
  display: none; flex-direction: column; padding: 8px;
}
.nav.open { display: flex; }
.nav-logo { display: none; }
.nav-links { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-head { display: flex; align-items: center; min-height: 34px; padding: 0 12px; margin-bottom: 2px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.nav-links a {
  min-height: 44px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500;
}
.nav-links a:hover { background: var(--hover); color: var(--ink); }
.nav-links a[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 700; }
.nav-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-links a[aria-current="page"] .nav-badge { background: #fff; color: var(--accent); }
.nav-foot { border-top: 1px solid var(--line-soft); margin-top: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.nav-foot .langs { justify-content: flex-start; }
.nav-user { font-size: 12px; color: var(--muted); word-break: break-all; }
.nav-user b { display: block; color: var(--ink); font-size: 14px; }
.nav-out { align-self: flex-start; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 14px; }
.nav-out:hover { background: var(--hover); }

.view { min-width: 0; }
.page { padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 16px; max-width: 1280px; margin: 0 auto; }
.page-narrow { max-width: 640px; }
.page-mid { max-width: 920px; }
.page-wide { max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.panel { background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

@media (min-width: 1000px) {
  .frame { display: grid; grid-template-columns: var(--nav-w) 1fr; }
  .topbar { display: none; }
  .nav {
    position: sticky; top: 0; height: 100vh; max-height: none; display: flex; box-shadow: none;
    border-bottom: 0; border-right: 1px solid var(--line-soft); padding: 20px 12px;
  }
  .nav-logo { display: block; padding: 0 12px 16px; font-size: 20px; }
  .nav-links { flex: 1; overflow-y: auto; min-height: 0; }
  .nav-links a { font-size: 14px; min-height: 38px; }
  .page { padding: 28px 32px 56px; }
}

/* ---------- toolbars, tabs, tables ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 240px; }
.toolbar .input { min-height: 44px; font-size: 15px; }
.toolbar select.input { width: auto; max-width: 100%; flex: 0 1 260px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tabs a {
  min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card);
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.tabs a[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-n { font-size: 12px; opacity: .8; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; }
.table-scroll { max-height: 320px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-soft); background: var(--soft); white-space: nowrap; position: sticky; top: 0; }
.table th.num { text-align: right; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 600; background: var(--soft); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 4px; }
.table-compact td, .table-compact th { padding: 6px 10px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--soft); }
.table a.strong { color: var(--ink); text-decoration: none; }
.table a.strong:hover { color: var(--accent); text-decoration: underline; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--hover); color: var(--ink-2); }
.badge-draft { background: var(--hover); color: var(--ink-2); }
.badge-saved { background: var(--warn-soft); color: var(--warn); }
.badge-confirmed { background: var(--ok-soft); color: var(--ok); }
.badge-preparing { background: var(--info-soft); color: var(--info); }
.badge-shipped { background: #E7E4F6; color: #3D2F86; }
.badge-cancelled { background: #EEE; color: #5C6066; }
.badge-fix { background: var(--accent-soft); color: #8A2618; }
.badge-paid { background: var(--ok-soft); color: var(--ok); }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.imp-error td { color: #8A2618; }
.imp-exists td { color: var(--muted); }

/* ---------- panel: products ---------- */
.pack-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pack-row select { flex: 1 1 200px; width: auto; }
.price-in { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.price-in .input { width: 120px; text-align: right; }
.packs { display: flex; flex-direction: column; gap: 8px; }
.pack-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--soft); }
.pack-line.off { opacity: .75; }
.pack-name { flex: 1 1 200px; display: flex; flex-direction: column; }
.example { background: var(--soft); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 0; overflow-x: auto; }
.pick-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 10px; padding: 4px 10px; background: var(--soft); }
.pick-opt { align-items: flex-start; padding: 6px 0; min-height: 0; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line-soft);
  background: var(--card); text-decoration: none; color: var(--ink); text-align: left; cursor: pointer; width: 100%;
}
.list-item:hover { border-color: var(--accent); color: var(--ink); }
.list-item > span:first-child:not(.firm-chip) { flex: 1; min-width: 0; }
.firm-chip { min-width: 44px; height: 40px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; letter-spacing: .02em; }

/* ---------- ordering (phone first) ---------- */
.order-edit { max-width: 760px; margin: 0 auto; padding-bottom: 96px; }
.oe-head { position: sticky; top: 60px; z-index: 10; background: var(--bg); padding: 12px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line-soft); }
@media (min-width: 1000px) { .oe-head { top: 0; padding-top: 20px; } }
.firm-box { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.search-box { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips button { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chips button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.order-edit > .msg { margin: 12px 16px 0; }
.products { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.product { padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.product.in { border-color: var(--accent); }
.product-top { display: flex; gap: 12px; }
.product h3 { margin: 2px 0 4px; font-size: 15px; line-height: 1.3; }
.product .desc { margin: 4px 0 0; }
.tile { width: 64px; height: 64px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; text-align: center; padding: 4px; word-break: break-all; }
.bonus-tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 2px 8px; border-radius: 6px; }
.pack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-soft); background: var(--soft); }
.pack.in { border-color: #E4B8AF; background: var(--accent-soft); }
.pack-info { flex: 1 1 140px; display: flex; flex-direction: column; min-width: 0; }
.pack-info .pack-name { font-size: 14px; font-weight: 600; flex: none; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.qty button { width: 44px; height: 44px; border: 0; background: var(--hover); font-size: 20px; cursor: pointer; }
.qty button:hover { background: var(--line-soft); }
.qty input { width: 72px; height: 44px; border: 0; text-align: center; font-size: 16px; font-weight: 600; outline: none; }
.pack-calc { font-size: 12px; line-height: 1.35; min-width: 76px; }
.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; box-shadow: 0 -6px 18px rgba(0,0,0,.06);
}
@media (min-width: 1000px) { .cart-bar { left: var(--nav-w); } }
.cart-bar .grow { display: flex; flex-direction: column; }
.cart-total { font-size: 15px; }
.cart-total b { font-size: 17px; }
.cart-weight { display: block; font-size: 13px; color: var(--ink-2); }
.cart-weight b { font-size: 14px; }
.table tfoot tr.weight-row td { border-top: 1px solid var(--line-soft); font-weight: 500; }
#save-state.err { color: #8A2618; }

.lines .qty-in { width: 90px; min-height: 40px; text-align: right; font-size: 15px; }
.lines td.l-name { min-width: 220px; }
/* order lines as cards on phones */
@media (max-width: 699px) {
  .table.lines thead { display: none; }
  .table.lines, .table.lines tbody, .table.lines tfoot { display: block; }
  .table.lines tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 12px; border-bottom: 1px solid var(--line-soft); position: relative; }
  .table.lines td { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0; border: 0; text-align: right; }
  .table.lines td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; }
  .table.lines td.l-name { grid-column: 1 / -1; display: block; text-align: left; min-width: 0; padding-right: 48px; margin-bottom: 4px; }
  .table.lines td.l-remove { position: absolute; top: 10px; right: 10px; }
  .table.lines tfoot tr { background: var(--soft); }
  .table.lines tfoot td { border: 0; background: transparent; }
  .table.lines tfoot td:last-child:empty { display: none; }
}
.totals .row-between { font-size: 15px; }
.total-line { border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 18px !important; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-bar .btn:first-child { flex: 1 1 240px; }

.cards { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-soft);
  text-decoration: none; color: var(--ink);
}
.order-card:hover { border-color: var(--accent); color: var(--ink); }
.order-card.fix { border-color: #E4B8AF; background: #FFFBFA; }

.order-grid { display: grid; gap: 16px; }
@media (min-width: 1360px) { .order-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.order-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.order-side { display: flex; flex-direction: column; gap: 12px; }
.head-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; border-left: 2px solid var(--line-soft); font-size: 14px; }
.ev-note { font-size: 13px; color: var(--ink-2); }
.print-head { display: none; }

/* ---------- month view ---------- */
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav .strong { min-width: 140px; text-align: center; }
.month td { white-space: nowrap; }
.month td:first-child { white-space: normal; min-width: 200px; }
.month tr.group td { background: var(--soft); color: var(--accent); font-weight: 700; }
.month tr.sub td { background: var(--soft); font-size: 13px; padding-left: 32px; }
.caret { display: inline-block; transition: transform .15s; color: var(--muted); }
[aria-expanded="true"] .caret { transform: rotate(90deg); }

/* ---------- dialogs and messages ---------- */
.dlg { border: 0; padding: 0; border-radius: 18px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 24px 64px rgba(0,0,0,.25); background: var(--bg); color: var(--ink); }
.dlg-wide { width: min(760px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(27, 31, 36, .45); }
.dlg-form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 20px; }
.dlg-head h2 { font-size: 18px; }
.dlg-head .icon-btn { border: 0; background: transparent; }
.dlg-body { padding: 8px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dlg-text { margin: 0; color: var(--ink-2); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line-soft); background: var(--card); border-radius: 0 0 18px 18px; }

.toast {
  position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.toast-ok { background: #1F3A2B; color: #fff; }
.toast-err { background: #8A2618; color: #fff; }
body:has(.cart-bar) .toast { bottom: 96px; }

/* ---------- printing an order (PDF) ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .nav, .no-print, .toast, .btn, .icon-btn, .msg.form-msg { display: none !important; }
  .frame { display: block; }
  .page { padding: 0; max-width: none; }
  .print-head { display: flex; justify-content: space-between; font-size: 10pt; color: #555; border-bottom: 1px solid #ccc; padding-bottom: 6px; }
  .order-grid { display: block; }
  .panel, .table-wrap { border: 1px solid #ccc; break-inside: avoid; box-shadow: none; margin-bottom: 10px; }
  .table th { position: static; }
  .badge { border: 1px solid #ccc; }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 699px) { .table.lines tfoot td .muted.small { display: none; } }

/* file picker: the real input is hidden, the label opens it */
.file-pick { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex-wrap: wrap; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick:focus-within .btn { outline: 3px solid rgba(156, 47, 30, .35); outline-offset: 2px; }
.file-pick .btn { pointer-events: none; }

/* delivery date: a week or less left (or late) and not shipped yet */
.ddate { white-space: nowrap; }
.ddate.due { color: #C0261A; font-weight: 700; animation: ddate-blink 1.1s steps(2, start) infinite; }
@keyframes ddate-blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .ddate.due { animation: none; text-decoration: underline wavy; } }
@media print { .ddate.due { animation: none; } }
.delivery-line { margin: 6px 0 0; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* month view cells: quantity, weight, amount */
.month td.mcell { line-height: 1.3; }
.mcell .q { display: block; font-weight: 600; }
.mcell .kg { display: block; font-size: 12px; color: var(--muted); }
.mcell .ron { display: block; font-size: 12px; color: var(--ink-2); }
.month tfoot tr.grand td { background: var(--accent-soft); border-top: 2px solid var(--accent); }
.month tfoot tr.grand .q { font-size: 15px; }
.firm-pick { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- drivers and trucks ---------- */
.badge-off { background: var(--accent-soft); color: var(--accent-dark); }
.plate { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; white-space: nowrap; }
.off-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.off-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--soft); font-size: 14px; }

/* ---------- quick order button in the menu ---------- */
.nav-cta { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; margin: 0 0 14px;
  border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; font-size: 15px; }
.nav-cta:hover { background: var(--accent-dark); color: #fff; }
.top-cta { min-height: 38px; padding: 0 12px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700;
  text-decoration: none; display: inline-flex; align-items: center; font-size: 14px; }

/* ---------- order page: preparer and shipment ---------- */
.prepared-by { color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- preparation checklist (printed alone) ---------- */
.checklist-print { display: none; }
@media print {
  html.printing-checklist body > *:not(.checklist-print) { display: none !important; }
  html.printing-checklist .checklist-print { display: block; color: #000; font-size: 10.5pt; }
}
.checklist-print h1 { font-size: 15pt; margin: 2px 0 0; letter-spacing: .02em; text-transform: uppercase; }
.cl-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.cl-brand { font-weight: 800; font-size: 11pt; }
.cl-brand span { color: #9C2F1E; }
.cl-number { font-family: ui-monospace, Menlo, monospace; font-size: 14pt; font-weight: 700; }
.cl-info { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.cl-info th, .cl-info td { text-align: left; padding: 3px 6px; vertical-align: top; border: 1px solid #999; }
.cl-info th { width: 16%; background: #f2f2f2; font-weight: 600; white-space: nowrap; }
.cl-lines { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cl-lines th, .cl-lines td { border: 1px solid #777; padding: 6px 6px; vertical-align: middle; }
.cl-lines thead th { background: #e9e9e9; font-size: 9pt; text-align: left; line-height: 1.15; overflow-wrap: anywhere; }
.cl-lines thead th.num { text-align: right; white-space: normal; }
.cl-lines tbody tr { break-inside: avoid; height: 9mm; }
.cl-lines .num { text-align: right; white-space: nowrap; }
.cl-lines .c-n { width: 7mm; } .cl-lines .c-code { width: 22mm; } .cl-lines .c-pack { width: 32mm; }
.cl-lines .c-q { width: 20mm; } .cl-lines .c-tick { width: 14mm; }
.cl-lines .tick { text-align: center; }
.cl-lines .box { display: inline-block; width: 5.5mm; height: 5.5mm; border: 1.6px solid #000; border-radius: 1mm; vertical-align: middle; }
.cl-lines tfoot td { background: #f2f2f2; }
.cl-sub { font-size: 8.5pt; color: #555; font-family: ui-monospace, Menlo, monospace; }
.cl-note { margin: 8px 0 0; }
.cl-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10mm; margin-top: 14mm; break-inside: avoid; }
.cl-signs div { display: flex; flex-direction: column; gap: 2px; }
.cl-signs span { font-weight: 600; }
.cl-signs i { display: block; border-bottom: 1px solid #000; height: 12mm; }
.cl-signs small { color: #555; font-size: 8.5pt; }

.nav-version { font-size: 11px; color: var(--muted); }
