/* ── Variables ── */
:root {
  --bg:          #09090f;
  --bg-elevated: #0f0f1a;
  --bg-card:     #14142a; /* slightly blue-tinted dark */
  --bg-hover:    #1a1a30;
  --border:      rgba(255,255,255,0.07);
  --accent:      #6366f1;
  --accent-dim:  rgba(99,102,241,0.15);
  --accent-h:    #818cf8;
  --cyan:        #22d3ee;
  --green:       #10b981;
  --red:         #ef4444;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --sidebar-w:   220px;
  --topbar-h:    60px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 32px rgba(0,0,0,0.5);
  --transition:  0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* ── Layout ── */
.app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
/* Collapse button — top-right of sidebar */
.sidebar-collapse-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Reveal tab — left edge, visible only when collapsed */
.sidebar-reveal-btn {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 18px;
  height: 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 101;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.sidebar-reveal-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Collapsed state */
body.sidebar-collapsed .sidebar          { transform: translateX(calc(-1 * var(--sidebar-w))); }
body.sidebar-collapsed .main             { margin-left: 0; }
body.sidebar-collapsed .sidebar-reveal-btn { opacity: 1; pointer-events: all; }

/* Smooth main content shift */
.main { transition: margin-left var(--transition); }

.sidebar-logo {
  position: relative;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-logo img {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(99,102,241,0.25));
}
.sidebar-logo span {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff 0%, var(--accent-h) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem 0.3rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent-h);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.user-card:hover { background: var(--bg-hover); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.user-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-h);
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  margin-top: 0.4rem;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: all var(--transition);
}
.logout-btn:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ── Main Content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.page-content { padding: 1.75rem; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-sm { padding: 1rem 1.25rem; }
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-icon { padding: 0.45rem; border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--bg-hover); }

/* ── Grid ── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }

/* ── Stat cards ── */
.stat-card { display: flex; flex-direction: column; gap: 0.5rem; }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.25rem;
}
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-dim); }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-accent { background: var(--accent-dim); color: var(--accent-h); }
.badge-green { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -30%; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow), 0 0 0 1px rgba(99,102,241,0.08);
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 120px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(99,102,241,0.3));
}
.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: #fff;
  color: #1f1f1f;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.btn-google:hover {
  background: #f8f8f8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.btn-google img { width: 20px; height: 20px; }
.login-footer { margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-muted); }
.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: var(--red);
  margin-bottom: 1rem;
}

/* ── Dashboard ── */
.welcome-banner {
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(34,211,238,0.08) 100%);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.welcome-text h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.25rem; }
.welcome-text p { font-size: 0.875rem; color: var(--text-dim); }
.welcome-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

/* ── Sheets Page ── */
.sheets-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.sheet-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 0.5rem;
}
.sheet-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.sheet-icon {
  width: 40px; height: 40px;
  background: rgba(16,185,129,0.15);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sheet-info { flex: 1; overflow: hidden; }
.sheet-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.15rem; }
.sheet-url { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-embed-container {
  width: 100%;
  height: calc(100vh - 220px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}
.sheet-embed-container iframe { width: 100%; height: 100%; border: none; }

/* ── Calendar ── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.calendar-month { font-size: 1.2rem; font-weight: 700; }
.calendar-grid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.calendar-day-name {
  text-align: center;
  padding: 0.75rem 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.calendar-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-cell {
  min-height: 100px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  transition: background var(--transition);
  cursor: pointer;
}
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell:hover { background: var(--bg-hover); }
.calendar-cell.other-month { opacity: 0.35; }
.calendar-cell.today .cell-date {
  background: var(--accent);
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cell-date { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.cell-event {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-body { display: flex; flex-direction: column; gap: 0.85rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.35rem; font-weight: 500; }
.modal-footer { display: flex; gap: 0.65rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ── Email Page ── */
.email-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  gap: 1rem;
}
.email-coming-soon svg { opacity: 0.25; }
.email-coming-soon h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-dim); }
.email-coming-soon p { font-size: 0.875rem; color: var(--text-muted); max-width: 360px; line-height: 1.6; }
.setup-steps {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 520px;
  text-align: left;
}
.setup-step {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.setup-step:last-child { border-bottom: none; }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent-h);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-text { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; }
.step-text strong { color: var(--text); display: block; margin-bottom: 0.15rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Utility ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ── Hamburger button ── */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  transition: background var(--transition);
  flex-shrink: 0;
  margin-right: 0.5rem;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* ── Sidebar backdrop ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Scrollable table wrapper ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ════════════════════════════════════ */

/* ── Large tablet / half-screen desktop (≤ 1024px) ── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Sidebar collapses (≤ 960px) ── */
@media (max-width: 960px) {
  /* Show hamburger, hide desktop collapse controls */
  .menu-toggle { display: flex; }
  .sidebar-collapse-btn { display: none; }
  .sidebar-reveal-btn   { display: none; }
  body.sidebar-collapsed .main { margin-left: 0; }

  /* Sidebar slides off-screen */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.6);
  }
  .sidebar-backdrop { display: block; }

  /* Main fills full width */
  .main { margin-left: 0; }
  .topbar { padding: 0 1.25rem; }
  .page-content { padding: 1.25rem; }

  /* Grids */
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Calendar cells slightly smaller */
  .calendar-cell { min-height: 80px; }

  /* Sheet embed shorter */
  .sheet-embed-container { height: calc(100vh - 180px); }
}

/* ── Tablet (≤ 768px) ── */
@media (max-width: 768px) {
  .page-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .topbar-title { font-size: 1rem; }

  /* Stack dashboard grids */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }

  /* Welcome banner stacks */
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.25rem;
  }
  .welcome-avatar { width: 44px; height: 44px; }

  /* Calendar cells compact */
  .calendar-cell { min-height: 64px; padding: 0.3rem; }
  .calendar-day-name { padding: 0.5rem 0; font-size: 0.65rem; }
  .cell-date { font-size: 0.75rem; width: 22px; height: 22px; }
  .calendar-month { font-size: 1rem; }

  /* Modal fills more of the screen */
  .modal {
    max-width: calc(100vw - 2rem);
    padding: 1.25rem;
    border-radius: 12px;
  }
  .modal-overlay { align-items: flex-end; padding-bottom: 0; }
  .modal { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .modal-overlay.open .modal { transform: translateY(0); }

  /* Sheets toolbar wraps */
  .sheets-toolbar { flex-wrap: wrap; }
}

/* ── Mobile (≤ 640px) ── */
@media (max-width: 640px) {
  html { font-size: 14px; }

  .page-content { padding: 0.875rem; }

  /* All grids go single column */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }

  /* Cards less padding */
  .card { padding: 1rem; }

  /* Calendar: abbreviate day names handled by JS, shrink cells */
  .calendar-cell { min-height: 52px; padding: 0.2rem 0.25rem; }
  .cell-event { display: none; } /* hide events, show count instead */
  .calendar-header { gap: 0.5rem; }
  .calendar-header .flex-center { gap: 0.25rem; }

  /* Stat cards horizontal on mobile */
  .stat-card {
    flex-direction: row;
    align-items: center;
    gap: 0.85rem;
  }
  .stat-icon { margin-bottom: 0; flex-shrink: 0; }
  .stat-value { font-size: 1.4rem; }

  /* Sheet card actions wrap */
  .sheet-card { flex-wrap: wrap; gap: 0.75rem; }
  .sheet-card .flex { width: 100%; justify-content: flex-end; }
  .sheet-embed-container { height: calc(100vh - 160px); }

  /* Login page */
  .login-card { padding: 2rem 1.25rem; border-radius: 16px; margin: 1rem; }
  .login-logo { width: 90px; }

  /* Modal full width bottom sheet */
  .modal {
    max-width: 100vw;
    width: 100vw;
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-overlay { align-items: flex-end; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  /* Users table horizontal scroll */
  .table-scroll { border-radius: var(--radius); }
  table { min-width: 540px; }

  /* Topbar */
  .topbar-title { font-size: 0.95rem; }

  /* Buttons */
  .btn { font-size: 0.82rem; }

  /* Welcome banner */
  .welcome-text h2 { font-size: 1.1rem; }
  .welcome-text p { font-size: 0.8rem; }

  /* Email setup steps */
  .setup-steps { padding: 1rem; }
}

/* ── Small phones (≤ 400px) ── */
@media (max-width: 400px) {
  .page-content { padding: 0.75rem; }
  .calendar-cell { min-height: 44px; }
  .calendar-day-name { font-size: 0.6rem; letter-spacing: 0; }
  .login-card { padding: 1.5rem 1rem; }
}

/* ════════════════════════════════════
   NOTES PAGE
   ════════════════════════════════════ */

.notes-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ── Notes sidebar ── */
.notes-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 1rem;
}
.notes-sidebar-top {
  padding: 1rem 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.notes-search-wrap {
  position: relative;
}
.notes-search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.notes-search-input {
  padding-left: 2rem;
  font-size: 0.8rem;
  height: 32px;
}
.notes-nav {
  padding: 0.6rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-bottom: 1px solid var(--border);
}
.notes-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}
.notes-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.notes-nav-item.active { background: var(--accent-dim); color: var(--accent-h); }
.nav-count {
  margin-left: auto;
  font-size: 0.68rem;
  background: var(--bg-hover);
  border-radius: 99px;
  padding: 0.1rem 0.4rem;
  color: var(--text-muted);
}
.notes-nav-item.active .nav-count { background: rgba(99,102,241,0.2); color: var(--accent-h); }
.notes-nav-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 1.15rem 0.25rem;
}
.notes-nav-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.3rem 1.15rem;
}
.tag-cloud-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.2rem 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.72rem;
  background: var(--bg-hover);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
}
.tag-cloud-chip:hover { background: var(--accent-dim); color: var(--accent-h); }
.tag-cloud-chip.active { background: var(--accent-dim); color: var(--accent-h); }
.tag-count { font-size: 0.65rem; opacity: 0.65; }

/* ── Note list panel ── */
.notes-list-panel {
  width: 255px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg);
}
.notes-list { display: flex; flex-direction: column; }
.notes-list-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 1.5rem 1rem;
  text-align: center;
}
.note-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  min-height: 70px;
}
.note-card:hover { background: var(--bg-elevated); }
.note-card.active { background: var(--accent-dim); }
.note-card-color {
  width: 5px;
  flex-shrink: 0;
  background-color: var(--book-color);
  border-radius: 0;
}
/* Art style variations on card strip */
.note-card-color.book-classic {
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,0.28) 0%, rgba(0,0,0,0.22) 100%),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 3px);
}
.note-card-color.book-minimal {
  background-image: linear-gradient(135deg, rgba(255,255,255,0.25) 30%, rgba(255,255,255,0.0) 70%);
  border-top: 2px solid rgba(255,255,255,0.2);
}
.note-card-color.book-vintage {
  background-image:
    radial-gradient(ellipse 4px 3px at 40% 30%, rgba(101,67,5,0.25) 0%, transparent 100%),
    radial-gradient(ellipse 3px 4px at 65% 70%, rgba(101,67,5,0.2) 0%, transparent 100%),
    repeating-linear-gradient(0deg, transparent, transparent 5px, rgba(0,0,0,0.05) 5px, rgba(0,0,0,0.05) 6px);
  border-left-color: rgba(0,0,0,0.0);
  border-left: 5px solid rgba(0,0,0,0.5);
}
.note-card-color.book-comic {
  border-right: 2px solid rgba(0,0,0,0.6);
  background-image:
    radial-gradient(circle, rgba(0,0,0,0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.05) 100%);
  background-size: 4px 4px, 100% 100%;
}
.note-card-body {
  flex: 1;
  padding: 0.65rem 0.85rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.note-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.note-card.active .note-card-title { color: var(--accent-h); }
.note-pin-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fbbf24;
  flex-shrink: 0;
}
.note-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-shared-badge {
  font-size: 0.65rem;
  background: rgba(34,211,238,0.15);
  color: var(--cyan);
  padding: 0.1rem 0.35rem;
  border-radius: 99px;
  flex-shrink: 0;
}
.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.1rem;
}
.note-card-tags { display: flex; gap: 0.25rem; }
.note-tag-chip {
  font-size: 0.65rem;
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 0.1rem 0.35rem;
  border-radius: 99px;
}
.note-card.active .note-tag-chip { background: rgba(99,102,241,0.2); color: var(--accent-h); }
.note-card-date { font-size: 0.68rem; color: var(--text-muted); flex-shrink: 0; }

/* ── Editor panel ── */
.notes-editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.notes-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.notes-editor-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Title input */
.note-title-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 1rem 1.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  width: 100%;
  flex-shrink: 0;
}
.note-title-input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Meta bar */
.note-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.note-meta-left {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.note-meta-input {
  height: 30px;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  background: var(--bg-card);
  border-color: transparent;
  min-width: 0;
}
.note-meta-input:focus { border-color: var(--accent); }
.note-meta-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Art style buttons */
.art-style-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.art-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.art-btn:last-child { border-right: none; }
.art-btn:hover { background: var(--bg-hover); color: var(--text); }
.art-btn.active { background: var(--accent-dim); color: var(--accent-h); font-weight: 600; }

/* Color picker */
.color-swatch-wrap {
  position: relative;
  cursor: pointer;
}
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.15);
  transition: border-color var(--transition);
}
.color-swatch-wrap:hover .color-swatch { border-color: rgba(255,255,255,0.4); }
.color-hidden-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Action buttons */
.note-action-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
}
.note-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.note-action-btn.pinned { color: #fbbf24; }

/* Save status */
.save-status {
  position: absolute;
  bottom: 0.75rem;
  right: 1.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity var(--transition);
}
.save-status.ok   { color: var(--green); }
.save-status.busy { color: var(--text-muted); }
.save-status.err  { color: var(--red); }

/* Share modal */
.share-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
}
.share-user-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.share-user-row:hover { background: var(--bg-hover); }
.share-user-row input[type=checkbox] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.share-user-info { flex: 1; overflow: hidden; }
.share-user-name  { display: block; font-size: 0.85rem; font-weight: 600; }
.share-user-email { display: block; font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Quill dark-theme overrides ── */
.ql-toolbar.ql-snow {
  background: var(--bg-elevated);
  border-color: var(--border) !important;
  border-radius: 0;
  padding: 0.45rem 1rem;
  flex-shrink: 0;
}
.ql-container.ql-snow {
  background: var(--bg);
  border-color: var(--border) !important;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
}
.ql-editor {
  height: 100% !important;
  overflow-y: auto;
  color: var(--text);
  line-height: 1.75;
  padding: 1.25rem 1.5rem;
}
.ql-editor.ql-blank::before {
  color: var(--text-muted);
  font-style: normal;
  left: 1.5rem;
}
.ql-snow .ql-stroke { stroke: var(--text-dim); }
.ql-snow .ql-fill   { fill:   var(--text-dim); }
.ql-snow .ql-picker  { color: var(--text-dim); }
.ql-snow .ql-picker-label { border-color: var(--border) !important; }
.ql-snow .ql-picker-options { background: var(--bg-elevated); border-color: var(--border); }
.ql-snow .ql-picker-item:hover { color: var(--text); }
.ql-snow.ql-toolbar  button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke { stroke: var(--text); }
.ql-snow.ql-toolbar  button.ql-active .ql-stroke { stroke: var(--accent-h); }
.ql-snow.ql-toolbar  button:hover .ql-fill { fill: var(--text); }
.ql-snow.ql-toolbar  button.ql-active .ql-fill { fill: var(--accent-h); }
.ql-snow .ql-picker.ql-expanded .ql-picker-label { color: var(--text); border-color: var(--accent); }
.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke { stroke: var(--text); }
.ql-editor h1 { font-size:1.5rem; font-weight:700; margin:.8rem 0 .4rem; }
.ql-editor h2 { font-size:1.2rem; font-weight:700; margin:.7rem 0 .35rem; }
.ql-editor h3 { font-size:1.05rem; font-weight:600; margin:.6rem 0 .3rem; }
.ql-editor blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 1rem;
  color: var(--text-dim);
  margin: 0.5rem 0;
}
.ql-editor pre.ql-syntax {
  background: var(--bg-elevated);
  color: var(--cyan);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}
.ql-editor ol, .ql-editor ul { padding-left: 1.5rem; }
.ql-editor a { color: var(--accent-h); }

/* ── Notes responsive ── */
@media (max-width: 960px) {
  .notes-sidebar { width: 180px; }
  .notes-list-panel { width: 220px; }
}
@media (max-width: 768px) {
  .notes-sidebar { display: none; }
  .notes-list-panel { width: 200px; }
}
@media (max-width: 600px) {
  .notes-list-panel { display: none; }
  .note-meta-bar { flex-direction: column; align-items: flex-start; }
}

/* ════════════════════════════════════
   BOOKSHELF (dashboard)
   ════════════════════════════════════ */

.bookshelf-section { margin-top: 1.5rem; }
.bookshelf-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.bookshelf-wrap {
  position: relative;
  padding: 0 2rem;
}
.bookshelf-scroll {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  overflow-x: auto;
  padding: 1.25rem 0.25rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}
.bookshelf-scroll::-webkit-scrollbar { display: none; }
.bookshelf-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 1.5rem 0.5rem;
}
.bookshelf-floor {
  height: 10px;
  margin: 0;
  background: linear-gradient(to bottom, #2a1e08, #120d02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}
.shelf-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-80%);
  width: 30px;
  height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  color: var(--text-dim);
  transition: all var(--transition);
}
.shelf-arrow:hover { background: var(--bg-hover); color: var(--text); }
.shelf-arrow-left  { left:  0.35rem; }
.shelf-arrow-right { right: 0.35rem; }

/* ── Book spine ── */
.book-spine {
  width: 48px;
  height: 138px;
  border-radius: 2px 5px 5px 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  flex-shrink: 0;
  overflow: hidden;
  padding: 6px 3px;
  text-decoration: none;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.book-spine:hover {
  transform: rotate(180deg) translateY(10px);
}
.book-title {
  font-size: 0.65rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 110px;
  display: block;
}
.book-spine.pinned::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  background: #fbbf24;
  border-radius: 50%;
  box-shadow: 0 0 4px #fbbf24;
}

/* ── Classic style (upgraded) ── */
.book-classic {
  background-color: var(--book-color);
  background-image:
    /* Linen weave texture */
    repeating-linear-gradient(
      0deg,
      transparent, transparent 2px,
      rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 3px
    ),
    repeating-linear-gradient(
      90deg,
      transparent, transparent 3px,
      rgba(255,255,255,0.012) 3px, rgba(255,255,255,0.012) 4px
    ),
    /* Depth gradient: dark binding → highlight edge */
    linear-gradient(
      to right,
      rgba(0,0,0,0.68) 0%,
      rgba(0,0,0,0.24) 17%,
      rgba(0,0,0,0.06) 32%,
      rgba(255,255,255,0.05) 52%,
      rgba(0,0,0,0.07) 70%,
      rgba(255,255,255,0.2) 100%
    );
  border-left: 9px solid rgba(0,0,0,0.52);
  box-shadow:
    4px 0 16px rgba(0,0,0,0.65),
    inset -2px 0 5px rgba(255,255,255,0.1),
    inset 3px 0 7px rgba(0,0,0,0.32);
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 0.04em;
  text-shadow:
    0 1px 4px rgba(0,0,0,0.95),
    0 -1px 1px rgba(255,255,255,0.12),
    0 0 12px rgba(0,0,0,0.5);
}
/* Double gold decorative lines + centre crease via background gradient */
.book-classic::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(to bottom,
      transparent 7px,
      rgba(255,215,0,0.6)  7px,  rgba(255,215,0,0.6)  8px,
      transparent 8px,  transparent 12px,
      rgba(255,215,0,0.22) 12px, rgba(255,215,0,0.22) 13px,
      transparent 13px,
      transparent calc(100% - 13px),
      rgba(255,215,0,0.22) calc(100% - 13px), rgba(255,215,0,0.22) calc(100% - 12px),
      transparent calc(100% - 12px), transparent calc(100% - 8px),
      rgba(255,215,0,0.6)  calc(100% - 8px),  rgba(255,215,0,0.6)  calc(100% - 7px),
      transparent calc(100% - 7px)
    ),
    /* Subtle spine crease */
    linear-gradient(to right,
      transparent 62%,
      rgba(0,0,0,0.14) 62%, rgba(0,0,0,0.14) 63%,
      rgba(255,255,255,0.05) 63%, rgba(255,255,255,0.05) 64%,
      transparent 64%
    );
  pointer-events: none;
}
.book-spine.book-classic:hover {
  box-shadow:
    6px 0 22px rgba(0,0,0,0.75),
    inset -2px 0 5px rgba(255,255,255,0.13),
    inset 3px 0 7px rgba(0,0,0,0.38);
}

/* ── Minimal style (upgraded) ── */
.book-minimal {
  background-color: var(--book-color);
  background-image: linear-gradient(
    to right,
    rgba(0,0,0,0.32) 0%,
    rgba(0,0,0,0.1)  20%,
    rgba(255,255,255,0.03) 50%,
    rgba(255,255,255,0.1)  100%
  );
  border-left: 4px solid rgba(0,0,0,0.32);
  border-top:  2px solid rgba(255,255,255,0.22);
  box-shadow:
    2px 0 10px rgba(0,0,0,0.38),
    inset 0 1px 0 rgba(255,255,255,0.22);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.65);
}
/* Diagonal gloss streak */
.book-minimal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0)    25%,
    rgba(255,255,255,0.22) 42%,
    rgba(255,255,255,0.3)  50%,
    rgba(255,255,255,0.22) 58%,
    rgba(255,255,255,0)    75%
  );
  pointer-events: none;
}
.book-spine.book-minimal:hover {
  filter: brightness(1.14);
  box-shadow: 0 0 24px rgba(0,0,0,0.22), 2px 0 12px rgba(0,0,0,0.32);
}

/* ── Vintage style (upgraded) ── */
.book-vintage {
  background-color: var(--book-color);
  background-image:
    /* Foxing / age spots */
    radial-gradient(ellipse 9px 7px  at 32% 22%, rgba(101,67,5,0.22) 0%, transparent 100%),
    radial-gradient(ellipse 6px 8px  at 70% 55%, rgba(101,67,5,0.17) 0%, transparent 100%),
    radial-gradient(ellipse 10px 6px at 18% 74%, rgba(101,67,5,0.14) 0%, transparent 100%),
    radial-gradient(ellipse 7px 9px  at 82% 38%, rgba(101,67,5,0.12) 0%, transparent 100%),
    radial-gradient(ellipse 8px 5px  at 50% 88%, rgba(101,67,5,0.10) 0%, transparent 100%),
    /* Aged leather gradient */
    linear-gradient(
      to right,
      rgba(0,0,0,0.62) 0%,
      rgba(80,50,5,0.38) 28%,
      rgba(180,130,40,0.1) 65%,
      rgba(255,220,120,0.08) 100%
    );
  border-left: 10px solid rgba(0,0,0,0.52);
  box-shadow:
    3px 0 14px rgba(0,0,0,0.65),
    inset 0 0 0 1px rgba(200,150,30,0.18),
    inset -1px 0 5px rgba(255,200,80,0.09);
  font-family: Georgia, serif;
  font-style: italic;
  letter-spacing: 0.035em;
  color: rgba(255,228,150,0.88);
  text-shadow:
    0 1px 4px rgba(0,0,0,0.95),
    0 0 12px rgba(160,110,20,0.3);
}
/* Double ornate border lines */
.book-vintage::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom,
    transparent 5px,
    rgba(200,150,30,0.6)  5px,  rgba(200,150,30,0.6)  6px,
    transparent 6px,  transparent 9px,
    rgba(200,150,30,0.22) 9px,  rgba(200,150,30,0.22) 10px,
    transparent 10px,
    transparent calc(100% - 10px),
    rgba(200,150,30,0.22) calc(100% - 10px), rgba(200,150,30,0.22) calc(100% - 9px),
    transparent calc(100% - 9px), transparent calc(100% - 6px),
    rgba(200,150,30,0.6)  calc(100% - 6px),  rgba(200,150,30,0.6)  calc(100% - 5px),
    transparent calc(100% - 5px)
  );
  pointer-events: none;
}
/* Page-line grain */
.book-vintage::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent,        transparent 10px,
    rgba(0,0,0,0.045) 10px, rgba(0,0,0,0.045) 11px
  );
  pointer-events: none;
}
.book-spine.pinned.book-vintage::after { display: none; }

/* ── Comic style (upgraded) ── */
.book-comic {
  background-color: var(--book-color);
  background-image: linear-gradient(
    to right,
    rgba(255,255,255,0.1)  0%,
    rgba(255,255,255,0.03) 40%,
    rgba(0,0,0,0.08)       100%
  );
  border-left:   8px solid rgba(0,0,0,0.78);
  border-top:    2px solid rgba(0,0,0,0.6);
  border-bottom: 2px solid rgba(0,0,0,0.6);
  border-right:  2px solid rgba(0,0,0,0.5);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.72), 2px 2px 0 rgba(0,0,0,0.4);
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow:
    1px  1px 0 rgba(0,0,0,0.65),
   -1px -1px 0 rgba(0,0,0,0.3),
    0    0   6px rgba(0,0,0,0.4);
}
/* Ben-Day halftone dots */
.book-comic::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.14) 1px, transparent 1px);
  background-size: 5px 5px;
  pointer-events: none;
}
.book-spine.book-comic:hover {
  transform: rotate(180deg) translateY(12px);
  box-shadow: 5px 5px 0 rgba(0,0,0,0.78), 3px 3px 0 rgba(0,0,0,0.4);
}

/* ── Bookshelf responsive ── */
@media (max-width: 640px) {
  .book-spine { width: 40px; height: 118px; }
  .book-title { font-size: 0.6rem; }
  .bookshelf-wrap { padding: 0 1.5rem; }
}

/* ── Weather Widget ── */
.welcome-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.weather-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 1.1rem;
  min-width: 130px;
}
.weather-icon svg { display: block; }
.weather-temp {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.weather-desc {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
.weather-city {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.7;
  margin-top: 0.1rem;
}
@media (max-width: 600px) {
  .weather-widget { display: none; }
}

/* ── Jspreadsheet dark theme overrides ── */
#spreadsheetWrap .jss_content,
#spreadsheetWrap .jtabs-content,
#spreadsheetWrap table.jss {
  background: var(--bg-card);
  color: var(--text);
}
#spreadsheetWrap .jss_container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
#spreadsheetWrap thead td, #spreadsheetWrap thead th {
  background: var(--bg-elevated) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
  font-size: 0.75rem;
  font-weight: 600;
}
#spreadsheetWrap tbody td {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  font-size: 0.85rem;
}
#spreadsheetWrap tbody tr:hover td {
  background: var(--bg-elevated) !important;
}
#spreadsheetWrap tbody td.selected,
#spreadsheetWrap tbody td.highlight {
  background: var(--accent-dim) !important;
}
#spreadsheetWrap .jss_selectall {
  background: var(--bg-elevated) !important;
  border-color: var(--border) !important;
}
