/* ============================================================
   Todo Manager — Main Stylesheet
   Light / Dark mode via CSS custom properties
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:          #f5f6fa;
  --surface:     #ffffff;
  --surface2:    #f0f1f7;
  --border:      #e2e5ef;
  --text:        #1a1d2e;
  --text-muted:  #6b7280;
  --accent:      #4f6ef7;
  --accent-hov:  #3a56d4;
  --danger:      #e74c3c;
  --danger-hov:  #c0392b;
  --success:     #27ae60;
  --warning:     #f39c12;
  --radius:      8px;
  --radius-sm:   5px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
  --nav-h:       56px;
  --sidebar-w:   300px;
  --trans:       .18s ease;
}

[data-theme="dark"] {
  --bg:          #0b0d16;
  --surface:     #14172a;
  --surface2:    #1c2035;
  --border:      #5a6090;
  --text:        #ffffff;
  --text-muted:  #b8c4e0;
  --accent:      #8aaafe;
  --accent-hov:  #6f8ffd;
  --shadow:      0 1px 4px rgba(0,0,0,.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,.6);
}

/* ── Dark mode overrides ─────────────────────────────────────── */

/* Nav */
[data-theme="dark"] .nav {
  background: #080a14;
  border-bottom: 2px solid #6070a8;
}
[data-theme="dark"] .nav-brand { color: #ffffff; }
[data-theme="dark"] .nav-links a { color: #ffffff; font-weight: 500; }
[data-theme="dark"] .nav-links a:hover { background: #2a3060; color: #ffffff; }
[data-theme="dark"] .nav-links a.active { color: #8aaafe; font-weight: 700; }
[data-theme="dark"] .nav-dropdown-menu { background: #10142a; border: 1px solid #6070a8; }
[data-theme="dark"] .nav-dropdown-menu a { color: #ffffff; }
[data-theme="dark"] .nav-dropdown-menu a:hover { background: #2a3060; color: #ffffff; }
[data-theme="dark"] .nav-user { color: #b8c4e0; }

/* Buttons */
[data-theme="dark"] .btn-ghost {
  color: #ffffff;
  border: 1px solid #6070a8;
  background: #1c2035;
}
[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background: #2a3060;
  color: #ffffff;
  border-color: #8aaafe;
}
[data-theme="dark"] .btn-icon { color: #ffffff; }
[data-theme="dark"] .btn-secondary {
  background: #1c2035;
  color: #ffffff;
  border-color: #6070a8;
}

/* Toolbar: search, sort, add-task */
[data-theme="dark"] .task-search,
[data-theme="dark"] .sort-select,
[data-theme="dark"] .add-task-input,
[data-theme="dark"] .form-control {
  background: #12152a;
  border: 1px solid #6070a8;
  color: #ffffff;
}
[data-theme="dark"] .task-search::placeholder,
[data-theme="dark"] .add-task-input::placeholder,
[data-theme="dark"] .form-control::placeholder { color: #8090b8; }
[data-theme="dark"] .task-search:focus,
[data-theme="dark"] .add-task-input:focus,
[data-theme="dark"] .form-control:focus {
  border-color: #8aaafe;
  background: #1a1e38;
  outline: none;
}
[data-theme="dark"] .task-search-wrap svg { color: #b8c4e0; }
[data-theme="dark"] .sort-select option { background: #12152a; color: #ffffff; }

/* Task panel */
[data-theme="dark"] .task-panel-title { color: #ffffff; }
[data-theme="dark"] .task-panel-title a { color: #8aaafe; }
[data-theme="dark"] .task-item-title { color: #ffffff; }
[data-theme="dark"] .task-item-meta { color: #b8c4e0; }
[data-theme="dark"] .task-item:hover { background: #1c2035; }
[data-theme="dark"] .task-item.active { background: #1e2a60; border-left-color: #8aaafe; }
[data-theme="dark"] .task-item.selected { background: #1e2a60; }

/* Reading panel */
[data-theme="dark"] .task-title-input,
[data-theme="dark"] .task-body-area {
  background: #12152a;
  border: 1px solid #6070a8;
  color: #ffffff;
}
[data-theme="dark"] .task-title-input::placeholder,
[data-theme="dark"] .task-body-area::placeholder { color: #8090b8; }
[data-theme="dark"] #task-priority { background: #12152a; border-color: #6070a8; color: #ffffff; }
[data-theme="dark"] #task-move-list { background: #12152a; border-color: #6070a8; color: #ffffff; }
[data-theme="dark"] #task-created,
[data-theme="dark"] #task-updated { color: #b8c4e0; }

/* Alerts */
[data-theme="dark"] .alert-success { background: #0e2a1a; border-color: #2a6a40; color: #80e8a8; }
[data-theme="dark"] .alert-error   { background: #2a0e0e; border-color: #8a2a2a; color: #ff9090; }
[data-theme="dark"] .alert-info    { background: #0e1e2e; border-color: #2a60a8; color: #80c8f8; }
[data-theme="dark"] .alert-warning { background: #2a1e08; border-color: #8a6018; color: #ffd060; }

/* Badges */
[data-theme="dark"] .badge-blue  { background: #1a2a70; color: #a0c0ff; }
[data-theme="dark"] .badge-green { background: #0e2a1a; color: #80e8a8; }
[data-theme="dark"] .badge-red   { background: #2a0e0e; color: #ff9090; }

/* Misc */
[data-theme="dark"] .rule-item.editing  { background: #1e2a60; }
[data-theme="dark"] .task-item.selected { background: #1e2a60; }
[data-theme="dark"] .form-label { color: #ffffff; }
[data-theme="dark"] .form-hint  { color: #b8c4e0; }
[data-theme="dark"] .toggle-archived { color: #ffffff; }
[data-theme="dark"] .page-title { color: #ffffff; }
[data-theme="dark"] .page-subtitle { color: #b8c4e0; }
[data-theme="dark"] .list-card-name { color: #ffffff; }
[data-theme="dark"] .list-card-meta { color: #b8c4e0; }

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--trans), color var(--trans);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Page-load progress bar ────────────────────────────────── */
#page-loader {
  position: fixed;
  top: 0; left: 0;
  z-index: 99999;
  height: 3px;
  width: 0%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#page-loader.active {
  opacity: 1;
  animation: page-loader-fill 10s cubic-bezier(0.05, 0.8, 0.05, 1) forwards;
}
@keyframes page-loader-fill {
  0%   { width: 0% }
  30%  { width: 60% }
  70%  { width: 80% }
  100% { width: 92% }
}

/* ── Nav ───────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; padding: 0 1.2rem; gap: 1rem;
}
.nav-brand {
  font-weight: 700; font-size: 1.1rem; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: .5rem;
}
.nav-brand svg { width: 22px; height: 22px; fill: var(--accent); }
.nav-spacer { flex: 1; }
.nav-user { font-size: .85rem; color: var(--text-muted); }
.nav-links { display: flex; gap: .4rem; align-items: center; }
.nav-links a {
  padding: .35rem .8rem; border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--text-muted);
  transition: background var(--trans);
}
.nav-links a:hover { background: var(--surface2); text-decoration: none; color: var(--text); }
.nav-links a.active { color: var(--accent); font-weight: 600; }

/* Mobile-only logout link (inside nav-links; hidden on desktop) */
.nav-mobile-logout { display: none; }

/* Hamburger */
.nav-hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; padding: .4rem; cursor: pointer; flex-shrink: 0;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Toolbar dropdown (Report button etc.) */
.toolbar-dropdown { position: relative; }
.toolbar-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  z-index: 200;
  padding: .3rem 0;
}
.toolbar-dropdown:hover .toolbar-dropdown-menu { display: block; }
.toolbar-dropdown-menu a {
  display: block;
  padding: .45rem 1rem;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
}
.toolbar-dropdown-menu a:hover { background: var(--surface2); text-decoration: none; }

/* Nav dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: flex; align-items: center; gap: .3rem; cursor: default;
}
.nav-dropdown-trigger::after {
  content: '';
  border: 4px solid transparent;
  border-top-color: currentColor;
  margin-top: 3px;
  flex-shrink: 0;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  z-index: 200;
  padding: .4rem 0 .3rem;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: .45rem 1rem;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.nav-dropdown-menu a:hover { background: var(--surface2); text-decoration: none; color: var(--text); }
.nav-dropdown-menu a.active { color: var(--accent); font-weight: 600; }
.nav-dropdown-divider { border-top: 1px solid var(--border); margin: .3rem 0; }

/* Dark mode toggle */
.btn-icon {
  background: none; border: none; padding: .4rem; border-radius: var(--radius-sm);
  color: var(--text-muted); transition: background var(--trans), color var(--trans);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius-sm);
  border: none; font-size: .88rem; font-weight: 500;
  transition: background var(--trans), box-shadow var(--trans), opacity var(--trans);
  cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hov); }

.btn-ghost     { background: none; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-sm svg { width: 13px; height: 13px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: .35rem; font-size: .88rem; font-weight: 500; }
.form-control {
  width: 100%; padding: .55rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: .9rem; transition: border-color var(--trans), box-shadow var(--trans);
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,110,247,.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }

.form-hint  { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: .25rem; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: 1rem; border: 1px solid transparent;
}
.alert-success { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.alert-error   { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.alert-info    { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.alert-warning { background: #fff3cd; border-color: #ffeeba; color: #856404; }
[data-theme="dark"] .alert-success { background: #163320; border-color: #2d6a40; color: #7de0a7; }
[data-theme="dark"] .alert-error   { background: #3a1a1a; border-color: #7a2a2a; color: #f78a8a; }
[data-theme="dark"] .alert-info    { background: #142838; border-color: #2a5570; color: #7dd4ee; }
[data-theme="dark"] .alert-warning { background: #332808; border-color: #6a4f18; color: #f5cc50; }

/* ── Auth pages ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 2.2rem 2rem; width: 100%; max-width: 420px;
}
.auth-logo {
  text-align: center; margin-bottom: 1.8rem;
}
.auth-logo h1 { font-size: 1.5rem; color: var(--text); }
.auth-logo p  { font-size: .88rem; color: var(--text-muted); margin-top: .3rem; }
.auth-footer  { text-align: center; margin-top: 1.2rem; font-size: .88rem; color: var(--text-muted); }

/* ── Dashboard ─────────────────────────────────────────────── */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.2rem; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .8rem;
}
.page-title { font-size: 1.3rem; font-weight: 700; }
.page-subtitle { font-size: .88rem; color: var(--text-muted); margin-top: .2rem; }

/* List grid */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.list-card {
  display: block; /* needed since it's now an <a> tag */
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
  box-shadow: var(--shadow); cursor: pointer;
  text-decoration: none; color: inherit;
  transition: box-shadow var(--trans), border-color var(--trans), transform var(--trans);
  position: relative;
}
.list-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-1px); }
.list-card-name { font-weight: 600; font-size: 1rem; margin-bottom: .5rem; }
.list-card-meta { font-size: .82rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; }
.list-card-old  { color: var(--warning); font-weight: 600; }
.list-card-new-email {
  display: flex; align-items: center; gap: .3rem;
  font-size: .78rem; font-weight: 600;
  color: var(--success); margin-bottom: .35rem;
}
.list-card-new-email svg { width: 13px; height: 13px; flex-shrink: 0; }
.list-card-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  border-radius: 50%; width: 24px; height: 24px;
  font-size: .75rem; font-weight: 700; margin-left: auto;
}
.stats-loading {
  color: var(--text-muted); opacity: .45; font-style: italic;
}
.list-card-actions {
  position: absolute; top: .7rem; right: .7rem;
  opacity: 0; transition: opacity var(--trans);
}
.list-card:hover .list-card-actions { opacity: 1; }
.btn-del-list {
  background: none; border: none; padding: .3rem; color: var(--text-muted);
  border-radius: var(--radius-sm); cursor: pointer; line-height: 0;
  transition: color var(--trans), background var(--trans);
}
.btn-del-list:hover { color: var(--danger); background: var(--surface2); }
.btn-del-list svg { width: 15px; height: 15px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1rem; margin-bottom: .5rem; color: var(--text); }

/* ── List (split) view ─────────────────────────────────────── */
.list-layout {
  display: flex; height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

/* Left panel: task list */
.task-panel {
  width: var(--sidebar-w); min-width: 220px; max-width: 400px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--surface); overflow: hidden;
  resize: horizontal;
}
.task-panel-header {
  padding: .9rem 1rem; border-bottom: 1px solid var(--border);
}
.task-panel-title {
  font-weight: 700; font-size: 1rem; margin-bottom: .6rem;
  display: flex; align-items: center; justify-content: space-between;
}
.task-panel-title a { font-size: .78rem; font-weight: 400; color: var(--text-muted); }
.task-panel-title a:hover { color: var(--text); }

/* Toolbar */
.task-toolbar {
  display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.task-search-wrap { position: relative; flex: 1; min-width: 100px; }
.task-search-wrap svg {
  position: absolute; left: .6rem; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
}
.task-search {
  width: 100%; padding: .4rem .6rem .4rem 2rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface2); color: var(--text); font-size: .83rem;
}
.task-search:focus { outline: none; border-color: var(--accent); background: var(--surface); }

select.sort-select {
  padding: .38rem .5rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface2);
  color: var(--text); font-size: .8rem; cursor: pointer;
}

.toggle-archived {
  display: flex; align-items: center; gap: .3rem;
  font-size: .8rem; color: var(--text-muted); cursor: pointer; user-select: none;
}
.toggle-archived input { cursor: pointer; }

/* Task list */
.task-list { flex: 1; overflow-y: auto; padding: .5rem 0; }
.task-item {
  padding: .7rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background var(--trans);
  display: flex; align-items: flex-start; gap: .5rem;
}
.task-item:hover { background: var(--surface2); }
.task-item.active { background: #eef1fe; border-left: 3px solid var(--accent); }
[data-theme="dark"] .task-item.active { background: #1c2555; border-left-color: var(--accent); }
.task-item-content { flex: 1; min-width: 0; }
.task-item-title {
  font-size: .88rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-item.archived .task-item-title { color: var(--text-muted); text-decoration: line-through; }
.task-item-meta { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }
/* Right-side indicators column: priority top, old-badge bottom */
.task-item-indicators {
  flex-shrink: 0;
  display: flex; flex-direction: column;
  justify-content: space-between; align-items: center;
  align-self: stretch;
  min-width: 18px; gap: .25rem;
}
.priority-icon {
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
}
.priority-icon svg  { width: 15px; height: 15px; }
.priority-icon.high { color: var(--danger); }
.priority-icon.low  { color: #27ae60; }
.source-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  font-size: .7rem; background: var(--surface2);
  border: 1px solid var(--border); color: var(--text-muted);
}
.task-old-badge {
  display: flex; align-items: center;
  color: var(--warning); opacity: .85;
}
.task-old-badge svg { width: 14px; height: 14px; }

/* Right panel: reading/editing */
.reading-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
}
.reading-panel-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: .5rem;
}
.reading-panel-empty svg { width: 48px; height: 48px; opacity: .25; }

.reading-panel-header {
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-end; gap: .5rem;
}
/* Move-to-list picker */
.task-list-picker-wrap  { display: flex; flex-direction: column; gap: .25rem; margin-left: auto; }
.task-list-picker-label { font-size: .68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.task-list-picker-inner { position: relative; }
.task-list-picker {
  width: auto; appearance: none; -webkit-appearance: none;
  padding: .3rem 2rem .3rem .5rem;
  font-size: .82rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface2); color: var(--text);
  cursor: pointer;
}
.task-list-picker:focus { outline: none; border-color: var(--accent); }
.task-list-picker-chevron {
  position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; color: var(--text-muted); pointer-events: none;
}
[data-theme="dark"] .task-list-picker { background: #12152a; border-color: #6070a8; color: #ffffff; }
[data-theme="dark"] .task-list-picker-chevron { color: #8090b8; }
[data-theme="dark"] .task-list-picker-label   { color: #8090b8; }
/* Archive + Delete icon buttons */
.reading-panel-actions  { display: flex; gap: .1rem; align-items: center; flex-shrink: 0; padding-bottom: 1px; }
.btn-archive-icon       { color: var(--text-muted); }
.btn-archive-icon:hover { color: var(--accent); }
.btn-archive-icon.is-archived { color: var(--accent); }
.btn-icon-danger        { color: var(--danger); }
.btn-icon-danger:hover  { color: var(--danger-hov); }

.reading-panel-body { flex: 1; overflow-y: auto; padding: 1.2rem; }

.task-title-input {
  width: 100%; font-size: 1.15rem; font-weight: 600;
  border: none; background: none; color: var(--text); padding: 0;
  border-bottom: 2px solid transparent; outline: none;
  transition: border-color var(--trans);
}
.task-title-input:focus { border-bottom-color: var(--accent); }

.task-body-area {
  width: 100%; margin-top: 1rem; min-height: 250px;
  border: 1px solid transparent; background: none; color: var(--text);
  font-size: .92rem; line-height: 1.7; resize: vertical;
  padding: .5rem; border-radius: var(--radius-sm); outline: none;
  transition: border-color var(--trans), background var(--trans);
}
.task-body-area:focus { border-color: var(--accent); background: var(--surface2); }

.task-meta-row {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.2rem; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--text-muted);
}
.task-meta-row select { font-size: .82rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface2);
  color: var(--text); padding: .25rem .5rem; }

/* Add task */
.add-task-bar {
  padding: .7rem 1rem; border-top: 1px solid var(--border);
  display: flex; gap: .5rem;
}
.add-task-input {
  flex: 1; padding: .45rem .7rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface2);
  color: var(--text); font-size: .88rem;
}
.add-task-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* ── Email settings ────────────────────────────────────────── */
.settings-layout { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem;
  box-shadow: var(--shadow); flex: 1; min-width: 280px;
}
.settings-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

.account-item, .rule-item {
  padding: .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: .6rem; background: var(--surface2);
  display: flex; align-items: center; gap: .6rem;
}
.account-item-info, .rule-item-info { flex: 1; min-width: 0; }
.account-item-name, .rule-item-name { font-weight: 500; font-size: .9rem; }
.account-item-meta, .rule-item-meta { font-size: .78rem; color: var(--text-muted); }

.rule-item.editing { border-color: var(--accent); background: #eef1fe; }
[data-theme="dark"] .rule-item.editing { background: #1c2555; }

.check-result {
  padding: .6rem .9rem; border-radius: var(--radius-sm); font-size: .88rem; margin-top: .8rem;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  width: 100%; max-width: 460px; padding: 1.8rem;
  animation: modal-in .15s ease;
}
@keyframes modal-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: .2rem; }
.modal-close:hover { color: var(--text); }
.modal-close svg { width: 20px; height: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: .6rem 1.2rem; font-size: .9rem; font-weight: 500;
  cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color var(--trans), border-color var(--trans);
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Toast notifications ───────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  padding: .65rem 1rem; border-radius: var(--radius-sm);
  font-size: .88rem; color: #fff; box-shadow: var(--shadow-md);
  animation: toast-in .2s ease; max-width: 300px; pointer-events: all;
}
.toast.out { animation: toast-out .2s ease forwards; }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--accent); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* ── Misc ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: .15rem .5rem;
  border-radius: 999px; font-size: .75rem; font-weight: 500;
}
.badge-blue   { background: #e8ecff; color: var(--accent); }
.badge-green  { background: #d4edda; color: var(--success); }
.badge-red    { background: #fde8e8; color: var(--danger); }
.badge-grey   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
[data-theme="dark"] .badge-blue  { background: #1a2d6a; color: #9ab4ff; }
[data-theme="dark"] .badge-green { background: #163320; color: #7de0a7; }
[data-theme="dark"] .badge-red   { background: #3a1818; color: #f78a8a; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Multi-select / bulk actions ───────────────────────────── */
.task-item .task-checkbox {
  display: none; width: 15px; height: 15px; flex-shrink: 0;
  margin-top: 4px; cursor: pointer; accent-color: var(--accent);
}
.select-mode .task-item .task-checkbox { display: block; }
.select-mode .task-item-indicators      { display: none; }
.select-mode .task-item                 { cursor: default; user-select: none; }
.task-item.selected                     { background: #eef1fe; }
[data-theme="dark"] .task-item.selected { background: #1c2555; }

.btn-select-mode        { transition: background var(--trans), color var(--trans), border-color var(--trans); }
.btn-select-mode.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.bulk-action-bar {
  display: none; padding: .5rem .8rem; border-top: 1px solid var(--border);
  background: var(--surface2); align-items: center; gap: .5rem;
  font-size: .82rem;
}
.bulk-action-bar.visible { display: flex; }
.bulk-count { flex: 1; font-weight: 500; color: var(--text); }

/* ── Settings page ─────────────────────────────────────────── */
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.settings-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.settings-section-title { font-size: 1rem; font-weight: 600; margin-bottom: .2rem; }
.settings-section-desc { font-size: .83rem; color: var(--text-muted); }

/* Preference rows */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 0; border-top: 1px solid var(--border); }
.pref-row-label { font-size: .9rem; font-weight: 500; }
.pref-row-desc  { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* Backup cards */
.backup-options { display: flex; flex-direction: column; gap: .7rem; margin-bottom: .9rem; }
.backup-card {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface2);
  text-decoration: none; color: var(--text);
  transition: border-color var(--trans), box-shadow var(--trans);
}
.backup-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.backup-icon { width: 36px; height: 36px; flex-shrink: 0; color: var(--accent); }
.backup-icon svg { width: 100%; height: 100%; }
.backup-format { font-weight: 700; font-size: .95rem; margin-bottom: .1rem; }
.backup-desc { font-size: .8rem; color: var(--text-muted); }
.backup-info { flex: 1; min-width: 0; }
.backup-dl-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }
.backup-card:hover .backup-dl-icon { color: var(--accent); }
.backup-note { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* Login summary modal */
.modal-summary { max-width: 440px; }
.summary-total { font-size: .95rem; font-weight: 600; padding: .6rem 0 .5rem; color: var(--text); }
.summary-list  { display: flex; flex-direction: column; gap: .3rem; margin-top: .2rem;
  max-height: 280px; overflow-y: auto; }
.summary-row   { display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; padding: .45rem .5rem; border-radius: var(--radius-sm);
  background: var(--surface2); }
.summary-list-name { font-size: .88rem; font-weight: 500; color: var(--accent);
  text-decoration: none; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-list-name:hover { text-decoration: underline; }
.summary-count { font-size: .82rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.summary-old   { color: var(--warning); font-weight: 600; font-size: .78rem; }
.summary-empty { padding: 1rem 0; text-align: center; color: var(--text-muted); font-size: .9rem; }
.summary-loading { padding: 1.2rem 0; text-align: center; }
.summary-pref-label { display: flex; align-items: center; gap: .45rem; font-size: .82rem;
  color: var(--text-muted); cursor: pointer; user-select: none; }
.summary-row.has-tooltip { cursor: default; }
.summary-hover-hint { font-size: .7rem; color: var(--text-muted); opacity: .5;
  margin-left: .25rem; vertical-align: middle; }
.summary-row.has-tooltip:hover .summary-hover-hint { opacity: 1; color: var(--accent); }

/* Floating task tooltip — follows cursor via JS mousemove */
#task-tooltip {
  position: fixed;
  z-index: 100000;
  pointer-events: none;   /* never intercept mouse events */
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: .45rem .7rem;
  font-size: .82rem;
  min-width: 160px;
  max-width: 280px;
}
#task-tooltip.visible { display: block; }
#task-tooltip .tooltip-header {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-bottom: .25rem;
  margin-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}
#task-tooltip ul { list-style: none; margin: 0; padding: 0; }
#task-tooltip li {
  padding: .2rem 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
#task-tooltip li + li { border-top: 1px solid var(--border); }

.feed-list { display: flex; flex-direction: column; gap: .6rem; }
.feed-item {
  display: flex; align-items: center; gap: .9rem;
  padding: .75rem 1rem;
  background: var(--surface2); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.feed-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.feed-item-info { flex: 1; min-width: 0; }
.feed-item-name { font-weight: 500; font-size: .9rem; }
.feed-item-url  { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item-meta { font-size: .73rem; color: var(--text-muted); margin-top: .1rem; }
.feed-item-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 99px; cursor: pointer; transition: background var(--trans);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  left: 3px; bottom: 3px; background: #fff;
  transition: transform var(--trans);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Colour presets */
.feed-color-presets { display: flex; gap: .3rem; flex-wrap: wrap; }
.color-preset { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; transition: border-color var(--trans); }
.color-preset:hover { border-color: var(--text-muted); }

.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Audit log table ───────────────────────────────────────── */
.audit-table-wrap { overflow-x: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.audit-table thead tr { background: var(--surface2); }
.audit-table th {
  text-align: left; padding: .5rem .75rem;
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.audit-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: var(--surface2); }
.audit-date    { white-space: nowrap; color: var(--text-muted); font-size: .78rem; }
.audit-action  { white-space: nowrap; font-weight: 500; }
.audit-task    { max-width: 220px; }
.audit-details { color: var(--text-muted); font-size: .78rem; }

/* ── Calendar page ─────────────────────────────────────────── */
.cal-filter-bar { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Feed toggle pills */
.cal-feed-toggles { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.2rem; align-items: center; }
.cal-feed-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .8rem .3rem .55rem;
  border-radius: 99px; border: none;
  font-size: .82rem; font-weight: 500; line-height: 1;
  background: var(--pill-color, var(--accent));
  color: #fff;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  user-select: none;
  opacity: 1;
}
.cal-feed-pill:hover { transform: translateY(-1px); }
.cal-feed-pill:not(.active) { opacity: .28; }
.cal-feed-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.55); flex-shrink: 0; }

/* Legacy legend (kept for backwards compat) */
.cal-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: .82rem; color: var(--text-muted); }
.cal-legend-item { display: flex; align-items: center; gap: .35rem; }
.cal-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.cal-agenda { display: flex; flex-direction: column; gap: 1.5rem; }

.cal-day-group {}
.cal-day-header {
  display: flex; align-items: baseline; gap: .6rem;
  padding: .5rem 0 .5rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: .6rem;
}
.cal-day-label { font-size: 1rem; font-weight: 700; color: var(--text); }
.cal-day-date  { font-size: .82rem; color: var(--text-muted); }
.cal-day-count { font-size: .75rem; color: var(--text-muted); margin-left: auto; }

.cal-event {
  display: flex; align-items: stretch; gap: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: .4rem;
  overflow: hidden; transition: box-shadow var(--trans);
}
.cal-event:hover { box-shadow: var(--shadow-md); }
.cal-event-stripe { width: 4px; flex-shrink: 0; }
.cal-event-time {
  flex-shrink: 0; width: 88px; padding: .65rem .5rem .65rem .8rem;
  font-size: .78rem; color: var(--text-muted); font-weight: 500;
  display: flex; flex-direction: column; gap: .15rem;
}
.cal-all-day { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.cal-time-end { font-size: .72rem; color: var(--text-muted); font-weight: 400; }
.cal-event-body { flex: 1; padding: .65rem .9rem .65rem .5rem; min-width: 0; }
.cal-event-title { font-weight: 600; font-size: .9rem; color: var(--text); margin-bottom: .15rem; }
.cal-event-location { display: flex; align-items: center; gap: .25rem; font-size: .78rem; color: var(--text-muted); margin-bottom: .15rem; }
.cal-event-desc { font-size: .78rem; color: var(--text-muted); margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-feed { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── Email Templates ───────────────────────────────────────── */
.template-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  margin-bottom: .6rem;
  transition: background var(--trans);
}
.template-item:hover { background: var(--bg); }
.template-item-info  { flex: 1; min-width: 0; }
.template-item-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-item-preview {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-item-actions {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
  align-items: center;
}
[data-theme="dark"] .template-item { background: var(--surface2); border-color: var(--border); }
[data-theme="dark"] .template-item:hover { background: #1e2448; }
[data-theme="dark"] .template-item-title { color: #ffffff; }
[data-theme="dark"] .template-item-preview { color: #b8c4e0; }

/* ── Help page ─────────────────────────────────────────────── */
.help-toc {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-bottom: 2rem; padding: .75rem 1rem;
  background: var(--surface2); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.help-toc a {
  font-size: .82rem; color: var(--text-muted); padding: .2rem .5rem;
  border-radius: var(--radius-sm); text-decoration: none;
}
.help-toc a:hover { background: var(--surface); color: var(--accent); }

.help-section {
  display: flex; gap: 1.2rem; align-items: flex-start;
  padding: 1.75rem 0; border-bottom: 1px solid var(--border);
}
.help-section:last-child { border-bottom: none; }
.help-section-icon {
  flex-shrink: 0; width: 40px; height: 40px;
  background: var(--surface2); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.help-section-icon svg { width: 22px; height: 22px; }
.help-section-body { flex: 1; min-width: 0; }
.help-section-body h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .6rem; color: var(--text); }
.help-section-body > p { color: var(--text-muted); font-size: .9rem; margin-bottom: 1rem; line-height: 1.6; }

.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.help-card {
  padding: .8rem 1rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .83rem; line-height: 1.5; color: var(--text-muted);
}
.help-card-title { font-weight: 600; color: var(--text); margin-bottom: .3rem; }

.help-indicators { display: flex; flex-direction: column; gap: .4rem; }
.help-indicator-row { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--text-muted); }
.help-indicator-row span:first-child { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

kbd {
  display: inline-block; padding: .1rem .4rem; font-size: .8rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; font-family: monospace; color: var(--text);
}

/* ── Guided tour ────────────────────────────────────────────── */
#tour-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 9000; pointer-events: all;
}
#tour-card {
  position: fixed; z-index: 9001;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 1.1rem 1.2rem; width: 300px; max-width: calc(100vw - 24px);
  pointer-events: all;
}
.tour-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.tour-title  { font-weight: 700; font-size: .95rem; color: var(--text); }
.tour-close  { background: none; border: none; font-size: 1rem; color: var(--text-muted); cursor: pointer; padding: .1rem .3rem; line-height:1; }
.tour-close:hover { color: var(--danger); }
.tour-text   { font-size: .85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: .9rem; }
.tour-footer { display: flex; align-items: center; justify-content: space-between; }
.tour-progress { font-size: .75rem; color: var(--text-muted); }
.tour-btns   { display: flex; gap: .4rem; }
.tour-highlight {
  position: relative; z-index: 9002;
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 8px rgba(79,110,247,.25);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

/* ── File Attachments ──────────────────────────────────────── */
.task-attachments {
  border-top: 1px solid var(--border);
  padding: .55rem .9rem .4rem;
  background: var(--surface);
  flex-shrink: 0;
  transition: background var(--trans);
}
.task-attachments.drag-over {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
  border-radius: var(--radius-sm);
}

.attachments-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .35rem;
}
.attachments-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  flex: 1;
}
.attachments-add-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  font-size: .8rem;
}
.attachments-add-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.attachments-loading {
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .4rem;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: .82rem;
  transition: background var(--trans), opacity .2s;
}
.attachment-item:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface2)); }
.attachment-new { opacity: 0; }

.attachment-icon { font-size: 1rem; flex-shrink: 0; line-height: 1; }
.attachment-name {
  flex: 1;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .82rem;
}
.attachment-name:hover { text-decoration: underline; }
.attachment-size {
  font-size: .74rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-delete-attachment {
  flex-shrink: 0;
  padding: .15rem;
  color: var(--text-muted);
  opacity: .5;
  transition: opacity var(--trans), color var(--trans);
}
.btn-delete-attachment:hover { opacity: 1; color: var(--danger); }
.btn-delete-attachment svg { width: 14px; height: 14px; }

.attachments-uploading {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem 0;
  font-size: .8rem;
  color: var(--text-muted);
}
.attachments-uploading-text::before {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: .35rem;
  vertical-align: -2px;
}

/* ── Dashboard Calendar Widget ─────────────────────────────── */
.dash-cal-section {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.dash-cal-title {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .35rem;
}
.dash-cal-title svg { color: var(--accent); width:15px; height:15px; }
.dash-cal-empty {
  padding: .9rem 1rem;
  color: var(--text-muted);
  font-size: .8rem;
}
.dash-cal-empty a { color: var(--accent); text-decoration: none; }
.dash-cal-empty a:hover { text-decoration: underline; }
.dash-cal-list { padding: .2rem 0 .3rem; }
.dash-cal-day-label {
  padding: .4rem 1rem .1rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* Each event: single line using grid for perfect column alignment */
.dash-cal-event {
  display: grid;
  grid-template-columns: 6px 5.5rem 1fr auto;
  align-items: center;
  gap: 0 .6rem;
  padding: .22rem 1rem;
  transition: background var(--trans);
  min-width: 0;
}
.dash-cal-event:hover { background: var(--surface2); }
.dash-cal-stripe {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-cal-time {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
/* Info column: title + optional location on ONE line, separated by · */
.dash-cal-info {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .8rem;
}
.dash-cal-event-title {
  font-weight: 500;
  color: var(--text);
}
.dash-cal-event-loc {
  color: var(--text-muted);
  font-size: .78rem;
}
.dash-cal-event-loc::before { content: ' · '; }
.dash-cal-badge {
  font-size: .67rem;
  font-weight: 600;
  opacity: .8;
  max-width: 7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .list-layout { flex-direction: column; height: auto; overflow: visible; }
  .task-panel  { width: 100%; max-width: 100%; border-right: none; border-bottom: 1px solid var(--border); resize: none; max-height: 50vh; }
  .reading-panel { min-height: 50vh; }
  .task-panel-header { padding: .7rem; }
  .lists-grid { grid-template-columns: 1fr 1fr; }
  .nav-user { display: none; }

  /* Hamburger nav */
  .nav-hamburger { display: flex; margin-left: auto; }
  .nav { height: auto; min-height: var(--nav-h); flex-wrap: wrap; padding: 0 .8rem; gap: .5rem; align-items: center; }
  .nav-spacer { display: none; }
  .nav-brand { padding: .8rem 0; }
  .nav > .btn-ghost { display: none; }     /* hide desktop logout */
  .nav-mobile-logout { display: block; }  /* show logout inside mobile menu */
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%; padding: .4rem 0 .8rem;
    border-top: 1px solid var(--border);
    gap: 0;
  }
  .nav-links.nav-open { display: flex; }
  .nav-links a { padding: .6rem .4rem; font-size: .9rem; border-radius: var(--radius-sm); }
  .nav-links .nav-dropdown-menu { position: static; box-shadow: none; border: none; background: var(--surface2); border-radius: var(--radius-sm); padding: 0; margin: .2rem 0 .2rem .8rem; display: flex !important; flex-direction: column; }
  .nav-links .nav-dropdown-trigger::after { content: ''; }
  .nav-logout-mobile { display: block !important; }
}
@media (max-width: 480px) {
  .lists-grid { grid-template-columns: 1fr; }
  .auth-card  { padding: 1.5rem 1rem; }
  .page-wrap  { padding: 1rem .8rem; }
}
