/* =========================================================================
   Konsi — Addams household aesthetic
   Dark, gothic, vaguely Victorian. Cream + brass on bruised purple-black.
   Functional first; quirk is in the copy.
   ========================================================================= */

:root {
  --bg:           #15101c;   /* deep velvet, almost black */
  --bg-elevated:  #1f1828;   /* parlour wallpaper */
  --card:         #261c33;   /* tarnished surface */
  --card-hover:   #2f2440;
  --border:       #3a2d48;   /* ornate frame */
  --border-strong:#52415f;

  --ink:          #ece2cc;   /* aged parchment */
  --ink-muted:    #a89aa6;   /* dusty mauve */
  --ink-faint:    #6c5d72;   /* candlewax shadow */

  --brass:        #c9a96e;   /* aged gold accent */
  --brass-dark:   #8c7340;
  --crimson:      #8b1a2b;   /* claret */
  --crimson-glow: #c4304a;
  --moss:         #6d8c5d;   /* greenhouse */
  --bone:         #d9cdb4;

  --shadow:       0 8px 24px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-soft:  0 2px 10px rgba(0, 0, 0, 0.4);

  --radius:       4px;       /* sharp, gothic */
  --radius-lg:    6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at top, rgba(70, 32, 90, 0.35), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(20, 8, 30, 0.6), transparent 70%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "EB Garamond", "Garamond", "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--crimson); color: var(--bone); }

a {
  color: var(--brass);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: border-color 120ms;
}
a:hover { border-bottom-color: var(--brass); }

button { font: inherit; cursor: pointer; }

/* Header ----------------------------------------------------------------- */

.app-header {
  background: linear-gradient(180deg, #221730 0%, #1a1325 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header a, .app-header a:visited { color: var(--brass); border-bottom: 0; }
.app-header h1 {
  font-family: "Cormorant Garamond", "Playfair Display", "EB Garamond", serif;
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bone);
}
.app-header .tagline {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-style: italic;
  font-family: "EB Garamond", serif;
  margin-top: 2px;
}
.app-header .back {
  font-size: 1.5rem;
  line-height: 1;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--brass);
}
.app-header .back:hover { background: rgba(201, 169, 110, 0.1); }
.app-header .header-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 6px rgba(201, 169, 110, 0.4));
}
.app-header .spacer { flex: 1; }
.app-header .new-btn {
  background: transparent;
  border: 1px solid var(--brass-dark);
  color: var(--brass);
  font-size: 1.3rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.app-header .new-btn:hover {
  background: var(--brass);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(201, 169, 110, 0.4);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Tabs ------------------------------------------------------------------- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #1a1325 0%, var(--bg) 100%);
  position: sticky;
  top: 67px;
  z-index: 9;
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  color: var(--ink-muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  border-bottom-style: solid;
}
.tabs a:hover { color: var(--ink); border-bottom-color: var(--border-strong); }
.tabs a.active {
  color: var(--brass);
  border-bottom-color: var(--brass);
}

/* List cards ------------------------------------------------------------- */

.list-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}
.list-card::before {
  /* tarnished gold corner accent */
  content: "";
  position: absolute;
  top: 6px; left: 6px;
  width: 14px; height: 14px;
  border-top: 1px solid var(--brass-dark);
  border-left: 1px solid var(--brass-dark);
  opacity: 0.6;
  pointer-events: none;
}
.list-card::after {
  content: "";
  position: absolute;
  bottom: 6px; right: 6px;
  width: 14px; height: 14px;
  border-bottom: 1px solid var(--brass-dark);
  border-right: 1px solid var(--brass-dark);
  opacity: 0.6;
  pointer-events: none;
}
.list-card .drag-handle {
  cursor: grab;
  user-select: none;
  color: var(--ink-faint);
  padding: 4px 2px;
  font-size: 1.1rem;
  letter-spacing: -2px;
}
.list-card .drag-handle:hover { color: var(--brass); }
.list-card .icon {
  background: radial-gradient(circle at 30% 30%, #3a2c4d, #1f1530);
  border: 1px solid var(--brass-dark);
  color: var(--brass);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px rgba(201, 169, 110, 0.25));
}
.list-card .body { flex: 1; min-width: 0; }
.list-card .title {
  font-family: "Cormorant Garamond", serif;
  color: var(--bone);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  display: block;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 0;
}
.list-card .title:hover { color: var(--brass); border-bottom: 0; }
.list-card .preview {
  color: var(--ink);
  font-size: 0.95rem;
  white-space: pre-line;
  font-style: italic;
}
.list-card .more {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin-top: 6px;
  font-style: italic;
}
.list-card .menu { position: relative; }
.list-card .menu-toggle {
  background: none;
  border: 0;
  color: var(--ink-muted);
  font-size: 1.3rem;
  padding: 6px 10px;
  border-radius: var(--radius);
  letter-spacing: 0;
}
.list-card .menu-toggle:hover { color: var(--brass); background: rgba(201, 169, 110, 0.08); }
.list-card .menu-items {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  min-width: 160px;
  z-index: 5;
  margin-top: 4px;
}
.list-card .menu.open .menu-items { display: block; }
.list-card .menu-items button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
}
.list-card .menu-items button:hover { background: var(--card-hover); color: var(--brass); }
.list-card .menu-items button.danger { color: var(--crimson-glow); }
.list-card .menu-items button.danger:hover { background: var(--crimson); color: var(--bone); }

/* Add-item bar ----------------------------------------------------------- */

.add-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}
.add-bar form { display: flex; gap: 10px; align-items: center; }
.add-bar input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font-size: 1.05rem;
  padding: 6px 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
}
.add-bar input[type="text"]::placeholder { color: var(--ink-faint); font-style: italic; }
.add-bar .plus { color: var(--brass); font-size: 1.4rem; line-height: 1; }
.add-bar button {
  background: transparent;
  color: var(--brass);
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  padding: 7px 16px;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.add-bar button:hover { background: var(--brass); color: var(--bg); }

/* Item rows -------------------------------------------------------------- */

.items {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
}
.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: rgba(201, 169, 110, 0.04); }

.item-row .drag-handle {
  cursor: grab;
  color: var(--ink-faint);
  user-select: none;
  font-size: 1rem;
  padding: 0 4px;
  letter-spacing: -2px;
}
.item-row .drag-handle:hover { color: var(--brass); }

.item-row .check {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--brass-dark);
  border-radius: 2px;
  background: var(--bg-elevated);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bone);
  font-size: 0.95rem;
  line-height: 1;
  transition: all 120ms;
}
.item-row .check:hover { border-color: var(--brass); box-shadow: 0 0 6px rgba(201, 169, 110, 0.3); }
.item-row.checked .drag-handle { visibility: hidden; }
.item-row.checked .check {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--bg);
}
.item-row.checked .check::after { content: "✓"; font-weight: bold; }

.item-row .text {
  flex: 1;
  min-width: 0;
  cursor: text;
  word-break: break-word;
  font-size: 1.05rem;
  color: var(--ink);
}
.item-row.checked .text {
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
  color: var(--ink-faint);
  font-style: italic;
}

.item-row .delete {
  background: none;
  border: 0;
  color: var(--ink-faint);
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 150ms, color 120ms;
}
.item-row:hover .delete,
.item-row:focus-within .delete { opacity: 1; }
.item-row .delete:hover { color: var(--crimson-glow); background: rgba(139, 26, 43, 0.15); }

.item-row form.inline-edit { flex: 1; display: flex; gap: 8px; }
.item-row form.inline-edit input {
  flex: 1;
  font-size: 1.05rem;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg-elevated);
  color: var(--ink);
  font-family: inherit;
}
.item-row form.inline-edit input:focus { border-color: var(--brass); box-shadow: 0 0 6px rgba(201, 169, 110, 0.25); }
.item-row form.inline-edit button {
  background: transparent;
  border: 1px solid var(--brass-dark);
  color: var(--brass);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.item-row form.inline-edit button:hover { background: var(--brass); color: var(--bg); }

.sortable-ghost { opacity: 0.35; }
.sortable-chosen { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6); background: var(--card-hover); }

/* Pull-to-refresh indicator (PWA only) ----------------------------------- */

.ptr {
  position: fixed;
  top: 0;
  left: 50%;
  margin-left: -22px;
  transform: translateY(-64px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--brass-dark);
  color: var(--brass);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}
.ptr.active { display: flex; }
.ptr-glyph {
  font-size: 1.3rem;
  line-height: 1;
  display: inline-block;
  transition: transform 200ms;
}
.ptr.pull .ptr-glyph { transform: rotate(180deg); }
.ptr.spin .ptr-glyph {
  animation: ptr-spin 0.9s linear infinite;
  transition: none;
}
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* Bulk actions ----------------------------------------------------------- */

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.bulk-actions button {
  background: transparent;
  color: var(--brass);
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  padding: 7px 16px;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.bulk-actions button:hover { background: var(--brass); color: var(--bg); }
.bulk-actions button.danger {
  color: var(--crimson-glow);
  border-color: var(--crimson);
}
.bulk-actions button.danger:hover {
  background: var(--crimson);
  color: var(--bone);
}

/* Empty state ------------------------------------------------------------ */

.empty {
  text-align: center;
  color: var(--ink-faint);
  padding: 60px 20px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}
.empty::before {
  content: "❦";
  display: block;
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--brass-dark);
}

/* Toasts ----------------------------------------------------------------- */

#toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 100;
  width: min(95vw, 500px);
}
.toast {
  background: linear-gradient(180deg, #2a1f3a 0%, #1d1428 100%);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(201, 169, 110, 0.1) inset;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.05rem;
  animation: toast-in 0.25s ease-out, toast-out 0.5s ease-in 5.6s forwards;
}
.toast .msg { flex: 1; color: var(--bone); }
.toast button {
  background: transparent;
  border: 1px solid var(--brass-dark);
  color: var(--brass);
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: var(--radius);
}
.toast button:hover { background: var(--brass); color: var(--bg); }
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(20px); }
}

/* New-list form ---------------------------------------------------------- */

.new-list-form {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.new-list-form input[type="text"] {
  font-size: 1.1rem;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg-elevated);
  color: var(--ink);
  font-family: inherit;
}
.new-list-form input[type="text"]:focus { border-color: var(--brass); box-shadow: 0 0 8px rgba(201, 169, 110, 0.25); }
.new-list-form input[type="text"]::placeholder { color: var(--ink-faint); font-style: italic; }
.new-list-form .row { display: flex; gap: 12px; align-items: center; }
.new-list-form label { color: var(--ink); cursor: pointer; }
.new-list-form input[type="radio"] { accent-color: var(--brass); margin-right: 4px; }
.new-list-form button {
  background: transparent;
  color: var(--brass);
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  padding: 9px 18px;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.9rem;
}
.new-list-form button:hover { background: var(--brass); color: var(--bg); }
.new-list-form button.cancel {
  border-color: var(--border-strong);
  color: var(--ink-muted);
}
.new-list-form button.cancel:hover { background: var(--card-hover); color: var(--ink); border-color: var(--ink-muted); }

/* Sort toggle ------------------------------------------------------------ */

.sort-toggle-bar {
  display: flex;
  justify-content: flex-end;
  margin: -8px 2px 14px;
}

.sort-segments {
  display: inline-flex;
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  overflow: hidden;
}
.sort-segments .seg {
  background: transparent;
  color: var(--ink-muted);
  border: 0;
  padding: 6px 14px;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.sort-segments .seg + .seg {
  border-left: 1px solid var(--brass-dark);
}
.sort-segments .seg:hover { color: var(--brass); }
.sort-segments .seg.on {
  background: var(--brass);
  color: var(--bg);
  cursor: default;
}
.sort-segments .seg.on:hover { color: var(--bg); }

/* Aisle groups ----------------------------------------------------------- */

.aisle-group {
  border-bottom: 1px solid var(--border);
}
.aisle-group:last-child { border-bottom: 0; }
.aisle-header {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--brass);
  padding: 14px 16px 6px;
  border-bottom: 1px dotted var(--border-strong);
  background: linear-gradient(180deg, rgba(201, 169, 110, 0.05), transparent);
}
.aisle-header-hint {
  font-style: italic;
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-transform: none;
  letter-spacing: 0.05em;
  margin-left: 6px;
}

/* When aisle mode is active, item rows lose their bottom border because
   the group already separates them visually. */
.aisle-group .item-row { border-bottom: 1px solid rgba(58, 45, 72, 0.5); }
.aisle-group .item-row:last-child { border-bottom: 0; }

/* Item body (text + optional aisle picker stacked) ----------------------- */

.item-row .item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Tag handle — replaces the drag handle slot when aisles are visible.
   The native <select> is layered transparently over the tag icon so that
   tapping the icon opens the system's aisle picker. */
.item-row .aisle-handle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.item-row .aisle-icon {
  font-size: 1.15rem;
  line-height: 1;
  filter: grayscale(0.3) opacity(0.75);
  pointer-events: none;
}
.item-row .aisle-handle:hover .aisle-icon { filter: none; }
.item-row .aisle-handle .aisle-picker {
  position: absolute;
  inset: 0;
  margin: 0;
}
.item-row .aisle-handle .aisle-picker select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}
.item-row .aisle-handle .aisle-picker select option {
  background: var(--bg-elevated);
  color: var(--ink);
  font-style: normal;
}
/* Subtle scrollbar themed for webkit/firefox */
* { scrollbar-color: var(--brass-dark) var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--brass-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brass); }

/* Offline overlay -------------------------------------------------------- */

.net-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--brass-dark);
  color: var(--brass);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  padding: 7px 20px;
  text-align: center;
}
.net-banner.warn { color: var(--crimson-glow); border-bottom-color: var(--crimson); }

/* A row carrying changes that haven't reached the server yet. */
.item-row[data-pending="1"] { box-shadow: inset 3px 0 0 var(--brass-dark); }

.offline-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 20px 24px;
}
.offline-actions button {
  background: transparent;
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  color: var(--brass);
  font: inherit;
  padding: 8px 14px;
}
.offline-actions button:hover { background: var(--brass); color: var(--bg); }

/* Login ------------------------------------------------------------------ */

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 32px 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 26px 26px;
}
.login-card h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.login-card .login-tagline {
  margin: 0 0 8px;
  color: var(--ink-muted);
  font-style: italic;
  font-size: 0.95rem;
}
.login-card label {
  color: var(--ink-muted);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}
.login-card input:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 8px rgba(201, 169, 110, 0.25);
}
.login-card button {
  margin-top: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  color: var(--brass);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  padding: 10px 14px;
  transition: background 120ms, color 120ms;
}
.login-card button:hover { background: var(--brass); color: var(--bg); }
.login-error {
  margin: 0;
  color: var(--crimson-glow);
  font-style: italic;
}

/* Logout — sits beside the theme toggle at the foot of every page. */
.footer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 20px 32px;
}
.footer-controls .theme-switcher { padding: 0; }
.logout-form { display: flex; }
.logout-form button {
  background: transparent;
  border: 1px solid var(--brass-dark);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 7px 14px;
  transition: color 120ms, border-color 120ms;
}
.logout-form button:hover { color: var(--brass); border-color: var(--brass); }

/* Theme switcher --------------------------------------------------------- */

.theme-switcher {
  display: flex;
  justify-content: center;
  padding: 8px 20px 32px;
}
.theme-switcher .theme-toggle {
  position: relative;
  box-sizing: border-box;
  width: 64px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--brass-dark);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.theme-switcher .theme-knob {
  position: absolute;
  top: 50%;
  left: 35px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brass);
  color: var(--bg);
  font-size: 1rem;
  line-height: 1;
  transition: left 0.2s ease;
}
.theme-switcher .theme-knob svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.theme-switcher .icon-sun { display: none; }
/* Bright theme: knob slides left, swaps moon for sun. */
[data-theme="bright"] .theme-switcher .theme-knob { left: 3px; }
[data-theme="bright"] .theme-switcher .icon-moon { display: none; }
[data-theme="bright"] .theme-switcher .icon-sun { display: block; }

/* =========================================================================
   Bright theme — sans-serif, dark-on-light, larger type for supermarket
   readability in daylight. Toggle via data-theme="bright" on <html>.
   ========================================================================= */

[data-theme="bright"] {
  --bg:           #f6f2e8;
  --bg-elevated:  #ffffff;
  --card:         #ffffff;
  --card-hover:   #f1ecdf;
  --border:       #d2cab4;
  --border-strong:#9a907a;

  --ink:          #161310;
  --ink-muted:    #4a4338;
  --ink-faint:    #7a7160;

  --brass:        #6b4f1f;
  --brass-dark:   #4a3614;
  --crimson:      #a8243a;
  --crimson-glow: #8b1a2b;
  --moss:         #4d6b3d;
  --bone:         #161310;

  --shadow:       0 4px 14px rgba(60, 45, 15, 0.10), 0 1px 0 rgba(0,0,0,0.03) inset;
  --shadow-soft:  0 2px 6px rgba(60, 45, 15, 0.08);
}

[data-theme="bright"] body {
  background-image:
    radial-gradient(ellipse at top, rgba(255, 247, 220, 0.7), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(240, 230, 205, 0.5), transparent 70%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
}

/* Force sans-serif on every element that hard-coded a serif family */
[data-theme="bright"] .app-header h1,
[data-theme="bright"] .app-header .tagline,
[data-theme="bright"] .tabs a,
[data-theme="bright"] .list-card .title,
[data-theme="bright"] .add-bar button,
[data-theme="bright"] .item-row form.inline-edit button,
[data-theme="bright"] .bulk-actions button,
[data-theme="bright"] .new-list-form button,
[data-theme="bright"] .empty,
[data-theme="bright"] .toast,
[data-theme="bright"] .toast button,
[data-theme="bright"] .sort-segments .seg,
[data-theme="bright"] .aisle-header,
[data-theme="bright"] .theme-switcher .theme-toggle,
[data-theme="bright"] .login-card h1,
[data-theme="bright"] .login-card button,
[data-theme="bright"] .logout-form button,
[data-theme="bright"] .net-banner,
[data-theme="bright"] .offline-actions button { font-family: inherit; }
[data-theme="bright"] .login-card .login-tagline,
[data-theme="bright"] .login-error { font-style: normal; }

/* Header reads as a normal sans-serif title */
[data-theme="bright"] .app-header { background: linear-gradient(180deg, #fffaf0 0%, #f6f2e8 100%); }
[data-theme="bright"] .app-header h1 { font-weight: 600; font-size: 1.5rem; letter-spacing: 0; }
[data-theme="bright"] .app-header .tagline { font-style: normal; }

/* Tabs */
[data-theme="bright"] .tabs { background: linear-gradient(180deg, #fffaf0 0%, var(--bg) 100%); }
[data-theme="bright"] .tabs a { font-weight: 600; font-size: 0.85rem; letter-spacing: 0.18em; }

/* Bigger list items — the main readability ask */
[data-theme="bright"] .item-row { padding: 18px 18px; gap: 16px; }
[data-theme="bright"] .item-row .text { font-size: 1.2rem; line-height: 1.35; }
[data-theme="bright"] .item-row form.inline-edit input { font-size: 1.2rem; padding: 8px 12px; }
[data-theme="bright"] .item-row .check {
  width: 30px;
  height: 30px;
  border-width: 2px;
  border-radius: 4px;
  font-size: 1.15rem;
}
[data-theme="bright"] .item-row.checked .text { font-style: normal; }
[data-theme="bright"] .item-row .delete { font-size: 1.15rem; opacity: 1; color: var(--ink-faint); }

/* Card titles & previews */
[data-theme="bright"] .list-card .title { font-weight: 700; font-size: 1.4rem; letter-spacing: 0; }
[data-theme="bright"] .list-card .preview { font-style: normal; font-size: 1.05rem; color: var(--ink-muted); }
[data-theme="bright"] .list-card .more { font-style: normal; }
[data-theme="bright"] .list-card::before,
[data-theme="bright"] .list-card::after { opacity: 0.4; }
[data-theme="bright"] .list-card .icon {
  background: radial-gradient(circle at 30% 30%, #ffffff, #ece2c8);
  filter: none;
}

/* Add-bar */
[data-theme="bright"] .add-bar input[type="text"] { font-size: 1.2rem; }
[data-theme="bright"] .add-bar input[type="text"]::placeholder,
[data-theme="bright"] .new-list-form input[type="text"]::placeholder { font-style: normal; }
[data-theme="bright"] .add-bar button {
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 7px 12px;
  flex-shrink: 0;
}

/* Aisle headers */
[data-theme="bright"] .aisle-header { font-size: 1rem; letter-spacing: 0.18em; font-weight: 700; }
[data-theme="bright"] .aisle-header-hint { font-style: normal; font-size: 0.85rem; }

/* Empty state */
[data-theme="bright"] .empty { font-style: normal; font-size: 1.25rem; }

/* Toasts */
[data-theme="bright"] .toast {
  background: linear-gradient(180deg, #ffffff 0%, #f6f2e8 100%);
  font-style: normal;
  font-size: 1.05rem;
}

/* When the brass becomes the button background, ensure text is white
   rather than the (now-light) page background. */
[data-theme="bright"] .app-header .new-btn:hover,
[data-theme="bright"] .add-bar button:hover,
[data-theme="bright"] .bulk-actions button:hover,
[data-theme="bright"] .new-list-form button:hover,
[data-theme="bright"] .item-row form.inline-edit button:hover,
[data-theme="bright"] .toast button:hover,
[data-theme="bright"] .sort-segments .seg.on,
[data-theme="bright"] .item-row.checked .check { color: #ffffff; }
