:root {
  /* Bandlair — mörkt, varmt och återhållsamt. Oxblood används sparsamt som signaturaccent. */
  --surface-0: #0d0d0e;
  --surface-1: #151516;
  --surface-2: #1c1b1c;
  --surface-3: #242225;

  --text-primary: #f4f1e9;
  --text-secondary: #aaa49d;
  --text-muted: #77716c;

  --border: rgba(244, 241, 233, 0.07);
  --border-strong: rgba(244, 241, 233, 0.14);

  --accent: #8b1e28;
  --accent-hover: #a42632;
  --accent-bg: #2b1115;
  --accent-border: #6f1a23;
  --accent-text: #f4f1e9;

  --success: #b8d98f;
  --success-bg: #203515;
  --warning: #e6bd79;
  --warning-bg: #4a3213;
  --danger: #f0b5b8;
  --danger-bg: #4b171b;

  --radius: 9px;
  --radius-card: 14px;
  --sidebar-width: 17rem;
  --content-max: 96rem;

  --font-sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --overlay-text: #ffffff;

  --bs-body-bg: var(--surface-0);
  --bs-body-color: var(--text-primary);
  --bs-border-color: var(--border);
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-emphasis-color: var(--text-primary);
  --bs-link-color-rgb: 244, 241, 233;
  --bs-link-hover-color-rgb: 164, 38, 50;
  --bs-primary: var(--accent);
  --bs-primary-rgb: 139, 30, 40;
  --bs-primary-text-emphasis: #e4a4ab;
  --bs-primary-bg-subtle: var(--accent-bg);
  --bs-primary-border-subtle: var(--accent-border);
  --bs-focus-ring-color: rgba(139, 30, 40, .28);
  --bs-form-valid-color: var(--success);
  --bs-form-valid-border-color: var(--success);
}

[data-theme="light"] {
  --surface-0: #f7f6f3;
  --surface-1: #f2f1ec;
  --surface-2: #ffffff;

  --text-primary: #1f1f1d;
  --text-secondary: #5f5e5a;
  --text-muted: #8a8983;

  --border: rgba(31, 31, 29, 0.10);
  --border-strong: rgba(31, 31, 29, 0.18);

  --accent: #8b1e28;
  --accent-bg: #f5e7e9;
  --accent-border: #c98b92;
  /* Accenten är mörk i ljust läge — vit text funkar här. */
  --accent-text: #ffffff;

  --success: #3b6d11;
  --success-bg: #eaf3de;
  --warning: #854f0b;
  --warning-bg: #faeeda;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;

  --bs-link-color-rgb: 31, 31, 29;
  --bs-link-hover-color-rgb: 139, 30, 40;
  --bs-primary: var(--accent);
  --bs-primary-rgb: 139, 30, 40;
  --bs-primary-text-emphasis: #6f1720;
  --bs-primary-bg-subtle: var(--accent-bg);
  --bs-primary-border-subtle: var(--accent-border);
  --bs-focus-ring-color: rgba(139, 30, 40, .18);
}

body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
}

h1 { font-size: 22px; font-weight: 500; margin: 0 0 1rem; }
h2 { font-size: 18px; font-weight: 500; margin: 0 0 .75rem; }
h3 { font-size: 16px; font-weight: 500; margin: 0 0 .5rem; }

.card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
}

.card-accent { border-color: var(--accent-border); }

.section-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--border);
}
.row:last-child { border-bottom: none; }

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

.btn {
  font-size: 13px;
  font-weight: 400;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.btn:hover { background: var(--surface-1); }
.btn:active { transform: scale(0.98); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--surface-1);
  border-top: 0.5px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.tabbar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
}
.tabbar a i { font-size: 22px; }
.tabbar a.active { color: var(--accent); }

.tabbar-icon-wrap {
  position: relative;
  display: inline-flex;
}
.tabbar-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--danger);
  color: var(--surface-0);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
  min-width: 14px;
  text-align: center;
}

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 199;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface-2);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  z-index: 200;
}
.sheet-grip {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 0 auto 16px;
}
.sheet-title {
  margin: 0 0 6px;
}
.sheet-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 18px;
}
.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}
.sheet-btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.sheet-btn-primary {
  background: var(--accent-bg);
  color: var(--accent);
}
.sheet-btn-cancel {
  background: var(--surface-1);
  color: var(--text-primary);
}
.sheet-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.saved-flash {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 0.3rem 0 0;
}

.emoji-sheet {
  max-height: 70vh;
  overflow-y: auto;
}
.emoji-sheet-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.emoji-sheet-input-row input { flex: 1; }
.emoji-sheet-category {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 6px;
}
.emoji-sheet-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}
.emoji-sheet-option {
  border: none;
  background: none;
  font-size: 1.4rem;
  padding: 0.3rem;
  border-radius: var(--radius);
  line-height: 1;
}
.emoji-sheet-option:hover {
  background: var(--surface-1);
}


/* Mobile navigation: five primary destinations. */
.tabbar a { min-width: 0; }
.tabbar a.active { color: var(--text-primary); }
.tabbar a.active i { color: #d88e96; }
.tabbar a.active span:last-child { color: #d88e96; }

@media (min-width: 1024px) {
  .tabbar { display: none !important; }

  /* Shared mobile bottom sheets become compact desktop dialogs. */
  .sheet-backdrop { z-index: 299; }
  .sheet {
    left: 50%;
    right: auto;
    bottom: 50%;
    width: min(34rem, calc(100vw - 4rem));
    transform: translate(-50%, 50%);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 1.5rem;
    z-index: 300;
    box-shadow: 0 24px 80px rgba(0,0,0,.45);
  }
  .sheet-grip { display: none; }
}
