:root {
  --bg: #FBF6EF;
  --surface: #FFFFFF;
  --surface-2: #F6EFE6;
  --ink: #2A1812;
  --ink-2: #5E4A40;
  --muted: #8D7B70;
  --line: #EADFD2;
  --line-2: #F2EAE0;
  --brand: #7A1631;
  --brand-ink: #FFFFFF;
  --brand-soft: #F8E7EA;
  --gold: #D99A2B;
  --gold-soft: #FDF1DC;
  --ok: #1F7A52;   --ok-soft: #E3F4EA;
  --warn: #A96300; --warn-soft: #FFF1D9;
  --bad: #B3261E;  --bad-soft: #FCE6E4;
  --info: #255F9E; --info-soft: #E3EEFA;
  --violet: #6440A8; --violet-soft: #EEE7FA;
  --shadow: 0 1px 2px rgba(60, 30, 20, .06), 0 4px 16px rgba(60, 30, 20, .06);
  --radius: 14px;
  --side-w: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17110F; --surface: #211815; --surface-2: #2A1F1B; --ink: #F5ECE6; --ink-2: #D7C6BC;
    --muted: #A8968B; --line: #3A2C26; --line-2: #2F2420; --brand: #D9587A; --brand-ink: #1A0E0B;
    --brand-soft: #3A1B24; --gold: #F0B452; --gold-soft: #3A2A12;
    --ok: #5CC596; --ok-soft: #173327; --warn: #F0B452; --warn-soft: #3A2A12; --bad: #FF8A80; --bad-soft: #3E1C1A;
    --info: #86B7F0; --info-soft: #182A40; --violet: #B69AF0; --violet-soft: #2A2140;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.sp { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }

/* ── layout ── */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--brand); color: #FBE9EC; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side { background: #241217; } }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: #F3C26B; color: #7A1631;
  display: grid; place-items: center; font: 22px "Yeseva One", serif;
}
.brand-name { font: 20px/1 "Yeseva One", serif; color: #FFF6E8; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: #E9B9C3; margin-top: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #F7DDE2; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.on { background: #FFF6E8; color: #7A1631; font-weight: 700; }
.nav a svg { width: 20px; height: 20px; flex: none; opacity: .9; }
.nav .en { margin-left: auto; font-size: 11.5px; opacity: .6; font-weight: 400; }
.nav a.on .en { opacity: .7; }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: 12px; color: #D9A6B1; }

.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2);
}
.top h1 { font-size: 21px; font-weight: 700; }
.top .sub { font-size: 13px; color: var(--muted); }
.top .menu-btn { display: none; }
.me-btn {
  margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.view { padding: 24px 28px 110px; max-width: 1240px; width: 100%; }

.imp-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--gold-soft); color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  padding: 10px 28px; font-size: 14.5px;
}
.imp-banner b { color: var(--brand); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.25);
  }
  .app.drawer .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(20,10,8,.4); z-index: 50; display: none; }
  .app.drawer .scrim { display: block; }
  .top .menu-btn { display: grid; }
  .top { padding: 10px 16px; }
  .top h1 { font-size: 18px; }
  .view { padding: 16px 16px 120px; }
  .imp-banner { padding: 10px 16px; }
  .me-btn .me-name { display: none; }
}

/* ── primitives ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 16.5px; font-weight: 700; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 8px 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2A1812; }
.btn-danger { color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 14px; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 10px 22px; font-size: 17px; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 10px; }

.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { min-height: 80px; resize: vertical; }
label.field { display: block; }
label.field > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; font-size: 14.5px;
}
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip .ct { background: var(--gold); color: #2A1812; border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.chip.on .ct { background: #FFF6E8; color: var(--brand); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.p-submitted, .p-pending { background: var(--warn-soft); color: var(--warn); }
.p-approved, .p-making { background: var(--info-soft); color: var(--info); }
.p-dispatched { background: var(--violet-soft); color: var(--violet); }
.p-received, .p-ready, .p-delivered, .p-ok { background: var(--ok-soft); color: var(--ok); }
.p-cancelled, .p-muted { background: var(--surface-2); color: var(--muted); }
.p-rejected, .p-bad { background: var(--bad-soft); color: var(--bad); }
.p-warn { background: var(--warn-soft); color: var(--warn); }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .chip { flex: none; }

/* ── stat tiles ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tile { padding: 16px 18px; }
.tile .k { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 32px; font-weight: 800; line-height: 1.1; margin-top: 6px; }
.tile .h { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.tile.accent { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tile.accent .k, .tile.accent .h { color: color-mix(in srgb, var(--brand-ink) 80%, transparent); }

.hero {
  padding: 22px; border-radius: 18px; color: #FFF6E8; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #7A1631 0%, #9C2544 60%, #B8452F 100%);
}
.hero h2 { font: 26px/1.2 "Yeseva One", serif; letter-spacing: .2px; }
.hero p { margin: 6px 0 0; color: #F3CFD6; }
.hero .actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { background: #FFF6E8; color: #7A1631; border-color: transparent; }
.hero .btn.alt { background: rgba(255,255,255,.12); color: #FFF6E8; border-color: rgba(255,255,255,.25); }
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(243,194,107,.35), transparent 70%);
}

/* ── tables ── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th {
  text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .3px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl tr.grp td { background: var(--surface-2); font-weight: 700; font-size: 13.5px; color: var(--ink-2); padding: 8px 12px; }
.tbl tr.short td { background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
.tbl tr.clk { cursor: pointer; }
.tbl tr.clk:hover td { background: var(--surface-2); }
.tbl input.cell {
  width: 84px; min-height: 38px; text-align: right; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface);
}
.tbl input.cell:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tbl input.cell.changed { border-color: var(--gold); background: var(--gold-soft); }

/* ── order entry ── */
.order-top { display: grid; gap: 14px; }
.irow {
  display: grid; grid-template-columns: 1fr 86px 96px 150px; gap: 12px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
}
.irow:last-child { border-bottom: 0; }
.irow.has { background: color-mix(in srgb, var(--gold-soft) 60%, transparent); }
.iname { font-weight: 600; font-size: 16px; }
.iname small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat { text-align: center; }
.stat .l { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 17px; }
.stat.zero b { color: var(--muted); font-weight: 500; }
.stat.low b { color: var(--warn); }
.stat.none b { color: var(--bad); }
.inote { grid-column: 1 / -1; font-size: 13.5px; color: var(--warn); font-weight: 600; margin-top: -4px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.stepper button { width: 42px; height: 44px; border: 0; background: var(--surface-2); font-size: 22px; font-weight: 700; cursor: pointer; color: var(--brand); }
.stepper input { width: 100%; min-width: 0; height: 44px; border: 0; text-align: center; font-size: 17px; font-weight: 700; background: transparent; outline: none; }
.irow-head { background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 9px 16px; }
@media (max-width: 640px) {
  .irow { grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; padding: 12px 14px; }
  .iname { grid-column: 1 / -1; }
  .irow .stepper { grid-column: 3; }
  .irow-head { display: none; }
}

.sticky-bar {
  position: fixed; left: var(--side-w); right: 0; bottom: 0; z-index: 30;
  padding: 12px 28px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
}
@media (max-width: 900px) { .sticky-bar { left: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); } }
.sticky-bar .sum b { font-size: 18px; }

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 38px; }

/* ── steps ── */
.steps { display: flex; gap: 0; margin: 4px 0 2px; }
.step { flex: 1; text-align: center; font-size: 13px; color: var(--muted); position: relative; padding-top: 22px; font-weight: 600; }
.step::before {
  content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px;
  border-radius: 50%; background: var(--line); z-index: 1; box-shadow: 0 0 0 3px var(--surface);
}
.step::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.step:first-child::after { display: none; }
.step.done { color: var(--ok); }
.step.done::before, .step.done::after { background: var(--ok); }
.step .t { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }

/* ── lists ── */
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.li-title { font-weight: 700; }
.li-sub { font-size: 13.5px; color: var(--muted); }

.co-card { padding: 16px; display: grid; grid-template-columns: 78px 1fr; gap: 14px; }
.co-no {
  width: 78px; height: 78px; border-radius: 14px; background: var(--gold-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 24px; font-weight: 800; text-align: center; line-height: 1; overflow: hidden;
}
.co-no img { width: 100%; height: 100%; object-fit: cover; }
.co-no small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .co-grid { grid-template-columns: 1fr; } }
.kv { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.kv b { color: var(--ink); font-weight: 600; }

/* ── permission grid ── */
.perm-grid { width: 100%; border-collapse: collapse; }
.perm-grid td, .perm-grid th { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.perm-grid th { font-size: 12.5px; color: var(--muted); }
.perm-grid .mod { font-weight: 700; white-space: nowrap; }
.perm-grid .mod small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.tick {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; user-select: none;
}
.tick input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.tick.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--brand); }
.tick.dis { opacity: .55; cursor: not-allowed; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

.user-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.user-card:last-child { border-bottom: 0; }
.user-card .avatar { width: 44px; height: 44px; font-size: 16px; }
.user-card.off { opacity: .55; }
.tagline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tag { font-size: 12.5px; padding: 1px 9px; border-radius: 7px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.tag.gold { background: var(--gold-soft); color: var(--warn); }
@media (max-width: 640px) {
  .user-card { grid-template-columns: 40px 1fr; }
  .user-card .ua { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ── modal / sheet ── */
.modal-bg { position: fixed; inset: 0; background: rgba(20,10,8,.45); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(640px, 100%); max-height: 88vh; overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-h h3 { font-size: 18px; }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-2); position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 640px) {
  .modal-bg { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
}
@keyframes fade { from { opacity: 0; } }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); z-index: 100;
  background: #2A1812; color: #FFF6E8; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); color: #fff; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .45; margin-bottom: 8px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: var(--ink); font-size: 14.5px; }
.note.warn { background: var(--warn-soft); }
.note.bad { background: var(--bad-soft); }

/* ── login ── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  background: linear-gradient(150deg, #5E0F25, #7A1631 45%, #A8323B);
  color: #FFF6E8; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-art h1 { font: 44px/1.1 "Yeseva One", serif; }
.login-art p { color: #F1C9D1; font-size: 17px; max-width: 420px; }
.login-art .locs { display: flex; flex-wrap: wrap; gap: 8px; }
.login-art .locs span { border: 1px solid rgba(255,246,232,.3); padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.login-art::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(243,194,107,.35), transparent 70%);
}
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form form { width: min(380px, 100%); }
.login-form h2 { font-size: 26px; font-weight: 800; }
.pin-input { letter-spacing: 8px; font-size: 22px; text-align: center; font-weight: 700; }
@media (max-width: 800px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 22px; min-height: auto; }
  .login-art h1 { font-size: 32px; }
  .login-art .big { display: none; }
}
@media (min-width: 641px) { .irow .stat .l { display: none; } }
@media (max-width: 640px) {
  .card-pad > .row.wrap > .field, .card-pad > .row.wrap > .search { width: 100%; flex-basis: 100%; }
  .card-pad > .row.wrap > .chips { width: 100%; }
}

/* ── language switch ── */
.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.lang-switch button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
  cursor: pointer; color: var(--ink-2); min-height: 32px;
}
.lang-switch button.on { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.lang-label { display: flex !important; align-items: center; gap: 6px; }
.lang-label svg { width: 16px; height: 16px; }
.login-form .lang-switch { width: 100%; }
.login-form .lang-switch button { flex: 1; min-height: 40px; font-size: 15px; }
@media (max-width: 640px) {
  .top .lang-switch button { padding: 5px 9px; font-size: 13px; min-height: 30px; }
}

/* ── v2: rounds, pending, urgent, queue, notifications ── */
.p-new { background: var(--warn-soft); color: var(--warn); }
.p-ack { background: var(--info-soft); color: var(--info); }
.p-complete { background: var(--ok-soft); color: var(--ok); }
.p-partial { background: var(--warn-soft); color: var(--warn); }
.p-urgent { background: var(--bad-soft); color: var(--bad); }
.p-urgent::before { display: none; }
.p-carried { background: var(--violet-soft); color: var(--violet); }

.pending-banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 16px; border-radius: 14px;
  background: var(--gold-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
}
.pending-banner svg { width: 22px; height: 22px; flex: none; color: var(--warn); margin-top: 2px; }
.pending-banner b { font-size: 16px; }

.rounds { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.round-card { display: block; padding: 14px 16px; color: inherit; }
.round-card:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.round-card.dim { opacity: .55; }
.round-k { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.round-card .li-title { margin-top: 10px; font-size: 17px; }

.fab {
  position: fixed; right: 22px; bottom: 24px; z-index: 25; display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 20px; border-radius: 18px; background: var(--brand); color: var(--brand-ink); font-weight: 700;
  box-shadow: 0 10px 30px rgba(122, 22, 49, .35);
}
.fab svg { width: 20px; height: 20px; }

.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
a.tile { color: inherit; }

.slot-chip { flex-direction: column; align-items: flex-start; gap: 0; border-radius: 12px; padding: 6px 12px; line-height: 1.2; }
.slot-chip small { font-size: 11.5px; font-weight: 600; opacity: .8; }
.slot-chip.closed:not(.on) { opacity: .6; }

.irow .alt { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.irow.zero-row .iname { color: var(--ink-2); }

.urgent-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.urgent-row.on { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad-soft) 60%, var(--surface)); }
.urgent-row.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.urgent-row b svg { vertical-align: -3px; color: var(--bad); }
.zap-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.zap-btn svg { width: 18px; height: 18px; }
.zap-btn.on { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.zap-mark { color: var(--bad); }
.chip.rec { background: var(--bad); color: #fff; border-color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
.att { position: relative; }
.att img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.att button { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; }
.att.voice { padding-right: 12px; }
.att-img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }
.att-img.sm { width: 44px; height: 44px; border-radius: 10px; }

.urgent-card { border: 2px solid var(--bad); }
.deadline { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; color: var(--ink-2); }
.deadline svg { flex: none; }
.deadline.hot { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.line-note { font-weight: 600; margin-top: 2px; }

.sum-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.sum-list > div:last-child { border-bottom: 0; }
.sum-list b { font-size: 22px; }
.sum-list small { color: var(--muted); }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; overflow-x: auto; }
.seg button, .seg a { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.seg .on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg .ct { background: var(--gold); color: #2A1812; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.q-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.q-card { padding: 14px 16px; cursor: pointer; }
.q-card.is-urgent, .reg-row.is-urgent { box-shadow: inset 3px 0 0 var(--bad), var(--shadow); }
.q-card.is-urgent { border: 2px solid var(--bad); }

.reg-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ratio { font-weight: 800; font-size: 15px; }
.chip-sep { width: 1px; background: var(--line); margin: 0 4px; align-self: stretch; }

.bell { position: relative; }
.bell-ct { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.list-item.unread { background: color-mix(in srgb, var(--brand-soft) 50%, transparent); }
.mayday-banner { display: flex; align-items: center; gap: 10px; padding: 10px 28px; background: var(--bad); color: #fff; font-size: 14.5px; }
.mayday-banner a { color: #fff; text-decoration: underline; font-weight: 700; }
@media (max-width: 900px) { .mayday-banner { padding: 10px 16px; } }

.pick-list { display: grid; gap: 6px; }
.pick-list:empty { display: none; }
.pick-item { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.pick-item:hover { border-color: var(--brand); }
.list-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

.print-head { display: none; }
@media print {
  .side, .top, .sticky-bar, .imp-banner, .mayday-banner, .no-print, .fab, #toast { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .print-head { display: block; font-weight: 700; margin-bottom: 8px; }
  a { color: #000; }
}
@media (max-width: 640px) {
  .fab { right: 16px; bottom: 18px; }
  .top .bell { width: 36px; }
}
@media (max-width: 640px) {
  .top { gap: 8px; }
  .top .sub { display: none; }
  .top h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top .grow { min-width: 0; }
}
