:root {
  color-scheme: dark;
  --ink: #f7f8fb;
  --muted: #aab4c2;
  --line: #303848;
  --paper: #0b1220;
  --surface: #171b22;
  --surface-soft: #202632;
  --brand: #1f4f8f;
  --brand-dark: #17345f;
  --accent: #d71131;
  --danger: #ff6678;
  --success: #47d18c;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 79, 143, 0.32), transparent 34vw),
    linear-gradient(135deg, #080d17 0%, #0b1220 48%, #191b20 100%);
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled, input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-screen {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: center;
}

.login-brand img {
  width: min(420px, 100%);
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.login-brand h1 {
  margin: 18px 0 8px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
}

.login-brand p { color: var(--muted); font-size: 18px; }

.login-card, .panel, dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 22px;
  display: grid;
  gap: 12px;
}

.login-card h2 { margin: 0 0 6px; }

label {
  font-size: 13px;
  font-weight: 800;
  color: #d7deea;
}

input, select {
  width: 100%;
  border: 1px solid #3b465a;
  border-radius: 8px;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: #101722;
}

input:focus, select:focus {
  outline: 3px solid rgba(31, 79, 143, 0.34);
  border-color: #5f9df2;
}

.alert, .success {
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.alert { background: rgba(215, 17, 49, 0.18); color: #ffd5dc; }
.success { background: rgba(71, 209, 140, 0.16); color: #c9f8dd; }
.muted { color: var(--muted); }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: linear-gradient(90deg, #101723 0%, #162a47 52%, #15171c 100%);
  color: white;
  padding: 18px clamp(16px, 3vw, 34px);
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: space-between;
  column-gap: 18px;
  row-gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 64px;
}

.brand > div {
  display: grid;
  align-items: center;
  justify-content: start;
  align-content: center;
  gap: 6px;
  min-height: 0;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.04;
}

.brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.2;
}

.stats {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.stat span { display: block; font-size: 13px; color: rgba(255, 255, 255, 0.68); }
.stat strong { display: block; margin-top: 2px; font-size: 22px; }

main.app-main {
  flex: 1;
  padding: clamp(14px, 3vw, 34px);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: clamp(16px, 3vw, 28px);
  align-items: start;
}

main.app-main.stats-only {
  grid-template-columns: minmax(0, 1fr);
}

main.app-main.stats-only .controls {
  display: none;
}

.controls {
  padding: 18px;
  position: sticky;
  top: 18px;
}

.controls h2, .workspace h2 { margin: 0 0 14px; font-size: 19px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }

.regular-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: #111823;
}

.regular-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.regular-head h3 {
  margin: 0;
  font-size: 15px;
}

.regular-guest-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.regular-chip {
  min-height: 36px;
  padding-inline: 10px;
  white-space: normal;
}

.regular-chip.already-open {
  outline: 2px solid rgba(71, 209, 140, 0.42);
}

.regular-empty {
  color: var(--muted);
  font-size: 13px;
}

.night-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-bottom: 18px;
  border: 1px solid #394254;
  border-radius: 8px;
  background: #111823;
}

.night-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.night-box strong {
  font-size: 20px;
}

.night-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.night-form {
  display: grid;
  gap: 8px;
}

.next-event-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.next-event-field input {
  width: 100%;
}

.primary, .secondary, .danger, .ghost {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
}

.primary { background: var(--brand); color: white; width: 100%; }
.primary:hover { background: var(--brand-dark); }
.secondary { background: #d9e8ff; color: #12325d; }
.danger { background: rgba(215, 17, 49, 0.18); color: #ffd5dc; }
.ghost { background: #2b3342; color: #edf2fa; }
.ghost:hover {
  background: #456386;
  border-color: #8fbdff;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(6, 17, 35, 0.38), 0 0 0 3px rgba(143, 189, 255, 0.16);
  transform: translateY(-2px);
}
.secondary:hover {
  background: #c7ddfa;
  box-shadow: 0 8px 18px rgba(5, 10, 18, 0.22);
  transform: translateY(-1px);
}
.danger:hover {
  background: rgba(215, 17, 49, 0.28);
  box-shadow: 0 8px 18px rgba(5, 10, 18, 0.22);
  transform: translateY(-1px);
}
.full-width { width: 100%; }

.coaster-panel {
  margin: 0 0 18px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #394254;
  background: #0f131b;
}

.coaster-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.coaster-panel div {
  padding: 12px;
  border-top: 1px solid #303848;
  color: #d7deea;
  background: #141923;
  font-weight: 800;
}

.menu-title, .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-title { margin: 24px 0 10px; }
.menu-title h3 { margin: 0; font-size: 16px; }

.drink-list, .order-list, .settings-list, .stats-grid, .music-list { display: grid; gap: 9px; }

.drink-row, .order-row, .settings-row, .stat-card {
  background: var(--surface-soft);
  border: 1px solid #333d4f;
  border-radius: 8px;
}

.drink-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.drink-row strong { display: block; overflow-wrap: anywhere; }
.drink-row span, .modal-head p { color: var(--muted); font-size: 13px; }
.drink-row.inactive { opacity: 0.62; }

.workspace { padding: 18px; min-height: 70vh; }
.toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}
.toolbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toolbar h2 { margin: 0; }
.search {
  width: 100%;
  min-height: 42px;
}

.main-nav {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 2px;
}

.top-actions {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.register-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(190px, 24vw, 280px);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: #111823;
}

.register-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.register-actions .ghost {
  flex: 1 1 180px;
  min-width: 164px;
  min-height: 42px;
  padding-inline: 10px;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
}

.register-search {
  display: grid;
  gap: 6px;
  align-content: end;
}

.register-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.main-nav .ghost:hover,
.main-nav .ghost:focus-visible,
.register-actions .ghost:hover,
.register-actions .ghost:focus-visible {
  background: #6fa7f5 !important;
  border-color: #d9e8ff !important;
  color: #07111f !important;
  box-shadow: 0 0 0 3px rgba(217, 232, 255, 0.24), 0 12px 26px rgba(0, 0, 0, 0.4) !important;
  transform: translateY(-2px) scale(1.02);
}

.main-nav .ghost:active,
.register-actions .ghost:active {
  transform: translateY(0) scale(0.99);
}

.nav-with-badge {
  position: relative;
}

.nav-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  font-size: 12px;
  line-height: 1;
}

.receipt-filter {
  display: grid;
  gap: 6px;
  min-width: min(360px, 100%);
}

.receipt-table {
  margin-top: 4px;
}

.receipt-table tbody tr:hover {
  background: rgba(143, 189, 255, 0.08);
}

.receipt-table strong {
  color: #edf3ff;
}

.regular-search {
  width: 100%;
  margin: 8px 0 10px;
  min-height: 42px;
}

.regular-group-label {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 8px 0 2px;
}

.close-checklist {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
}

.close-checklist li {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.close-checklist li.ok {
  color: #bff3d0;
  border-color: rgba(83, 202, 128, 0.35);
}

.close-checklist li.warn {
  color: #ffd7a8;
  border-color: rgba(255, 193, 117, 0.42);
  background: rgba(255, 193, 117, 0.08);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(143, 189, 255, 0.36);
  background: #10213a;
  color: #edf3ff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

.toast[hidden] {
  display: none;
}

.guest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.guest-card {
  min-height: 156px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: linear-gradient(180deg, #222a37 0%, #161c26 100%);
  padding: 15px;
  text-align: left;
  color: var(--ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
  cursor: pointer;
}

.guest-card:hover { border-color: #6fa7f5; transform: translateY(-1px); }
.guest-card h3 { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.guest-numbers { display: flex; gap: 8px; flex-wrap: wrap; align-items: start; }

.pill {
  border-radius: 999px;
  padding: 6px 9px;
  background: #30394a;
  color: #dce6f5;
  font-size: 13px;
  font-weight: 800;
}

.food-pill {
  background: rgba(215, 17, 49, 0.18);
  color: #ffd9df;
}

.locked-pill {
  background: rgba(255, 190, 90, 0.18);
  color: #ffe1ad;
  border: 1px solid rgba(255, 190, 90, 0.28);
}

.sum { color: #8fbdff; font-size: 26px; font-weight: 900; }

.card-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.card-quick .quick-button {
  min-height: 38px;
  padding-inline: 8px;
  font-size: 13px;
  white-space: normal;
  text-align: center;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.card-actions button {
  width: 100%;
  min-height: 42px;
  padding-inline: 10px;
  font-size: 13px;
  text-align: center;
  background: var(--brand);
  color: white;
}

.card-actions button:hover {
  background: var(--brand-dark);
}

.card-actions .primary,
.card-actions .secondary { width: 100%; }

.empty {
  min-height: 320px;
  border: 2px dashed #485366;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

dialog {
  width: min(900px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  border: 0;
  padding: 0;
  color: var(--ink);
  background: #101722;
  overflow: hidden;
}

dialog::backdrop { background: rgba(3, 8, 14, 0.74); backdrop-filter: blur(2px); }

#guestDialog {
  width: min(920px, calc(100vw - 32px));
  border-radius: 12px;
}

.modal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  min-height: min(520px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  background: linear-gradient(145deg, #202838 0%, #111824 100%);
  border: 1px solid #587093;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
  overflow: hidden;
}

.modal-main, .modal-side, .settings { padding: 18px; }
.modal-main { background: rgba(255, 255, 255, 0.025); overflow: auto; }
.modal-side { background: #0d1420; border-left: 1px solid #43536c; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.modal-head, .settings-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2, .settings-head h2 { margin: 0; font-size: 28px; overflow-wrap: anywhere; }

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #2b3342;
  color: #edf2fa;
  font-size: 24px;
  line-height: 1;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 44px 44px auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.order-row button {
  width: 44px;
  height: 40px;
  border-radius: 8px;
  background: #30394a;
  color: #edf2fa;
  font-size: 23px;
  font-weight: 900;
}

.order-row .add { background: #1f4f8f; color: white; }
.order-row .qty { min-width: 44px; text-align: center; font-weight: 900; font-size: 19px; font-variant-numeric: tabular-nums; }
.line-price { width: 86px; min-width: 86px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.order-section-title {
  margin-top: 2px;
  padding: 8px 2px 2px;
  color: #d7deea;
  font-size: 13px;
  font-weight: 900;
}
.order-section-title.food-title {
  margin-top: 10px;
  color: #ffd9df;
}

.checkout-box {
  background: #202632;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.checkout-box span { color: var(--muted); font-size: 13px; font-weight: 700; }
.checkout-box strong { display: block; margin-top: 3px; font-size: 34px; color: #8fbdff; }
.flat-rate-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #43536c;
  border-radius: 8px;
  background: #121c2b;
}
.flat-rate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
}
.flat-rate-row input,
.flat-rate-row button {
  min-height: 42px;
}
.flat-rate-row button {
  padding-inline: 0;
}
.guest-history-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #43536c;
  border-radius: 8px;
  background: #182131;
}
.guest-history-box span { color: var(--muted); font-size: 13px; font-weight: 800; }
.guest-history-box strong { color: #d9e8ff; font-size: 16px; }
.guest-history-box p { margin: 0; color: #d7deea; font-size: 13px; }
.guest-history-box ul { margin: 2px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.merge-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #43536c;
  border-radius: 8px;
  background: #121c2b;
}
.merge-box label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.merge-box select,
.merge-box button {
  width: 100%;
}
.side-actions { display: grid; gap: 9px; margin-top: auto; }
.side-actions .primary, .side-actions .secondary, .side-actions .danger, .side-actions .ghost { width: 100%; }

.settings-dialog { width: min(980px, calc(100vw - 24px)); }
.settings-dialog .settings {
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}
.settings { display: grid; gap: 18px; }
.settings-head p { margin: 6px 0 0; color: var(--muted); }
.compact-head { margin-bottom: 10px; }
.compact-head h2 { font-size: 22px; }
.settings-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px 150px;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: #111823;
  border: 1px solid #333d4f;
  border-radius: 8px;
}

.user-create-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 140px 150px;
}

.settings-row {
  display: grid;
  grid-template-columns: 78px minmax(150px, 1fr) 130px 110px 104px 118px 104px;
  gap: 9px;
  align-items: center;
  padding: 10px;
}

.settings-row input { min-height: 40px; }
.settings-row .secondary, .settings-row .danger { min-height: 40px; width: 100%; }
.deleted-drink-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: var(--surface-soft);
}
.deleted-drink-row strong,
.deleted-drink-row span {
  display: block;
}
.deleted-drink-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}
.settings-section {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.regular-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) 150px;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: #111823;
  border: 1px solid #333d4f;
  border-radius: 8px;
}
.regular-form .field { margin-bottom: 0; }
.regular-settings-list {
  display: grid;
  gap: 9px;
}
.quick-settings-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.quick-setting {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: var(--surface-soft);
}

.regular-settings-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) 110px;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: var(--surface-soft);
}
.regular-settings-row input { min-height: 40px; }
.regular-settings-row .danger { min-height: 40px; width: 100%; }
.sort-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.icon-sort {
  min-width: 0;
  padding-inline: 0;
  font-size: 18px;
}

.stats-panel, .music-panel { display: none; }
.stats-filter {
  display: grid;
  grid-template-columns: 160px minmax(220px, 420px) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.export-actions .secondary,
.export-actions .danger,
.export-actions .ghost {
  min-width: 160px;
  padding-inline: 16px;
  text-align: center;
  white-space: nowrap;
}
.quick-button { min-height: 38px; }
.system-status {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid #303d52;
  border-radius: 8px;
  background: #0f1724;
  color: #cbd8ea;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}
.system-status.status-warning {
  border-color: rgba(255, 193, 117, 0.72);
  background: rgba(136, 71, 25, 0.34);
  color: #ffe3bf;
  box-shadow: 0 0 0 3px rgba(255, 193, 117, 0.12);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: #dce6f5;
  font-weight: 800;
}
.check-row input {
  width: auto;
  min-height: auto;
}
.regular-form {
  grid-template-columns: minmax(170px, 1fr) minmax(150px, 1fr) 110px 150px;
}
.regular-settings-row {
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) 96px minmax(180px, 1.2fr) 96px;
}
.regular-settings-row select {
  min-height: 76px;
}
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-card { padding: 14px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; }
.stat-card strong { display: block; margin-top: 4px; font-size: 28px; }
.nerd-grid {
  margin-bottom: 20px;
}
.version-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #31415a;
  border-radius: 8px;
  background: #0f1724;
}
.version-strip span {
  color: var(--muted);
  font-weight: 800;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #111823;
}
.check-card > strong {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.check-card.ok > strong {
  color: #07140d;
  background: var(--success);
}
.check-card.warn > strong {
  color: #2b0b10;
  background: #ffbd66;
}
.check-card span {
  display: block;
  font-weight: 900;
}
.check-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.nerd-grid .stat-card strong {
  overflow-wrap: anywhere;
}
.nerd-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}
.nerd-footer p {
  margin: 6px 0;
}
.nerd-terminal {
  margin: 10px 0 22px;
  border: 1px solid #31415a;
  border-radius: 8px;
  background: #07101b;
  box-shadow: inset 0 0 0 1px rgba(111, 167, 245, 0.08);
  overflow: hidden;
}
.terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #0e1b2d;
  color: #9ed0ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
}
.sql-block {
  padding: 14px;
  border-top: 1px solid rgba(143, 189, 255, 0.14);
}
.sql-block h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #dce9ff;
}
.sql-block pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(71, 209, 140, 0.22);
  border-radius: 8px;
  background: #050a11;
  color: #75f0a2;
  overflow-x: auto;
}
.sql-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.terminal-empty {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.nerd-table {
  margin-top: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.nerd-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.nerd-split h3 {
  margin: 0 0 8px;
}
.superadmin-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.superadmin-tools .secondary {
  min-width: 210px;
}
.table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }
.table th { color: var(--muted); font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.table-action { min-height: 36px; padding-inline: 10px; }

.music-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.music-head h3 {
  margin: 0;
  font-size: 20px;
}

.music-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.music-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: var(--surface-soft);
}

.music-card strong {
  display: block;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.music-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.music-card p {
  margin: 8px 0 0;
  color: #d7deea;
}

.order-state-submitted {
  border-color: rgba(143, 189, 255, 0.5);
}

.order-state-processing {
  border-color: rgba(255, 190, 90, 0.55);
  background: rgba(255, 190, 90, 0.08);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #2b3342;
  color: #edf2fa;
  font-weight: 900;
}

.status-pill[data-state="processing"] {
  background: rgba(255, 190, 90, 0.2);
  color: #ffe1ad;
}

.status-pill[data-state="ready"],
.status-pill[data-state="done"] {
  background: rgba(91, 214, 139, 0.2);
  color: #c7f8d7;
}

.order-items {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: #d7deea;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.music-actions {
  display: flex;
  gap: 8px;
}

.music-actions button {
  min-height: 38px;
}

.order-assignment {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 1fr);
  gap: 9px;
  margin-top: 12px;
}

.order-assignment label {
  display: grid;
  gap: 6px;
}

.order-assignment input,
.order-assignment select {
  min-height: 40px;
}

.music-history {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.music-history h3 {
  margin: 0;
  font-size: 18px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.history-head select {
  width: min(180px, 100%);
  min-height: 40px;
}

.history-card {
  opacity: 0.88;
}

.history-status {
  justify-self: end;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #30394a;
  color: #dce6f5;
}

.history-actions {
  display: flex;
  gap: 8px;
  align-items: start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.history-status.done {
  background: rgba(71, 209, 140, 0.16);
  color: #c9f8dd;
}

.history-status.deleted {
  background: rgba(215, 17, 49, 0.18);
  color: #ffd5dc;
}

.empty.compact {
  min-height: 180px;
}

.preview-dialog {
  width: min(760px, calc(100vw - 24px));
}

.preview-box {
  display: grid;
  gap: 16px;
}

.close-report-dialog {
  overflow: hidden;
}

.close-report-box {
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.close-report-content {
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.thermal-preview {
  display: grid;
  justify-content: center;
  padding: 14px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: #0c111a;
  overflow: auto;
}

.thermal-paper {
  width: min(360px, 100%);
  min-height: 420px;
  padding: 20px 18px 24px;
  background: #fffdf5;
  color: #151515;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.38);
}

.thermal-logo {
  text-align: center;
  font-size: 21px;
  font-weight: 900;
  margin-bottom: 10px;
}

.thermal-logo img {
  display: block;
  width: min(250px, 88%);
  height: auto;
  margin: 0 auto;
}

.thermal-address,
.thermal-slogan,
.thermal-thanks,
.thermal-next,
.thermal-note {
  text-align: center;
}

.thermal-slogan {
  font-style: italic;
  margin-top: 6px;
}

.thermal-rule {
  border-top: 1px dashed #222;
  margin: 12px 0;
}

.thermal-meta,
.thermal-item-sub,
.thermal-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.thermal-item {
  padding: 7px 0;
}

.thermal-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #222;
  font-weight: 900;
}

.thermal-item-main {
  font-weight: 900;
}

.thermal-item-sub {
  color: #333;
  font-size: 13px;
}

.thermal-total {
  align-items: baseline;
  font-weight: 900;
  font-size: 18px;
}

.thermal-total strong {
  font-size: 24px;
}

.thermal-thanks,
.thermal-next,
.thermal-note {
  margin-top: 12px;
}

.thermal-note {
  font-size: 12px;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.report-summary div {
  padding: 12px;
  border: 1px solid #333d4f;
  border-radius: 8px;
  background: var(--surface-soft);
}

.report-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.compact-table {
  margin-top: 4px;
}

.lock-dialog {
  width: min(420px, calc(100vw - 24px));
}

.lock-box p {
  margin: 0;
  color: var(--muted);
}

@media (hover: none) {
  .guest-card:hover { transform: none; }
}

@media (max-width: 900px) {
  .login-screen, main.app-main, .modal { grid-template-columns: 1fr; }
  .controls { position: static; }
  .register-tools {
    position: sticky;
    top: 8px;
    z-index: 6;
  }
  .guest-card {
    min-height: 172px;
  }
  .card-actions button,
  .card-quick button {
    min-height: 46px;
  }
  .modal-side { border-left: 0; border-top: 1px solid var(--line); }
  .settings-form, .settings-row, .user-create-form, .stats-filter, .regular-form, .regular-settings-row, .quick-settings-list { grid-template-columns: 1fr; }
  .sort-buttons { grid-template-columns: repeat(2, minmax(0, 120px)); }
  .coaster-panel {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
  }
  .coaster-panel img { aspect-ratio: 1 / 1; }
  .coaster-panel div { border-top: 0; border-left: 1px solid #303848; }
}

@media (max-width: 620px) {
  body { background: #0b1220; }
  .login-body { padding: 14px; align-items: start; }
  .login-screen { gap: 14px; }
  .login-brand { text-align: center; }
  .login-brand img { width: min(220px, 72vw); }
  .login-brand h1 { font-size: 34px; }
  .login-card { padding: 16px; }
  header {
    padding: 12px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-items: stretch;
  }
  .brand { width: 100%; }
  .brand, .stats, .main-nav, .top-actions {
    grid-column: 1;
    grid-row: auto;
  }
  .brand-mark { width: 52px; height: 52px; }
  .brand h1 { font-size: 24px; }
  .brand p { font-size: 13px; }
  .stats { justify-content: stretch; width: 100%; }
  .stat { flex: 1; min-width: 96px; padding: 8px; }
  .stat strong { font-size: 18px; }
  main.app-main { padding: 10px; gap: 10px; }
  .controls, .workspace { padding: 12px; }
  .coaster-panel { grid-template-columns: 72px minmax(0, 1fr); margin-bottom: 12px; }
  .night-box { margin-bottom: 12px; }
  .menu-title { margin-top: 16px; }
  .main-nav { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-nav .ghost { min-width: 0; padding-inline: 8px; }
  .top-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .register-tools { grid-template-columns: 1fr; }
  .register-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .register-actions .ghost {
    width: 100%;
    min-width: 0;
  }
  .guest-grid { grid-template-columns: 1fr; }
  .guest-card { min-height: 128px; padding: 13px; }
  .card-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .music-card { grid-template-columns: 1fr; }
  .panel-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .receipt-filter { width: 100%; }
  .music-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-assignment { grid-template-columns: 1fr; }
  .nerd-split { grid-template-columns: 1fr; }
  .history-head { align-items: stretch; flex-direction: column; }
  .history-head select { width: 100%; }
  .history-status { justify-self: start; }
  .history-actions { justify-content: flex-start; }
  dialog {
    width: calc(100vw - 18px);
    max-width: none;
    max-height: calc(100dvh - 18px);
    border-radius: 10px;
  }
  .close-report-box {
    max-height: calc(100dvh - 18px);
  }
  .close-report-content {
    padding-right: 0;
  }
  .close-report-dialog .preview-actions {
    display: grid;
  }
  #guestDialog { width: calc(100vw - 18px); border-radius: 10px; }
  .modal { min-height: auto; max-height: calc(100dvh - 18px); grid-template-rows: minmax(0, 1fr) auto; border-radius: 10px; }
  .modal-main { overflow: auto; padding: 14px; }
  .modal-side {
    max-height: 42dvh;
    overflow: auto;
    padding: 12px;
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.34);
  }
  .checkout-box { padding: 10px; }
  .checkout-box strong { font-size: 26px; }
  .side-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
  .side-actions .primary, .side-actions .secondary, .side-actions .danger { min-height: 48px; padding-inline: 8px; }
  .order-row { grid-template-columns: minmax(0, 1fr) 52px 42px 52px; gap: 7px; }
  .order-row button { width: 52px; height: 48px; font-size: 28px; }
  .line-price { grid-column: 1 / -1; width: auto; min-width: 0; text-align: left; }
  .settings-dialog .settings { padding: 12px; }
  .table, .table thead, .table tbody, .table th, .table td, .table tr { display: block; }
  .table thead { display: none; }
  .table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--surface-soft);
  }
  .table td { border: 0; padding: 7px 0; }
  .inline-form { display: grid; grid-template-columns: 1fr auto; }
}
