:root {
  --bg: #0b0f19;
  --card-bg: #111827;
  --card-border: #1f293d;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.35);
  --success: #10b981;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px calc(95px + env(safe-area-inset-bottom, 0px));
}

.app-shell {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Top Navigation */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--card-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-tabs {
  display: flex;
  background: #111827;
  border: 1px solid var(--card-border);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.nav-tab {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-tab.active {
  background: #1e293b;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.nav-tab:hover:not(.active) {
  color: var(--text);
}

.btn-nav-action {
  background: #1e293b;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-nav-action:hover {
  color: #fff;
  border-color: #475569;
  background: #334155;
}

/* SPA Views */
.spa-view {
  display: none;
  width: 100%;
}

.spa-view.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TIMER VIEW STYLES
   ============================================================ */
.timer-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.timer-card.is-running {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 36px -4px rgba(56, 189, 248, 0.15);
}

.timer-badge-pill {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.timer-badge-pill.running {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.timer-badge-pill.running .pulse-dot {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.timer-clock {
  font-size: 4.2rem;
  font-weight: 800;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1;
  margin: 4px 0;
  user-select: none;
}

.timer-card.is-running .timer-clock {
  color: #38bdf8;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
}

.timer-meta-live {
  font-size: 0.95rem;
  color: var(--text-muted);
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timer-meta-live strong {
  color: #fff;
}

.project-pill {
  font-size: 0.8rem;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-timer-action {
  width: 100%;
  max-width: 320px;
  padding: 18px 28px;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.btn-start {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
}

.btn-start:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--primary-glow);
}

.btn-stop {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
}

.btn-stop:hover {
  background: linear-gradient(135deg, #e11d48, #be123c);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(244, 63, 94, 0.4);
}

/* Quick Activity Chips */
.chips-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chips-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-subtle);
  padding-left: 2px;
}

.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  background: #111827;
  border: 1px solid var(--card-border);
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-btn:hover {
  background: #1e293b;
  border-color: #334155;
  color: #fff;
}

.chip-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: #60a5fa;
  font-weight: 600;
}

/* Form Configuration Details */
.config-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-text-link:hover {
  text-decoration: underline;
}

.input-text {
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Custom Combobox */
.custom-combobox {
  position: relative;
  width: 100%;
}

.combobox-trigger {
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: border-color 0.15s ease;
  min-height: 46px;
}

.combobox-trigger:focus,
.custom-combobox.open .combobox-trigger {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.combobox-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.combobox-arrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.custom-combobox.open .combobox-arrow {
  transform: rotate(180deg);
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #172033;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  z-index: 1000;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  max-height: 250px;
  overflow: hidden;
}

.combobox-search-wrapper {
  padding: 8px;
  border-bottom: 1px solid var(--card-border);
  background: #0f172a;
}

.combobox-search {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}

.combobox-search:focus {
  border-color: var(--primary);
}

.combobox-options {
  overflow-y: auto;
  max-height: 190px;
  padding: 4px 0;
}

.combobox-group-header {
  padding: 8px 12px 3px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.combobox-option {
  padding: 10px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.1s;
}

.combobox-option:hover,
.combobox-option.selected {
  background: #1e293b;
  color: #fff;
}

.combobox-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Today Glance Card */
.today-glance-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.today-glance-card:hover {
  border-color: #3b82f6;
  transform: translateY(-1px);
}

.glance-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.glance-label {
  font-size: 0.74rem;
  color: var(--text-subtle);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.glance-val {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.glance-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ============================================================
   DASHBOARD VIEW STYLES
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.kpi-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-subtle);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.kpi-badge-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.kpi-badge-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.kpi-badge-purple { background: rgba(139, 92, 246, 0.15); color: #c084fc; }

.view-switcher-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.pill-tabs {
  display: flex;
  background: #111827;
  border: 1px solid var(--card-border);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.pill-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pill-btn.active {
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.date-navigator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 4px 8px;
}

.btn-nav-arrow {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-nav-arrow:hover {
  background: #1e293b;
  color: #fff;
}

.date-display-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  padding: 0 6px;
  min-width: 120px;
  text-align: center;
}

.btn-today-jump {
  background: #1e293b;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-today-jump:hover {
  color: #fff;
  border-color: #475569;
}

.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

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

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.metric-box {
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-box-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
}

.metric-box-val {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric-deep { color: #38bdf8; }
.metric-learn { color: #34d399; }
.metric-admin { color: #f59e0b; }
.metric-dist { color: #f43f5e; }
.metric-total { color: #f8fafc; }

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sub-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-subtle);
  margin-bottom: 10px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}

.breakdown-name {
  font-weight: 600;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breakdown-val {
  font-weight: 700;
  font-family: monospace;
  color: #94a3b8;
}

.bar-track {
  width: 100%;
  height: 7px;
  background: #1e293b;
  border-radius: 9999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Daily Timeline */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 55px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  transition: background 0.15s;
}

.timeline-item:hover {
  background: #131b2c;
}

.timeline-time {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #38bdf8;
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

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

.timeline-activity {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.timeline-project {
  font-size: 0.78rem;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  padding: 2px 7px;
  border-radius: 5px;
}

.timeline-bar-rep {
  font-family: monospace;
  font-weight: bold;
  letter-spacing: -2px;
  margin-left: 2px;
  font-size: 1rem;
}

.timeline-duration {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: monospace;
  color: #94a3b8;
}

.timeline-reflections {
  font-size: 0.8rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-acc-badge {
  color: #fbbf24;
  font-weight: 600;
}

.timeline-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-icon:hover {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.1);
}

.btn-icon-subtle {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-icon-subtle:hover {
  color: #fff;
}

/* Sessions Table */
.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: #090d16;
  -webkit-overflow-scrolling: touch;
}

.sessions-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.sessions-table th, .sessions-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.88rem;
}

.sessions-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: #0d1322;
}

.sessions-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.sessions-table tr:last-child td {
  border-bottom: none;
}

.badge-cat {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.cat-work { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.cat-learning { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.cat-development { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.cat-research { background: rgba(20, 184, 166, 0.2); color: #2dd4bf; }
.cat-production { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.cat-operations { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.cat-non-work { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.cat-general { background: rgba(100, 116, 139, 0.25); color: #94a3b8; }

.table-reflection-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.82rem;
}

/* Weekly Section */
.weekly-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.review-stat-card {
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.review-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-subtle);
  font-weight: 700;
}

.review-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.review-highlight-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.review-highlight-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 6px;
}

.review-highlight-content {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
}

.sink-box {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
}
.sink-box .review-highlight-title {
  color: #fda4af;
}

.next-week-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px;
}

.next-week-textarea {
  width: 100%;
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 90px;
  outline: none;
}

.next-week-textarea:focus {
  border-color: var(--primary);
}

.btn-save-goals {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-save-goals:hover {
  background: var(--primary-hover);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 250;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn-prim {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-prim:hover {
  background: var(--primary-hover);
}

.btn-sec {
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--card-border);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-sec:hover {
  background: #334155;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.btn-close:hover {
  color: #fff;
}

.cat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.cat-table th, .cat-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
}

.cat-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #0d1322;
}

.cat-form-card {
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-group-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 130px;
}

.form-group-field label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.95rem;
}

.manage-act-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.1s;
}

.manage-act-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
   MOBILE RESPONSIVE NAVIGATION & LAYOUT
   ============================================================ */
.mobile-nav-bar {
  display: none;
}

@media (max-width: 640px) {
  /* Prevent iOS zoom on input focus */
  input, select, textarea, .form-input, .combobox-search, .input-text, .input-box {
    font-size: 16px !important;
  }

  body {
    padding: 10px 12px calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell {
    gap: 16px;
  }

  /* Top Navigation */
  .nav-bar {
    padding: 4px 0 10px;
    gap: 10px;
  }

  .brand {
    font-size: 1.1rem;
    gap: 8px;
    min-width: 0;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
    font-size: 1rem;
    flex-shrink: 0;
  }

  .nav-tabs,
  #desktopNavTabs {
    display: none !important;
  }


  /* Compact logout button */
  .btn-logout {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    white-space: nowrap;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 15, 25, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-around;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 150;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 12px;
    min-width: 64px;
    border-radius: 8px;
    transition: all 0.15s;
    background: none;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-nav-item:active {
    transform: scale(0.94);
  }

  .mobile-nav-item.active {
    color: #38bdf8;
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
  }

  /* Timer View */
  .timer-card {
    padding: 20px 14px;
    border-radius: 16px;
    gap: 12px;
  }

  .timer-clock {
    font-size: clamp(2.4rem, 11vw, 3.4rem);
    letter-spacing: -1px;
  }

  .timer-meta-live {
    font-size: 0.85rem;
    padding: 0 4px;
  }

  .btn-timer-action {
    width: 100%;
    max-width: 100%;
    padding: 14px 20px;
    font-size: 1.05rem;
    border-radius: 12px;
    min-height: 50px;
  }

  .btn-timer-action:active {
    transform: scale(0.98);
  }

  /* Quick Chips */
  .chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .chips-scroll::-webkit-scrollbar {
    display: none;
  }

  .chip-btn {
    scroll-snap-align: start;
    flex-shrink: 0;
    padding: 7px 13px;
    font-size: 0.82rem;
    min-height: 36px;
    touch-action: manipulation;
  }

  .chip-btn:active {
    transform: scale(0.95);
  }

  /* Combobox */
  .combobox-trigger {
    min-height: 44px;
    padding: 10px 12px;
  }

  .combobox-dropdown {
    z-index: 130;
    max-height: min(42vh, 260px);
    overscroll-behavior: contain;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  }

  .combobox-option {
    padding: 10px 12px;
    min-height: 42px;
  }

  .combobox-option .btn-icon-subtle {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.95rem;
    touch-action: manipulation;
  }

  .today-glance-card {
    padding: 14px 16px;
  }

  /* Dashboard View */
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 14px 16px;
    border-radius: 14px;
  }

  .kpi-value {
    font-size: 1.85rem;
  }

  .view-switcher-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pill-tabs {
    width: 100%;
    display: flex;
  }

  .pill-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
    text-align: center;
  }

  .date-navigator {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
  }

  .date-display-label {
    min-width: 0;
    flex: 1;
    font-size: 0.82rem;
    text-align: center;
  }

  .btn-nav-arrow {
    padding: 6px 12px;
    min-width: 38px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .btn-today-jump {
    padding: 6px 12px;
    min-height: 32px;
  }

  .panel-card {
    padding: 16px 14px;
    border-radius: 14px;
    gap: 14px;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Daily Metrics Grid: Total on top, then 2x2 grid */
  .summary-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .summary-metrics-grid .metric-box:first-child {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
  }

  .metric-box {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .metric-box-val {
    font-size: 1.2rem;
  }

  .two-col-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Timeline */
  .timeline-item {
    grid-template-columns: 46px 1fr auto;
    gap: 8px;
    padding: 10px;
  }

  .timeline-time {
    font-size: 0.82rem;
  }

  .timeline-activity {
    font-size: 0.88rem;
  }

  .timeline-duration {
    font-size: 0.78rem;
  }

  .timeline-actions .btn-icon {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }

  /* Sessions Table */
  .table-responsive-wrapper {
    position: relative;
    border-radius: 10px;
  }

  .sessions-table {
    min-width: 480px;
  }

  .sessions-table th, .sessions-table td {
    padding: 9px 8px;
    font-size: 0.8rem;
  }

  /* Weekly Review */
  .weekly-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .review-stat-card {
    padding: 12px 10px;
    border-radius: 12px;
  }

  .review-stat-value {
    font-size: 1.15rem;
  }

  .review-highlight-box {
    padding: 12px 14px;
    border-radius: 12px;
  }

  #weeklyDailyBarsGrid {
    gap: 4px !important;
    padding: 10px 0 4px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .next-week-box {
    padding: 14px;
  }

  .btn-save-goals {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 10px;
  }

  /* Modals */
  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }

  .modal-box {
    padding: 18px 14px;
    border-radius: 16px 16px 12px 12px;
    max-height: calc(100vh - 20px);
    margin-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .modal-title {
    font-size: 1.05rem;
  }

  .btn-close {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .cat-form-row {
    flex-direction: column;
    gap: 10px;
  }

  .cat-field-name {
    width: 100%;
  }

  .cat-field-icon, .cat-field-color {
    width: 100%;
  }

  .cat-table {
    min-width: 440px;
  }

  .cat-form-card {
    padding: 12px;
  }

  /* Manage activities modal rows */
  .manage-act-row {
    padding: 8px 6px;
  }

  .manage-act-row .btn-icon-subtle {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .brand span {
    font-size: 1rem;
  }
  .mobile-nav-item {
    padding: 6px 4px;
    font-size: 0.68rem;
    min-width: 52px;
  }
  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }
}

/* Login View Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  width: 100%;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-error {
  background-color: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--danger);
  color: #fecdd3;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
}

.btn-login {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  margin-top: 8px;
  background-color: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-login:hover {
  background-color: var(--primary-hover);
}

.btn-logout {
  color: var(--danger) !important;
}

.btn-logout:hover {
  background-color: rgba(244, 63, 94, 0.1) !important;
}

