:root {
  --bg: #0a0d12;
  --bg-elevated: #0f1318;
  --panel: #141922;
  --panel-hover: #1a202c;
  --glass: #1a2130;
  --glass-hover: #212938;
  --text: #f0f2f5;
  --text-secondary: #c9cdd4;
  --text-muted: #7d8590;
  --muted: #7d8590;
  --accent: #4dabf7;
  --accent-2: #74c0fc;
  --accent-glow: rgba(77, 171, 247, 0.15);
  --border: #2d333b;
  --border-light: #373e47;
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.12);
  --success: #51cf66;
  --success-bg: rgba(81, 207, 102, 0.12);
  --warning: #fcc419;
  --warning-bg: rgba(252, 196, 25, 0.12);
  --primary: #238636;
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 60px;
  --shell-max: 960px;
  --shell-pad: 1.25rem;
  --shell-pad-mobile: 1rem;
  --card-pad: 1rem;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.45);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: 56px;
  --bottom-nav-height: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: row;
  width: 100%;
  position: relative;
}

/* Sidebar - must be fixed left panel */
aside.sidebar,
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-normal), transform var(--transition-normal);
  overflow: hidden;
  will-change: transform, width;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Shared collapsed state */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .sidebar-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar .brand {
  gap: 0.35rem;
}

body.sidebar-collapsed .sidebar .brand-mark {
  width: 32px;
  height: 32px;
}

.sidebar.collapsed .sidebar-nav,
body.sidebar-collapsed .sidebar .sidebar-nav {
  overflow: hidden;
}

body.sidebar-collapsed .main-wrapper.with-sidebar {
  margin-left: var(--sidebar-collapsed-width);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .brand-text {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  box-shadow: none;
}

.sidebar-toggle:hover {
  background: var(--glass);
  color: var(--text);
  transform: none;
}

.sidebar-toggle svg {
  transition: transform 0.3s ease;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--glass);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
}

.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-link span {
  transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Main wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-wrapper.with-sidebar {
  margin-left: var(--sidebar-width);
}

.sidebar.collapsed + .main-wrapper.with-sidebar {
  margin-left: var(--sidebar-collapsed-width);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}

.mobile-menu-toggle:hover {
  background: var(--glass);
  transform: none;
}
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  background: rgba(22,27,34,0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
}
.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0d1117;
}
.brand-text strong { color: var(--text); }
.brand-text small { display: block; color: var(--muted); font-size: 12px; }
.nav-links { display: flex; gap: 0.6rem; flex-wrap: wrap; flex: 1 1 auto; }
.nav-links a { color: var(--text); text-decoration: none; padding: 0.3rem 0.55rem; border-radius: 8px; transition: background 0.2s; }
.nav-links a:hover { background: rgba(255,255,255,0.1); }
.topbar-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex: 1 1 100%; }
.nav-search { position: relative; }
.nav-search input { padding: 0.45rem 0.7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--glass); color: var(--text); }
.nav-search input::placeholder { color: var(--muted); }
.nav-search__results { position: absolute; top: 110%; left: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.4); min-width: 260px; z-index: 10; color: var(--text); }
.nav-search__results div { padding: 0.55rem 0.75rem; cursor: pointer; }
.nav-search__results div:hover, .nav-search__results div.active { background: rgba(255,255,255,0.05); }
.nav-timer { font-weight: 700; color: var(--text-muted); padding: 0.35rem 0.65rem; background: var(--glass); border-radius: 8px; font-size: 12px; }
.nav-timer.active { background: rgba(63,185,80,0.15); color: var(--success); animation: pulse 2s infinite; }
.nav-timer.active.paused { background: rgba(210,153,34,0.15); color: #d29922; animation: none; }
.db-status { padding: 0.3rem 0.6rem; border-radius: 10px; font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); background: var(--glass); }
.db-status.ok { color: var(--success); border-color: var(--success); }
.db-status.error { color: var(--danger); border-color: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.user-chip { display: flex; gap: 0.65rem; align-items: center; background: var(--glass); padding: 0.4rem 0.7rem; border-radius: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; font-weight: 700; color: #0d1117; }
.user-meta { display: flex; flex-direction: column; }
.user-meta .user-name { color: var(--text); }
.user-meta a { color: var(--muted); text-decoration: none; font-size: 12px; }
.user-meta a:hover { color: var(--accent); }
.icon-btn { background: var(--glass); border: 1px solid var(--border); border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--text); box-shadow: none; padding: 0; }
.icon-btn:hover { background: rgba(255,255,255,0.08); }
.header-sheet { position: absolute; top: 60px; right: 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem; box-shadow: 0 12px 30px rgba(0,0,0,0.35); min-width: 220px; z-index: 30; }
.sheet-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.sheet-row:last-child { margin-bottom: 0; }
.sheet-row.actions { gap: 0.75rem; flex-wrap: wrap; }
.sheet-row.actions a { color: var(--text); text-decoration: none; font-weight: 600; }
.sheet-row.actions a:hover { color: var(--accent); }
.header-sheet .theme-toggle.inline { margin-left: auto; }
.topbar-actions.compact { gap: 0.5rem; }
.bottom-nav { display: none; }

/* Shell - main content container */
.shell {
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: var(--shell-pad);
  padding-bottom: calc(var(--shell-pad) + var(--safe-bottom));
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Typography */
h1 {
  color: var(--text);
  margin: 0 0 0.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: clamp(1.375rem, 2vw + 0.875rem, 1.75rem);
  line-height: 1.2;
}
h2 {
  color: var(--text);
  margin: 0 0 0.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: clamp(1rem, 1.2vw + 0.5rem, 1.25rem);
  line-height: 1.3;
}
h3 {
  color: var(--text);
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
}
.subtext {
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.text-muted { color: var(--muted); }
.small { font-size: 0.85rem; }
form div { margin-bottom: 0.75rem; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
label {
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}
input, textarea, select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem;
  background: var(--glass);
  color: var(--text);
  width: 100%;
  min-height: 44px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8590' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Buttons */
button {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  transition: all var(--transition-fast);
}
button:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}
button:active {
  transform: translateY(0);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  min-height: 44px;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
}
.btn.ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn.ghost:hover {
  background: var(--glass);
  color: var(--text);
  border-color: var(--border-light);
}
.btn.primary {
  background: var(--accent);
  color: #0d1117;
}
.btn.primary:hover {
  background: var(--accent-2);
}
.btn.secondary {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover {
  background: var(--glass-hover);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.danger:hover {
  background: #ff5252;
}
.btn.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  min-height: 36px;
}
.btn.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 52px;
}
.error { color: var(--danger); font-size: 0.8125rem; margin-top: 0.25rem; display: block; }

/* Custom File Input */
.file-input-wrapper { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.file-input-wrapper input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.file-input-button { display: inline-flex; align-items: center; padding: 0.5rem 0.875rem; font-size: 13px; font-weight: 500; color: var(--text-muted); background: var(--glass); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.15s ease; }
.file-input-wrapper:hover .file-input-button { border-color: var(--accent); color: var(--accent); }
.file-input-text { font-size: 13px; color: var(--muted); }

ul { list-style: none; padding-left: 0; }
ul li { margin-bottom: 0.35rem; }
.report-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.report-table th, .report-table td { border: 1px solid var(--border); padding: 0.5rem; }
.report-table th { background: var(--glass); text-align: left; }
table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; table-layout: auto; }
th, td { border-bottom: 1px solid var(--border); padding: 0.6rem; color: var(--text); }
th { text-align: left; background: var(--glass); }
.table-container { width: 100%; overflow-x: auto; }
.table-mobile { width: 100%; border-collapse: collapse; }
.table-mobile thead { display: table-header-group; }
.table-mobile td { background: transparent; }
.table-mobile td[data-label] { font-weight: 500; }
.table-mobile td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); display: none; }

.flash-list { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.flash { padding: 0.65rem 0.8rem; border-radius: 10px; background: var(--glass); border: 1px solid var(--border); color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.flash.success { border-color: var(--success); background: rgba(63,185,80,0.1); }
.flash.danger, .flash.error { border-color: var(--danger); background: rgba(248,81,73,0.1); }
.flash.info { border-color: var(--accent); background: rgba(88,166,255,0.1); }
.flash.warning { border-color: #d29922; background: rgba(210,153,34,0.1); }
.flash .close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); box-shadow: none; min-height: auto; padding: 0.25rem; }
.flash .close:hover { color: var(--text); transform: none; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  transition: border-color var(--transition-fast);
}
.card:hover {
  border-color: var(--border-light);
}
.card-compact {
  padding: 0.875rem;
}
/* Lists and Timer Cards */
.list.stack { display: grid; gap: 0.625rem; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--glass);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.list-row:hover {
  background: var(--glass-hover);
  border-color: var(--border-light);
}
.timer-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  background: var(--glass);
  display: grid;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}
.timer-card:hover {
  border-color: var(--border-light);
}
.timer-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.timer-lines { display: grid; gap: 0.25rem; }
.timer-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.btn-row.dense { gap: 0.375rem; }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }
.font-mono.big { font-size: 1.125rem; font-weight: 600; }
.status-menu {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.ellipsis-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Pills/Badges */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.pill.pending { background: var(--warning-bg); color: var(--warning); }
.pill.in-progress { background: var(--accent-glow); color: var(--accent); }
.pill.completed { background: var(--success-bg); color: var(--success); }

/* Grid Layouts */
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.875rem; }

/* Stats Cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.stat-card .stat-change { font-size: 12px; margin-top: 0.25rem; }
.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Fast Action Component */
.fast-action-card {
  background: linear-gradient(135deg, var(--panel) 0%, #121722 100%);
  border: 2px solid rgba(88,166,255,0.25);
}

.fast-action-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.fast-action-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--accent);
}

.fast-action-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.fast-action-step {
  display: flex;
  gap: 0.75rem;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #0d1117;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-content label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.task-input-section {
  margin-top: 0.5rem;
}

.dual-input {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0.75rem;
}

.input-hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 12px;
}

.fast-action-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.fast-action-buttons .btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 15px;
}
.fast-action-compact { display: grid; gap: 0.5rem; }
.fast-action-buttons.vertical { flex-direction: column; align-items: stretch; }

/* Compact dashboard mode */
body.compact-dashboard .shell {
  width: min(980px, 96%);
  padding: 1rem;
}

body.compact-dashboard .card {
  padding: 0.85rem;
}

body.compact-dashboard .fast-action-grid {
  gap: 1rem;
}

body.compact-dashboard .grid.four {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

body.compact-dashboard .chart-section {
  margin-bottom: 0.75rem;
}
.timer-panel { display: grid; gap: 0.5rem; }
.timer-display { font-size: 2rem; font-weight: 700; font-family: monospace; color: var(--accent); }
.notes { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.5rem; }
.notes li { padding: 0.5rem; border-radius: 10px; background: rgba(255,255,255,0.02); border: 1px solid var(--border); }
.note-meta { color: var(--muted); font-size: 12px; margin-bottom: 0.25rem; }
.note-body { white-space: pre-wrap; }
.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 200px; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.font-mono { font-family: monospace; }
.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.page-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}
.compact-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  font-size: 13px;
}
.compact-toggle svg {
  flex-shrink: 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #0d1117;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button states */
button:disabled, .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Flash message auto-dismiss animation */
.flash.dismissing {
  animation: fadeOut 0.3s ease forwards;
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* Status pill in search */
.status-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
}
.status-badge.pending { background: rgba(210,153,34,0.2); color: #d29922; }
.status-badge.in-progress { background: rgba(88,166,255,0.2); color: var(--accent); }
.status-badge.completed { background: rgba(63,185,80,0.2); color: var(--success); }

/* Empty state */
.empty-state { text-align: center; padding: 2rem; color: var(--muted); }

/* Theme toggle */
.theme-toggle {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  transform: none;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text);
}

/* Checkbox styling */
input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

/* Radio options */
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.radio-option:hover {
  background: rgba(255,255,255,0.05);
}
.radio-option input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.remember-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Code input */
.code-input {
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  font-family: monospace;
  padding: 12px;
}

/* Links */
a { color: var(--accent); }
a:hover { color: var(--accent-2); }

/* Toast Notifications */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.4); font-size: 14px; pointer-events: auto; opacity: 0; transform: translateX(100%); transition: all 0.3s ease; }
.toast.toast-enter { opacity: 1; transform: translateX(0); }
.toast.toast-exit { opacity: 0; transform: translateX(100%); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid #d29922; }
.toast-info { border-left: 4px solid var(--accent); }
.toast-message { flex: 1; }
.toast-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; box-shadow: none; }
.toast-close:hover { color: var(--text); transform: none; }

/* Current Time Display */
.current-time { font-size: 12px; font-weight: 500; color: var(--text-muted); font-family: monospace; }

/* ========================================
   MOBILE & TABLET RESPONSIVE STYLES
   ======================================== */

/* Tablet Landscape */
@media (max-width: 1024px) {
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  .fast-action-grid { grid-template-columns: 1fr; }
}

/* Tablet Portrait & Mobile */
@media (max-width: 768px) {
  :root {
    --shell-pad: 1rem;
    --card-pad: 0.875rem;
    --header-height: 52px;
  }

  /* Hide sidebar, show as overlay when open */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.collapsed,
  body.sidebar-collapsed .sidebar {
    width: 280px;
  }
  body.sidebar-collapsed .sidebar .brand-text,
  body.sidebar-collapsed .sidebar .sidebar-link span {
    opacity: 1;
    width: auto;
  }
  .main-wrapper.with-sidebar,
  body.sidebar-collapsed .main-wrapper.with-sidebar {
    margin-left: 0;
  }
  .mobile-menu-toggle {
    display: flex;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
  }
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  /* Topbar adjustments */
  .topbar {
    padding: 0.625rem 0.875rem;
    height: var(--header-height);
  }
  .nav-search { display: none; }
  .user-name { display: none; }
  .db-status { display: none; }

  /* Main content area */
  .main-wrapper {
    min-height: calc(100vh - var(--bottom-nav-height));
    min-height: calc(100dvh - var(--bottom-nav-height));
    padding-bottom: var(--bottom-nav-height);
  }
  .shell {
    padding: var(--shell-pad-mobile);
    padding-bottom: calc(var(--shell-pad-mobile) + 0.5rem);
    width: 100%;
    max-width: 100%;
  }

  /* Typography adjustments */
  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.125rem; }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .page-actions {
    width: 100%;
  }

  /* Grid layouts */
  .grid.two { grid-template-columns: 1fr; gap: 0.875rem; }
  .grid.four { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }

  /* Forms */
  .form-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .form-row > div {
    min-width: 100%;
  }
  .dual-input {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  input, textarea, select, button {
    width: 100%;
  }

  /* Fast action card */
  .fast-action-grid {
    grid-template-columns: 1fr;
    gap: 0.875rem;
  }
  .fast-action-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
  .fast-action-buttons .btn {
    width: 100%;
  }

  /* Tables to cards on mobile */
  .table-mobile,
  .table-mobile thead,
  .table-mobile tbody,
  .table-mobile th,
  .table-mobile td,
  .table-mobile tr {
    display: block;
    width: 100%;
  }
  .table-mobile thead { display: none; }
  .table-mobile tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.625rem;
    background: var(--glass);
  }
  .table-mobile td {
    border: none;
    padding: 0.375rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
  }
  .table-mobile td[data-label]::before {
    display: inline;
    font-weight: 500;
    color: var(--text-muted);
  }
  .table-mobile td:last-child {
    padding-top: 0.625rem;
    margin-top: 0.375rem;
    border-top: 1px solid var(--border);
  }

  /* Filter bar */
  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }
  .filter-bar > div:last-child {
    margin-top: 0.25rem;
  }
  .filter-bar .btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  /* Cards */
  .card {
    border-radius: var(--radius-md);
  }

  /* Timer card mobile layout */
  .timer-card {
    gap: 0.625rem;
  }
  .timer-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  /* Compact dashboard mode */
  body.compact-dashboard .chart-section { display: none; }
  body.compact-dashboard .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Bottom Navigation */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 0.5rem 0.25rem;
    padding-bottom: calc(0.5rem + var(--safe-bottom));
    gap: 0;
    z-index: 95;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.375rem 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    min-height: 44px;
  }
  .bottom-nav a:hover,
  .bottom-nav a.active {
    color: var(--accent);
    background: var(--accent-glow);
  }
  .bottom-nav svg {
    width: 22px;
    height: 22px;
    color: inherit;
  }

  /* Quick task form */
  .card form.form-row {
    gap: 0.625rem;
  }
  .card form.form-row > div {
    flex: 1 1 100% !important;
  }
}

/* Small Mobile - Extra compact */
@media (max-width: 480px) {
  :root {
    --shell-pad-mobile: 0.75rem;
    --card-pad: 0.75rem;
  }
  .grid.four { grid-template-columns: 1fr; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1rem; }
  .btn { padding: 0.5rem 0.75rem; font-size: 0.875rem; }
  .btn.btn-sm { padding: 0.375rem 0.5rem; font-size: 0.75rem; }
  .bottom-nav a span { font-size: 0.625rem; }
}

/* Desktop enhancements */
@media (min-width: 1024px) {
  :root {
    --card-pad: 1.25rem;
    --shell-pad: 1.5rem;
  }
}

/* Large desktop */
@media (min-width: 1400px) {
  :root {
    --shell-max: 1100px;
  }
}

/* Filter bar styles */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-bar > div {
  flex: 1;
  min-width: 140px;
}
.filter-bar > div:last-child {
  min-width: auto;
}
.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

/* Section headers */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
  gap: 0.75rem;
}
.section-head h2 { margin: 0; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}
.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}
.empty-state p {
  margin-bottom: 1rem;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.pagination a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.pagination a:hover {
  background: var(--accent-glow);
}
.pagination .current {
  font-weight: 700;
  color: var(--text);
}

/* Utility spacing classes */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Auth Pages */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 2rem);
  min-height: calc(100dvh - var(--header-height) - 2rem);
  padding: 1rem;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem 1.5rem;
}
.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-header h1 {
  margin-bottom: 0.25rem;
}
.auth-header .subtext {
  margin-bottom: 0;
}
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  margin-bottom: 0;
  font-size: 0.9rem;
}
.auth-footer a {
  font-weight: 600;
  margin-left: 0.25rem;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem 1rem;
  }
  .auth-container {
    min-height: calc(100vh - var(--header-height) - 1rem);
    min-height: calc(100dvh - var(--header-height) - 1rem);
    align-items: flex-start;
    padding-top: 2rem;
  }
}
