/* Table management controls and saved light/dark appearance modes. */
.theme-toggle {
  flex: 0 0 auto;
  font-size: 1.05rem;
  line-height: 1;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-open {
  width: 100%;
  min-height: 116px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 13px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.table-open:focus-visible {
  outline: 3px solid rgba(231, 131, 61, .45);
  outline-offset: -3px;
}

.table-manage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 9px 11px 11px;
  border-top: 1px solid var(--line);
}

.table-manage .btn {
  width: 100%;
}

.theme-choice {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(105px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #e8edea;
}

.theme-choice .btn {
  border-color: transparent;
  background: transparent;
}

.theme-choice .btn.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 12px rgba(21, 63, 54, .18);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --green: #226b59;
  --green2: #2f866f;
  --green3: #203a32;
  --orange: #f29a57;
  --orange2: #3a2a20;
  --ink: #edf5f1;
  --muted: #9fb0aa;
  --line: #34453f;
  --bg: #0e1513;
  --white: #17211e;
  --red: #ff9696;
  --redbg: #3b2528;
  --gold: #ffc272;
  --goldbg: #3a2e20;
  --blue: #9acaf0;
  --bluebg: #203342;
  --shadow: 0 18px 46px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--ink);
}

html[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #091713, #102720);
}

html[data-theme="dark"] .topbar {
  border-bottom-color: var(--line);
  background: rgba(14, 21, 19, .94);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .dialog-card,
html[data-theme="dark"] .lock-card {
  border-color: var(--line);
  background: #17211e;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .btn,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .clock,
html[data-theme="dark"] .shift-chip {
  border-color: var(--line);
  background: #1c2925;
  color: var(--ink);
}

html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .icon-btn:hover {
  border-color: #557068;
  background: #24332f;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .cat-strip button.active,
html[data-theme="dark"] .order-type-seg button.active,
html[data-theme="dark"] .order-type-seg button.active:hover,
html[data-theme="dark"] .theme-choice .btn.active {
  border-color: #2f806a;
  background: #2a735f;
  color: #fff;
}

html[data-theme="dark"] .btn-accent {
  border-color: var(--orange);
  background: #c96f34;
  color: #fff;
}

html[data-theme="dark"] .btn-danger {
  border-color: transparent;
  background: var(--redbg);
  color: var(--red);
}

html[data-theme="dark"] .control {
  border-color: #40534c;
  background: #111a17;
  color: var(--ink);
}

html[data-theme="dark"] .control::placeholder {
  color: #71827c;
}

html[data-theme="dark"] .control:focus {
  border-color: #4ea188;
  box-shadow: 0 0 0 3px rgba(78, 161, 136, .16);
}

html[data-theme="dark"] .field label,
html[data-theme="dark"] .receipt-note-editor label {
  color: #c5d1cd;
}

html[data-theme="dark"] .stat::after,
html[data-theme="dark"] .quick i,
html[data-theme="dark"] .activity-icon {
  background: #213a32;
  color: #91d6bf;
}

html[data-theme="dark"] .positive,
html[data-theme="dark"] .menu-price,
html[data-theme="dark"] .ticket-item > b,
html[data-theme="dark"] .setup-steps,
html[data-theme="dark"] .license-status-grid strong,
html[data-theme="dark"] .report-positive {
  color: #8bd5bc !important;
}

html[data-theme="dark"] .shift-chip.open {
  border-color: #315c4e;
  background: #18342c;
  color: #8bd5bc;
}

html[data-theme="dark"] .shift-chip.closed {
  border-color: #61462f;
  background: #31251d;
  color: #f2b27c;
}

html[data-theme="dark"] .seg,
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .order-type-seg,
html[data-theme="dark"] .report-tabs,
html[data-theme="dark"] .theme-choice {
  border-color: var(--line);
  background: #111a17;
}

html[data-theme="dark"] .seg button.active,
html[data-theme="dark"] .tabs button.active,
html[data-theme="dark"] .report-tabs button.active {
  background: #263630;
  color: #a4dfcb;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .order-type-seg button {
  color: #aab9b4;
}

html[data-theme="dark"] .order-type-seg button:hover {
  background: #22312c;
  color: var(--ink);
}

html[data-theme="dark"] .cat-strip button,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .qty button {
  background: #22302c;
  color: #aebdb8;
}

html[data-theme="dark"] .badge.green {
  background: #19382f;
  color: #8bd5bc;
}

html[data-theme="dark"] .badge.orange { background: var(--goldbg); color: var(--gold); }
html[data-theme="dark"] .badge.red { background: var(--redbg); color: var(--red); }
html[data-theme="dark"] .badge.blue { background: var(--bluebg); color: var(--blue); }

html[data-theme="dark"] .table th,
html[data-theme="dark"] .cart-meta,
html[data-theme="dark"] .totals,
html[data-theme="dark"] .cart-actions,
html[data-theme="dark"] .receipt-note-editor {
  background: #121c19;
}

html[data-theme="dark"] .table td,
html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .cart-line,
html[data-theme="dark"] .switch-row {
  border-color: #2b3a35;
}

html[data-theme="dark"] .table tbody tr:hover {
  background: #1d2a26;
}

html[data-theme="dark"] .quick,
html[data-theme="dark"] .menu-tile,
html[data-theme="dark"] .menu-tile.has-image,
html[data-theme="dark"] .menu-image-preview,
html[data-theme="dark"] .logo-preview {
  border-color: var(--line);
  background: #192420;
  color: var(--ink);
}

html[data-theme="dark"] .quick:hover,
html[data-theme="dark"] .menu-tile:hover {
  border-color: #587268;
  background: #1f2e29;
}

html[data-theme="dark"] .menu-thumb {
  background: #0b110f;
}

html[data-theme="dark"] .menu-tile .menu-description {
  color: #a8b7b2;
}

html[data-theme="dark"] .table-card {
  border-color: var(--line);
  background: #17211e;
  color: var(--ink);
}

html[data-theme="dark"] .table-card.occupied {
  border-color: #72513b;
  background: #2d241e;
}

html[data-theme="dark"] .table-card.ready {
  border-color: #3c6d5c;
  background: #172d26;
}

html[data-theme="dark"] .table-card.reserved {
  border-color: #3f6075;
  background: #192832;
}

html[data-theme="dark"] .table-card:hover {
  border-color: #68877b;
}

html[data-theme="dark"] .table-manage {
  border-color: var(--line);
  background: rgba(8, 15, 13, .18);
}

html[data-theme="dark"] .bar,
html[data-theme="dark"] .stock-meter,
html[data-theme="dark"] .report-share-track {
  background: #263530;
}

html[data-theme="dark"] .check-card {
  border-color: var(--line);
  background: #192420;
}

html[data-theme="dark"] .backup-schedule > div,
html[data-theme="dark"] .license-status-grid > div {
  border-color: var(--line);
  background: #121c19;
}

html[data-theme="dark"] .backup-schedule span { color: var(--muted); }
html[data-theme="dark"] .backup-schedule strong { color: #a4dfcb; }

html[data-theme="dark"] .license-card {
  border-color: #315348;
  background: linear-gradient(135deg, #17211e, #192c26);
}

html[data-theme="dark"] .license-pill.active {
  background: #1b3a31;
  color: #91d6bf;
}

html[data-theme="dark"] .report-note {
  border-color: #315348;
  background: #172a24;
  color: #b1d6c9;
}

html[data-theme="dark"] .setup-welcome {
  border-color: #315348;
  background: linear-gradient(120deg, #1b3029, #17211e);
}

html[data-theme="dark"] .setup-welcome span {
  color: #91d6bf;
}

html[data-theme="dark"] .switch i {
  background: #475852;
}

html[data-theme="dark"] .switch i::after {
  background: #dce7e3;
}

@media (max-width: 620px) {
  .theme-toggle { width: 40px; height: 40px; }
  .appearance-card .section-head { gap: 15px; }
  .theme-choice { width: 100%; }
}

@media print {
  html[data-theme="dark"] { color-scheme: light; }
}
