:root {
  --bg: #11151a;
  --panel: #1a2028;
  --panel-2: #141a21;
  --line: #2a3440;
  --text: #d9e1ec;
  --muted: #8494a8;
  --accent: #e2a84b;
  --accent-dim: #3a2f1e;
  --good: #7fb069;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

body { padding-bottom: 48px; }

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: linear-gradient(#171d24, #141a21);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: #201603;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
}

h1 { font-size: 17px; margin: 0; letter-spacing: 0.3px; }

.search { position: relative; flex: 1; max-width: 520px; }

#search {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

#search:focus { outline: 2px solid #3c5064; border-color: #3c5064; }

.results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 420px;
  overflow: auto;
  background: #1b222b;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px #0009;
}

.results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
}

.results li.active, .results li:hover { background: #24303c; }
.results li .tag { margin-left: auto; font-size: 11px; color: var(--muted); }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 10px;
}

button:hover { border-color: #3d4a59; }
button.ghost { background: transparent; color: var(--muted); }

main {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  max-width: 1320px;
  margin: 18px auto;
  padding: 0 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 16px;
}

h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
}

h2.mt { margin-top: 26px; }

.muted { color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; }
.num { text-align: right; white-space: nowrap; }
.empty { margin: 6px 0 0; color: #627184; font-size: 13px; }

.list-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.list-bar select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  text-overflow: ellipsis;
}

.list-bar button {
  padding: 4px 9px;
  line-height: 1.2;
}

.list-bar button:disabled { opacity: 0.35; cursor: default; }
.list-bar button:disabled:hover { border-color: var(--line); }

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

.plan li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 26px;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.plan .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.qty { display: flex; align-items: center; gap: 2px; }

.qty button { padding: 2px 7px; line-height: 1.1; }

.qty input {
  width: 52px;
  padding: 4px 2px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #0f1419;
  color: var(--text);
  font: inherit;
  -moz-appearance: textfield;
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.remove {
  padding: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #6d7d90;
  font-size: 16px;
  line-height: 1;
}

.remove:hover { color: #e07a7a; }

.table { width: 100%; border-collapse: collapse; }

.table th {
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table td {
  padding: 6px;
  border-bottom: 1px solid #212a34;
  vertical-align: middle;
}

.table tr.row:hover td { background: #1e2630; }
.table tr.row { cursor: default; }
.table tr.has-detail { cursor: pointer; }
.table tr.has-detail .caret { display: inline-block; width: 10px; color: var(--muted); }

.item { display: flex; align-items: center; gap: 9px; min-width: 0; }
.item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #0d1216;
  object-fit: contain;
  flex: none;
}

.routes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  margin-top: 3px;
}

.subs-title { margin-top: 12px; }
.subs { display: grid; gap: 4px; max-height: 190px; overflow: auto; margin-top: 6px; }

.sub {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #121820;
  font-size: 12px;
}

.sub .icon { width: 20px; height: 20px; }
.sub-name { color: var(--text); }
.sub-info { color: var(--muted); }
.sub .use { margin-left: auto; padding: 2px 8px; font-size: 11px; }

.route {
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.route:hover { color: var(--text); border-color: var(--line); }
.route.chosen { color: var(--accent); background: var(--accent-dim); border-color: #4a3a22; }
.route b { font-weight: 600; }
.sep { color: #3a4653; font-size: 11px; }

.sub td {
  padding: 0 6px 12px 38px;
  background: #161c23;
  border-bottom: 1px solid #212a34;
}

.detail { padding: 10px 0 2px; }

.detail h3 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.ingredients li { display: flex; align-items: center; gap: 5px; color: #c3ceda; }
.ingredients b { font-weight: 600; }

.alts { display: grid; gap: 6px; }

.alt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #141b23, #10161d);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.alt:hover { border-color: #46566a; background: linear-gradient(180deg, #182029, #121920); }
.alt.chosen {
  border-color: var(--accent);
  background: linear-gradient(180deg, #2b2418, #1d1811);
  box-shadow: 0 0 0 1px #e2a84b33, 0 6px 18px #0005;
}
.alt.chosen:hover { background: linear-gradient(180deg, #332a1b, #221c13); }
.alt.chosen > span:not(.cost):not(.badge) { color: #f1e7d7; }

.alt input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  flex: none;
  margin: 0;
  border: 1px solid #4a5a6d;
  border-radius: 50%;
  background: #0d1217;
  transition: border-color .15s, box-shadow .15s;
}

.alt input[type="radio"]:checked {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent);
}

.alt .cost {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0e141a;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
}

.alt.chosen .cost { border-color: #4a3a22; color: var(--accent); }
.alt .cost small { font-size: 11px; color: #6f8095; }

.badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #201603;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.nav { display: flex; gap: 4px; }

.nav a {
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
}

.nav a:hover { color: var(--text); background: #1d242d; }
.nav a.active { color: var(--text); background: #232b35; border-color: var(--line); }

#notify { margin-left: auto; }

.switch {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.switch input { accent-color: var(--accent); margin: 0; }
.switch:hover { color: var(--text); }

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

.offline {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 8px 14px;
  border-radius: 8px;
  background: #5a2a2a;
  color: #ffd9d6;
  font-size: 13px;
  box-shadow: 0 10px 30px #0008;
}

footer {
  max-width: 1320px;
  margin: 4px auto 0;
  padding: 12px 20px;
  font-size: 12px;
  border-top: 1px solid #1c242d;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  header { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}
