:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-spot-1: #dce7fb;
  --bg-spot-2: #e7f2ff;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --accent: #2fa46f;
  --accent-strong: #238a5c;
  --accent-soft: rgba(47, 164, 111, 0.08);
  --muted: #5f7285;
  --text: #0f1a22;
  --warning: #c47700;
  --border: rgba(15, 26, 34, 0.1);
  --border-strong: rgba(15, 26, 34, 0.16);
  --surface-muted: rgba(15, 26, 34, 0.04);
  --input-bg: rgba(15, 26, 34, 0.05);
  --pill-bg: rgba(35, 138, 92, 0.14);
  --pill-warning-bg: rgba(196, 119, 0, 0.14);
  --shadow: rgba(17, 24, 39, 0.08);
  --hover: rgba(15, 26, 34, 0.04);
  --focus: rgba(47, 164, 111, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1c26;
    --bg-spot-1: #123348;
    --bg-spot-2: #0f2a38;
    --panel: #0f2a38;
    --panel-soft: rgba(255, 255, 255, 0.02);
    --accent: #3dd598;
    --accent-strong: #2fb67e;
    --accent-soft: rgba(61, 213, 152, 0.1);
    --muted: #7aa0b8;
    --text: #e9f0f5;
    --warning: #ffae42;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --surface-muted: rgba(255, 255, 255, 0.03);
    --input-bg: rgba(255, 255, 255, 0.06);
    --pill-bg: rgba(61, 213, 152, 0.15);
    --pill-warning-bg: rgba(255, 174, 66, 0.18);
    --shadow: rgba(0, 0, 0, 0.3);
    --hover: rgba(255, 255, 255, 0.04);
    --focus: rgba(61, 213, 152, 0.35);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-spot-1: #dce7fb;
  --bg-spot-2: #e7f2ff;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --accent: #2fa46f;
  --accent-strong: #238a5c;
  --accent-soft: rgba(47, 164, 111, 0.08);
  --muted: #5f7285;
  --text: #0f1a22;
  --warning: #c47700;
  --border: rgba(15, 26, 34, 0.1);
  --border-strong: rgba(15, 26, 34, 0.16);
  --surface-muted: rgba(15, 26, 34, 0.04);
  --input-bg: rgba(15, 26, 34, 0.05);
  --pill-bg: rgba(35, 138, 92, 0.14);
  --pill-warning-bg: rgba(196, 119, 0, 0.14);
  --shadow: rgba(17, 24, 39, 0.08);
  --hover: rgba(15, 26, 34, 0.04);
  --focus: rgba(47, 164, 111, 0.35);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1c26;
  --bg-spot-1: #123348;
  --bg-spot-2: #0f2a38;
  --panel: #0f2a38;
  --panel-soft: rgba(255, 255, 255, 0.02);
  --accent: #3dd598;
  --accent-strong: #2fb67e;
  --accent-soft: rgba(61, 213, 152, 0.1);
  --muted: #7aa0b8;
  --text: #e9f0f5;
  --warning: #ffae42;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --surface-muted: rgba(255, 255, 255, 0.03);
  --input-bg: rgba(255, 255, 255, 0.06);
  --pill-bg: rgba(61, 213, 152, 0.15);
  --pill-warning-bg: rgba(255, 174, 66, 0.18);
  --shadow: rgba(0, 0, 0, 0.3);
  --hover: rgba(255, 255, 255, 0.04);
  --focus: rgba(61, 213, 152, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Fira Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, var(--bg-spot-1), var(--bg) 40%),
    radial-gradient(circle at 80% 0%, var(--bg-spot-2), var(--bg) 35%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 20px;
  background: linear-gradient(120deg, var(--accent-soft), rgba(255, 255, 255, 0));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header h1 {
  margin: 0;
  letter-spacing: 0.5px;
}

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  width: min(98vw, 1400px);
  margin: 0 auto;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 18px var(--shadow);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav button {
  background: var(--surface-muted);
  color: var(--text);
}

.nav button.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #04141b;
}

input,
button,
select,
textarea {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--focus);
}

button {
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #04141b;
}

button.secondary {
  background: var(--surface-muted);
  color: var(--text);
}

a.secondary {
  display: inline-block;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 500;
}

tr:hover td {
  background: var(--hover);
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--pill-bg);
  color: var(--accent-strong);
  display: inline-block;
}

.pill.warning {
  background: var(--pill-warning-bg);
  color: var(--warning);
}

.pill-button {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border-strong);
}

.pill-button input {
  margin-right: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-inner {
  background: var(--panel);
  padding: 16px;
  border-radius: 12px;
  width: min(640px, 92vw);
  max-height: 80vh;
  overflow: auto;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.order-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  background: var(--surface-muted);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.order-item input {
  width: 100%;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 460px;
  overflow: auto;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel-soft);
}

.order-card-header {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-card h4 {
  margin: 0 0 6px 0;
}

.note-inline {
  width: 100%;
  margin: 4px 0;
}

.order-items-list {
  margin: 6px 0 4px 0;
}

.muted {
  color: var(--muted);
}

.order-table-wrap {
  overflow: auto;
  width: 100%;
}

#order-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  border: 1px solid var(--border);
}

#order-table th,
#order-table td {
  border: 1px solid var(--border);
  padding: 8px;
  font-size: 13px;
  vertical-align: middle;
}

#order-table th {
  background: var(--panel-soft);
  text-align: left;
}

.order-table-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.compact-input {
  width: 100%;
  padding: 8px 10px;
}

.order-totals {
  margin-top: 10px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.order-final {
  display: flex;
  gap: 8px;
  align-items: center;
}

.order-final input {
  width: 140px;
}

.theme-select {
  min-width: 150px;
}

.grid {
  display: grid;
  gap: 10px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
}
