:root {
  --bg: #0b1426;
  --panel: #12203a;
  --panel-2: #172a4a;
  --ink: #f5f1e8;
  --muted: rgba(245, 241, 232, 0.62);
  --line: rgba(255, 255, 255, 0.12);
  --red: #d7263d;
  --red-dark: #a8142a;
  --gold: #f2c14e;
  --green: #4fd18b;
  --blue: #7fb6ff;
  --amber: #ffb547;
  --font: 'Montserrat', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: var(--gold); }

.brand { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.brand-mark { font-weight: 800; letter-spacing: 0.16em; font-size: 17px; }
.brand-sub { font-family: 'Great Vibes', cursive; font-size: 27px; color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-primary { background: linear-gradient(180deg, #e8344b, var(--red-dark)); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.06); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .tabs button:focus-visible, .order:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 16px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; }
input[type='password'], .sheet input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); }
.error { margin: 0; color: #ff8a8a; min-height: 1em; }

/* ---------- app ---------- */
.app { max-width: 1180px; margin: 0 auto; padding: 0 16px 60px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 0 14px; }
.top-actions { display: flex; gap: 8px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 14px; border-radius: 14px; background: rgba(242, 193, 78, 0.12); border: 1px solid rgba(242, 193, 78, 0.4); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { padding: 12px 16px; border: 0; background: none; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .count { margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 0; }
.toolbar .spacer { flex: 1; }
.check-all { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }

.orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.order {
  display: grid; grid-template-columns: auto 150px minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; cursor: pointer;
}
.order:hover { background: var(--panel-2); }
.order .pick { width: 18px; height: 18px; }
.order .pick-cell { display: grid; place-items: center; width: 22px; }
.order-name { font-weight: 800; font-size: 15px; }
.order-date, .order-who span { display: block; color: var(--muted); font-size: 12px; }
.order-who { min-width: 0; }
.order-who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumbs { display: flex; }
.thumbs img, .thumbs .no-file { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--panel); margin-left: -10px; background: #223; }
.thumbs img:first-child, .thumbs .no-file:first-child { margin-left: 0; }
.thumbs .no-file { display: grid; place-items: center; font-size: 10px; color: #ff8a8a; }
.thumbs .more-n { align-self: center; margin-left: 6px; color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip { padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; background: rgba(255, 255, 255, 0.08); white-space: nowrap; }
.chip.ok { background: rgba(79, 209, 139, 0.16); color: var(--green); }
.chip.wait { background: rgba(255, 181, 71, 0.16); color: var(--amber); }
.chip.info { background: rgba(127, 182, 255, 0.16); color: var(--blue); }
.chip.bad { background: rgba(255, 110, 110, 0.16); color: #ff8a8a; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.more { display: grid; place-items: center; padding: 16px; }

/* ---------- drawer ---------- */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(3, 8, 18, 0.6); backdrop-filter: blur(3px); }
.drawer { margin: 0 0 0 auto; height: 100%; max-height: none; width: min(640px, 100%); padding: 0; border: 0; background: var(--bg); border-left: 1px solid var(--line); }
.drawer-body { padding: 20px 20px 40px; display: grid; gap: 18px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer-head h2 { margin: 0; font-size: 22px; }
.box { padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 8px; }
.box h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.box p { margin: 0; line-height: 1.5; }
.box .row, .sheet .row { display: flex; gap: 8px; flex-wrap: wrap; }
.items { display: grid; gap: 12px; }
.item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.item img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; background: #fff; }
.item .no-file { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; text-align: center; padding: 20px; background: rgba(255, 110, 110, 0.1); color: #ff8a8a; font-size: 12px; }
.item dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 13px; }
.item dt { color: var(--muted); }
.item dd { margin: 0; overflow-wrap: anywhere; }

.sheet { width: min(520px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); padding: 0; }
.sheet-body { padding: 20px; display: grid; gap: 12px; }
.sheet h2 { margin: 0; }
.muted { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translate(-50%, 160%); padding: 12px 20px; border-radius: 999px;
  background: #fdf8ef; color: #1a1a1a; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); transition: transform 0.3s ease; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .order { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'pick name thumbs' 'pick who thumbs' 'pick chips chips'; gap: 6px 12px; }
  .order .pick-cell { grid-area: pick; }
  .order .order-id { grid-area: name; }
  .order .order-who { grid-area: who; }
  .order .thumbs { grid-area: thumbs; }
  .order .chips { grid-area: chips; justify-content: flex-start; }
  .item { grid-template-columns: 96px minmax(0, 1fr); }
  .item img, .item .no-file { width: 96px; height: 96px; }
}
