:root {
  --bg-start: #e8eef8;
  --bg-end:   #d2dff2;
  --panel:        transparent;
  --panel-strong: transparent;
  --text:   #0a1929;
  --muted:  #4a6080;
  --border: rgba(6, 55, 123, 0.12);
  --accent: #06377b;
  --accent-dark: #042d68;
  --success: #1b6b3a;
  --danger:  #b91c1c;
  --shadow:  0 24px 70px rgba(6, 55, 123, 0.12);
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --bg-start: #060e1a;
  --bg-end:   #0b1628;
  --panel:        transparent;
  --panel-strong: transparent;
  --text:   #e8f0ff;
  --muted:  #7a9cc4;
  --border: rgba(100, 150, 220, 0.14);
  --accent: #5b8fd4;
  --accent-dark: #4a7ec8;
  --success: #3aad70;
  --danger:  #e05555;
  --shadow:  0 24px 70px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 28%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
}

.page-shell {
  display: grid;
  place-items: center;
  padding: 64px 18px 32px;
}

.panel-grid {
  width: 100%;
  box-sizing: border-box;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.panel-grid-single {
  grid-template-columns: minmax(280px, 560px);
}

.brand-panel,
.form-panel {
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.brand-panel {
  padding: 40px;
  background: transparent;
}

.form-panel {
  padding: 36px;
  background: var(--panel-strong);
}

.account-panel {
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
}

h3 {
  font-size: 1.05rem;
  line-height: 1.3;
}

.lede {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field span {
  font-size: 0.92rem;
}

.field input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(6, 55, 123, 0.18);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: 2px solid rgba(6, 55, 123, 0.3);
  border-color: rgba(6, 55, 123, 0.5);
}

button,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button {
  color: #ffffff;
  background: var(--accent);
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
}

button:focus-visible,
.secondary-action:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.secondary-action {
  color: var(--accent);
  background: rgba(6, 55, 123, 0.08);
}

.secondary-action:hover {
  background: rgba(6, 55, 123, 0.13);
}

.account-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.account-actions + .account-actions {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-footer {
  margin: 20px 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.form-footer a {
  color: var(--accent);
  text-decoration: underline;
}

.form-message {
  margin: 2px 0 0;
  min-height: 1.4rem;
  color: var(--danger);
  font-weight: 600;
}

.form-message[data-state="success"] {
  color: var(--success);
}

/* ── Checkbox field ─────────────────────────────────────────────────────────── */

.field-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Data tables ────────────────────────────────────────────────────────────── */

.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 12px;
  text-align: left;
}

.data-table th {
  padding: 6px 10px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

.data-table .revoke-btn {
  min-height: unset;
  padding: 4px 12px;
  font-size: 0.82rem;
}

/* ── Task list ──────────────────────────────────────────────────────────────── */

.task-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.task-check {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}

.task-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-title {
  flex: 1;
  line-height: 1.4;
}

.task-item--done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task-delete-btn {
  min-height: unset;
  padding: 4px 10px;
  font-size: 0.82rem;
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
  flex-shrink: 0;
}

.task-delete-btn:hover {
  background: rgba(185, 28, 28, 0.15);
}

/* ── Groceries ──────────────────────────────────────────────────────────────── */

.grocery-layout .notes-list-panel {
  min-height: 600px;
}

.grocery-detail-panel {
  min-height: 500px;
}

.grocery-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.grocery-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.grocery-section-label {
  margin: 12px 0 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.grocery-section-label--secondary {
  color: var(--muted);
}

.grocery-add-section {
  margin-bottom: 14px;
}

.grocery-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.grocery-add-row input[type="text"],
.grocery-add-row input[type="number"] {
  flex: 1;
  min-width: 80px;
  padding: 10px 12px;
  border: 1px solid rgba(6, 55, 123, 0.18);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.grocery-add-row input:focus {
  outline: 2px solid rgba(6, 55, 123, 0.3);
  border-color: rgba(6, 55, 123, 0.5);
}

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

.grocery-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.grocery-check-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.grocery-check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.grocery-cart-icon {
  font-size: 0.88rem;
}

.grocery-item-name {
  flex: 1;
  font-weight: 500;
}

.grocery-item--have {
  text-decoration: line-through;
  color: var(--muted);
}

.grocery-item--in-cart {
  color: var(--success);
  font-weight: 600;
}

.grocery-item-qty {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.grocery-delete-btn {
  min-height: unset;
  padding: 3px 9px;
  font-size: 0.8rem;
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
  flex-shrink: 0;
}

.grocery-delete-btn:hover {
  background: rgba(185, 28, 28, 0.15);
}

.grocery-catalog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.grocery-catalog-name {
  flex: 1;
  font-weight: 500;
}

.grocery-catalog-unit {
  font-size: 0.85rem;
  color: var(--muted);
}

.grocery-shared-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(6, 55, 123, 0.1);
  color: var(--accent);
  border-radius: 5px;
  padding: 1px 6px;
  vertical-align: middle;
}

.grocery-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.grocery-share-row span {
  flex: 1;
}

/* ── Events ─────────────────────────────────────────────────────────────────── */

.event-form-fields {
  display: grid;
  gap: 16px;
  margin-bottom: 4px;
}

.field-optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.88rem;
}

.event-section-label {
  margin: 16px 0 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.event-section-label--past {
  color: var(--muted);
}

.event-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 8px;
}

.event-item:hover {
  background: rgba(6, 55, 123, 0.06);
}

.event-item--active {
  border-color: var(--accent);
  background: rgba(6, 55, 123, 0.08);
}

.event-item--past {
  opacity: 0.65;
}

.event-item-title {
  font-weight: 600;
  line-height: 1.3;
}

.event-item-date {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Notes ──────────────────────────────────────────────────────────────────── */

.notes-grid {
  align-items: start;
}

.notes-list-panel {
  display: flex;
  flex-direction: column;
  min-height: 500px;
}

.note-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.note-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: background 0.12s;
}

.note-item:hover {
  background: rgba(6, 55, 123, 0.06);
}

.note-item--active {
  border-color: var(--accent);
  background: rgba(6, 55, 123, 0.08);
}

.note-item-title {
  font-weight: 600;
  line-height: 1.3;
}

.note-item-date {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

.trash-item-icon {
  margin-right: 5px;
}

.trash-item-type {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
  background: var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.trash-item-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notes-body-field textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(6, 55, 123, 0.18);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
  min-height: 200px;
}

.notes-body-field textarea:focus {
  outline: 2px solid rgba(6, 55, 123, 0.3);
  border-color: rgba(6, 55, 123, 0.5);
}

.editor-empty-state {
  margin-top: 28px;
}

.danger-button {
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
}

.danger-button:hover {
  background: rgba(185, 28, 28, 0.15);
}

/* ── Game grid ──────────────────────────────────────────────────────────────── */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.game-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.12s;
}

.game-card:hover {
  box-shadow: 0 6px 24px rgba(6, 55, 123, 0.12);
}

.game-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.game-thumbnail--placeholder {
  background: linear-gradient(135deg, rgba(6, 55, 123, 0.1), rgba(6, 55, 123, 0.04));
}

.game-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.game-card-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}

.game-card-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.game-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  margin-top: auto;
  align-self: flex-start;
}

.game-play-btn:hover {
  filter: brightness(1.1);
}

.game-play-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ── Download list ───────────────────────────────────────────────────────────── */

.download-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.download-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.download-item-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}

.download-item-body {
  flex: 1;
  min-width: 0;
}

.download-item-name {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 0.95rem;
}

.download-item-meta {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.download-item-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.download-item-notes {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.download-item-notes summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

.download-item-notes p {
  margin: 6px 0 0;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .download-item {
    flex-wrap: wrap;
  }

  .download-item .game-play-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Preferences bar (theme + language) ─────────────────────────────────────── */

.prefs-bar {
  position: fixed;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

.prefs-bar button {
  min-height: unset;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.prefs-bar button:hover {
  background: var(--panel);
}

.prefs-bar select {
  padding: 5px 28px 5px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2306377b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* ── Settings layout ────────────────────────────────────────────────────────── */

.settings-layout {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.settings-sidebar {
  display: flex;
  flex-direction: column;
}

.settings-nav {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.settings-nav-link {
  display: block;
  padding: 9px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.12s;
}

.settings-nav-link:hover {
  background: rgba(6, 55, 123, 0.06);
}

.settings-nav-link--active {
  background: rgba(6, 55, 123, 0.1);
  color: var(--accent);
}

.settings-sidebar .account-actions {
  margin-top: auto;
  padding-top: 24px;
}

/* ── Admin panel ────────────────────────────────────────────────────────────── */

.admin-item-form {
  padding: 20px;
  background: rgba(6, 55, 123, 0.04);
  border-radius: 10px;
  margin-bottom: 24px;
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.admin-checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.admin-checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Responsive: 760px ──────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .notes-grid {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .form-panel {
    padding: 28px;
  }

  h1 {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }
}

/* ── Responsive: 480px ──────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .page-shell {
    padding: 60px 12px 20px;
  }

  .brand-panel,
  .form-panel {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .note-item-date,
  .event-item-date {
    font-size: 0.76rem;
  }

  .prefs-bar {
    top: 8px;
    right: 10px;
    gap: 5px;
  }

  .prefs-bar button,
  .prefs-bar select {
    font-size: 0.75rem;
    padding: 4px 9px;
  }

  .grocery-add-row {
    flex-direction: column;
    align-items: stretch;
  }

  .grocery-add-row input,
  .grocery-add-row button {
    width: 100%;
  }

  .notes-body-field textarea {
    min-height: 140px;
  }
}

/* ── Authenticated page shell ────────────────────────────────────────────── */

.page-shell--app {
  display: block;
  padding-top: 76px; /* 60px nav + 16px gap */
  padding-bottom: 32px;
}

/* ── Site navigation (desktop top bar) ──────────────────────────────────── */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.site-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  margin-right: 32px;
  flex-shrink: 0;
}

.site-nav-logo {
  font-size: 1.2rem;
  line-height: 1;
}

.site-nav-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.site-nav-links {
  display: flex;
  align-items: stretch;
  gap: 4px;
  flex: 1;
  height: 100%;
}

.site-nav-link {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}

.site-nav-link:hover {
  color: var(--accent);
}

.site-nav-link--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.site-nav-search-btn {
  min-height: unset;
  padding: 5px 12px;
  background: rgba(6, 55, 123, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.site-nav-search-btn:hover {
  background: rgba(6, 55, 123, 0.12);
}

.site-nav-actions [data-theme-toggle] {
  min-height: unset;
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.site-nav-actions [data-theme-toggle]:hover {
  background: rgba(6, 55, 123, 0.06);
}

.site-nav-actions #lang-select {
  padding: 5px 28px 5px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2306377b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

:root[data-theme="dark"] .site-nav-actions #lang-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235b8fd4'/%3E%3C/svg%3E");
}

/* ── Nav avatar / dropdown ───────────────────────────────────────────────── */

.nav-avatar {
  position: relative;
}

.nav-avatar-btn {
  min-height: unset;
  padding: 5px 12px;
  background: rgba(6, 55, 123, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.nav-avatar-btn:hover {
  background: rgba(6, 55, 123, 0.12);
}

.nav-dropdown {
  position: fixed;
  top: 68px; /* 60px nav height + 8px gap */
  right: 24px;
  min-width: 160px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(6, 55, 123, 0.12);
  z-index: 300;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.nav-dropdown-item {
  display: block;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: unset;
  cursor: pointer;
  width: 100%;
}

.nav-dropdown-item:hover {
  background: rgba(6, 55, 123, 0.07);
  color: var(--accent);
}

/* ── Mobile tab bar ──────────────────────────────────────────────────────── */

.tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 100;
  background: var(--panel-strong);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  text-decoration: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  min-height: unset;
  transition: color 0.12s;
}

.tab-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.tab-item--active,
.tab-item--active .tab-icon {
  color: var(--accent);
}

/* ── App cards ───────────────────────────────────────────────────────────── */

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 112px;
  height: 112px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}

.app-card:hover {
  background: rgba(6, 55, 123, 0.06);
  border-color: rgba(6, 55, 123, 0.3);
}

.app-card-icon {
  font-size: 2rem;
  line-height: 1;
  margin-top: 20px;
  pointer-events: none;
}

.app-card-title {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  pointer-events: none;
}

.app-card-desc {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 6px 8px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.app-card:hover .app-card-desc {
  opacity: 1;
}

/* ── Card grid ───────────────────────────────────────────────────────────── */

.card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Feed section ────────────────────────────────────────────────────────── */

.feed-section {
  margin-bottom: 32px;
}

.feed-heading {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Home greeting ───────────────────────────────────────────────────────── */

.home-greeting {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 700;
  line-height: 1.2;
}

.home-date {
  margin: 0 0 32px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ── Home / Library main content area ───────────────────────────────────── */

.home-main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Filter pills ────────────────────────────────────────────────────────── */

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-pill {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: unset;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.filter-pill:hover {
  background: rgba(6, 55, 123, 0.07);
  border-color: rgba(6, 55, 123, 0.25);
}

.filter-pill--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-pill--active:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

/* ── Library grid ────────────────────────────────────────────────────────── */

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
}

/* ── Command palette ─────────────────────────────────────────────────────── */

.command-palette {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(6, 55, 123, 0.2);
  background: var(--panel-strong);
  max-width: 560px;
  width: calc(100vw - 32px);
  overflow: hidden;
  color: var(--text);
}

.command-palette::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.command-palette-input {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.command-palette-input::placeholder {
  color: var(--muted);
}

.command-palette-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 320px;
  overflow-y: auto;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.command-palette-item:hover,
.command-palette-item--active {
  background: rgba(6, 55, 123, 0.08);
  color: var(--accent);
}

.command-palette-item-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: var(--muted);
}

.command-palette-item--active .command-palette-item-icon {
  color: var(--accent);
}

.command-palette-empty {
  padding: 20px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ── Sign-in background ──────────────────────────────────────────────────── */

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-size: cover;
  background-position: center;
  filter: none;
  opacity: 1;
  pointer-events: none;
}

.page-shell > :not(.login-bg):not(.site-nav):not(.tab-bar) {
  position: relative;
  z-index: 2;
}

/* ── Responsive: 640px (mobile nav) ─────────────────────────────────────── */

@media (max-width: 640px) {
  .site-nav-links {
    display: none;
  }

  .tab-bar {
    display: flex;
  }

  .page-shell--app {
    padding-bottom: 72px;
  }

  .site-nav {
    padding: 0 16px;
  }

  .panel-grid {
    padding: 0 16px;
  }

  .site-nav-name {
    display: none;
  }
}
