:root {
  --bg: #0f1720;
  --bg-soft: #16212e;
  --panel: #1b2735;
  --panel-2: #223044;
  --border: #2c3e54;
  --text: #e8eef5;
  --muted: #93a4b8;
  --primary: #ff9900;        /* Amazon-ish accent */
  --primary-ink: #1a1207;
  --secondary: #2f80ed;
  --success: #2ecc71;
  --danger: #e74c3c;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: linear-gradient(180deg, #0c131b 0%, var(--bg) 40%);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}

.wrap { max-width: 920px; margin: 0 auto; padding: 0 18px; }

/* Header */
.site-header {
  background: linear-gradient(135deg, #14202d, #0f1925);
  border-bottom: 1px solid var(--border);
  padding: 28px 0 24px;
}
.header-inner { text-align: center; }
.brand { margin: 0; font-size: 1.9rem; letter-spacing: -0.5px; }
.tagline { margin: 6px 0 0; color: var(--muted); }

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 22px 0;
  box-shadow: var(--shadow);
}
.empty-panel { text-align: center; color: var(--muted); }

/* Forms / fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1 1 auto; }
.field label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; }

input, select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.18);
}
.row { display: flex; gap: 10px; }
.row input { flex: 1; }

/* Section headings */
.section-title { margin: 0 0 2px; font-size: 1.15rem; }
.section-hint { margin: 0 0 16px; color: var(--muted); font-size: 0.86rem; }

/* List tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: transform 0.08s ease, border-color 0.15s, box-shadow 0.15s;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}
.tile:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.22);
}
.tile-name { font-size: 1.05rem; font-weight: 700; word-break: break-word; }
.tile-count { font-size: 0.8rem; color: var(--muted); }
.tile-bar {
  height: 7px; border-radius: 999px; background: var(--panel-2);
  overflow: hidden; border: 1px solid var(--border);
}
.tile-bar-fill { display: block; height: 100%; background: var(--success); transition: width 0.25s ease; }
.tile-open { margin-top: 2px; font-size: 0.82rem; font-weight: 600; color: var(--primary); }

/* Back button */
.back-btn { margin-bottom: 14px; }

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.05s ease, filter 0.15s, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 7px 11px; font-size: 0.82rem; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { filter: brightness(1.08); }
.btn-success { background: var(--success); color: #06210f; }
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(231, 76, 60, 0.12); }
.btn-ghost { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #2a3a4f; }

/* List header */
.list-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.list-title-wrap { display: flex; align-items: center; gap: 12px; }
.list-title { margin: 0; font-size: 1.4rem; }
.list-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.progress-pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

/* Add-item form */
.add-item {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
.qty-field { width: 80px; flex: 0 0 auto; }
.qty-field input { text-align: center; }
.add-btn { flex: 0 0 auto; }

/* Item list */
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.item.ordered { opacity: 0.62; }
.item.ordered .item-name { text-decoration: line-through; }

.item-check { flex: 0 0 auto; }
.item-check input { width: 22px; height: 22px; cursor: pointer; accent-color: var(--success); }

.item-body { flex: 1 1 auto; min-width: 0; }
.item-name { font-weight: 600; word-break: break-word; }
.item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.item-link { color: var(--secondary); font-size: 0.82rem; text-decoration: none; word-break: break-all; }
.item-link:hover { text-decoration: underline; }
.qty-badge {
  font-size: 0.72rem; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 1px 8px; border-radius: 999px;
}
.ordered-badge {
  font-size: 0.72rem; color: var(--success); font-weight: 700;
}

.item-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #2a3a4f; }
.icon-btn.danger:hover { background: rgba(231, 76, 60, 0.16); border-color: var(--danger); }

.empty-state { text-align: center; color: var(--muted); padding: 18px; }

/* Share banner */
.share-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #1d3050, #15233a);
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  padding: 14px 18px; margin-top: 22px;
}
.share-banner-actions { display: flex; gap: 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 18px 0; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #11305c; color: #fff; border: 1px solid var(--secondary);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow);
  z-index: 50; font-weight: 600; font-size: 0.9rem;
}
.toast.success { background: #15422a; border-color: var(--success); }
.toast.error { background: #4a1f1a; border-color: var(--danger); }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 640px) {
  .brand { font-size: 1.5rem; }
  .add-item { flex-direction: column; align-items: stretch; }
  .qty-field { width: 100%; }
  .add-btn { width: 100%; }
  .item { flex-wrap: wrap; }
  .item-actions { width: 100%; justify-content: flex-end; }
  .row { flex-direction: column; }
}
