:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #13171d;
  --panel-2: #181d24;
  --line: #282f39;
  --text: #f3f6fa;
  --muted: #98a2b1;
  --accent: #4da3ff;
  --accent-strong: #2188f4;
  --success: #41d18a;
  --danger: #ff6b78;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(77, 163, 255, .12), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 42px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.eyebrow, .section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}

h1, h2 { margin: 0; }
h1 { font-size: clamp(32px, 6vw, 50px); line-height: 1; letter-spacing: -.04em; }
h2 { font-size: 22px; letter-spacing: -.02em; }
.subtitle { max-width: 660px; margin: 12px 0 0; color: var(--muted); line-height: 1.55; }

.status-stack { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(19, 23, 29, .88);
  color: #cad1dc;
  font-size: 13px;
  white-space: nowrap;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(65, 209, 138, .1); }
.pill.offline .dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 107, 120, .1); }
.online-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(77, 163, 255, .1); }

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(24, 29, 36, .96), rgba(19, 23, 29, .96));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel + .panel { margin-top: 18px; }
.shopping-panel, .note-panel { padding: 24px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.counter, .save-state {
  color: var(--muted);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(11, 13, 16, .45);
}

.add-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: #0f1318;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 163, 255, .12); }
input { min-height: 48px; padding: 0 14px; border-radius: 13px; }
textarea { min-height: 230px; resize: vertical; border-radius: 14px; padding: 16px; line-height: 1.55; }

.primary, .ghost, .filter, .icon-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 14px;
  color: var(--text);
  background: transparent;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.primary { min-height: 48px; background: var(--accent-strong); font-weight: 800; }
.primary:hover { background: var(--accent); }
.primary:active, .ghost:active, .filter:active, .icon-btn:active { transform: translateY(1px); }
.ghost, .filter, .icon-btn { border-color: var(--line); background: #11161c; color: #c9d1dc; }
.ghost:hover, .filter:hover, .icon-btn:hover { background: #1d242d; }
.filter.active { color: #fff; border-color: rgba(77, 163, 255, .5); background: rgba(77, 163, 255, .12); }
.danger-soft { color: #ff9ba4; }

.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 16px 0 4px; }
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.filter { min-height: 36px; padding: 0 11px; font-size: 13px; }

.items { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 9px; }
.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 13, 16, .52);
}
.item.hidden { display: none; }
.item.checked .item-text { color: #727d8c; text-decoration: line-through; }
.item-text { overflow-wrap: anywhere; line-height: 1.45; }
.item-actions { display: flex; gap: 7px; }
.icon-btn { min-width: 40px; padding: 0 10px; font-size: 13px; }
.icon-btn.delete { color: #ff9ba4; }

.check {
  appearance: none;
  width: 23px;
  height: 23px;
  border: 2px solid #4b5665;
  border-radius: 7px;
  background: #0c1015;
  display: grid;
  place-content: center;
}
.check::before {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) scale(0);
  transition: transform .12s ease;
  margin-top: -2px;
}
.check:checked { background: var(--success); border-color: var(--success); }
.check:checked::before { transform: rotate(-45deg) scale(1); }

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}
.empty-state.hidden { display: none; }
.empty-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 50%;
  background: rgba(77, 163, 255, .1);
  color: var(--accent);
  font-size: 26px;
}
.empty-state strong { color: #dbe2ec; }
.empty-state span { font-size: 13px; }

.note-head { margin-bottom: 14px; }
.note-footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 9px; color: var(--muted); font-size: 12px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 3px 0;
  color: #707b8a;
  font-size: 12px;
}

dialog {
  width: min(500px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
.dialog-card { padding: 22px; display: grid; gap: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.dialog-actions .primary { min-height: 42px; }

@media (max-width: 700px) {
  .shell { width: min(100% - 18px, 980px); padding-top: 24px; }
  .topbar { flex-direction: column; gap: 16px; }
  .status-stack { justify-content: flex-start; }
  .shopping-panel, .note-panel { padding: 17px; border-radius: 17px; }
  .section-head { align-items: flex-start; }
  .add-row { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar > .ghost { width: 100%; }
  .item { grid-template-columns: auto minmax(0, 1fr); }
  .item-actions { grid-column: 2; justify-content: flex-start; }
  footer { flex-direction: column; gap: 5px; }
}
