/* ============================================================
   WorkPulse — style.css
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  #e0e7ff;
  --success:        #22c55e;
  --success-light:  #dcfce7;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --info:           #3b82f6;
  --info-light:     #dbeafe;

  --bg:         #f1f5f9;
  --bg-card:    #ffffff;
  --bg-modal:   #ffffff;
  --bg-nav:     #ffffff;
  --text:       #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border:     #e2e8f0;

  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 20px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --nav-h:    64px;
  --header-h: 56px;
}

[data-theme="dark"] {
  --bg:         #0f172a;
  --bg-card:    #1e293b;
  --bg-modal:   #1e293b;
  --bg-nav:     #1e293b;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #475569;
  --border:     #334155;
  --shadow:    0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 20px rgba(0,0,0,.4);
  --primary-light:  #1e1b4b;
  --success-light:  #052e16;
  --warning-light:  #1c0f00;
  --danger-light:   #2d0a0a;
  --info-light:     #172554;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
button  { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
a       { color: inherit; text-decoration: none; }
textarea{ resize: vertical; }
input, textarea, select {
  font-family: inherit; font-size: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── Layout ────────────────────────────────────────────────── */
#app          { max-width: 480px; margin: 0 auto; position: relative; min-height: 100vh; }
.main-app     { display: flex; flex-direction: column; min-height: 100vh; }
.hidden       { display: none !important; }

/* ── Loading ───────────────────────────────────────────────── */
.loading-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.loading-logo { text-align: center; color: #fff; margin-bottom: 40px; }
.logo-icon    { font-size: 52px; margin-bottom: 10px; animation: bounce .8s ease infinite alternate; }
.loading-logo h1 { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.loading-logo p  { font-size: 14px; opacity: .75; margin-top: 4px; }
.loading-spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes bounce { to { transform: translateY(-6px); } }

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 8px;
  backdrop-filter: blur(10px);
}
.header-left  { flex: 1; display: flex; align-items: center; gap: 8px; }
.header-logo  { font-size: 20px; }
.header-title { font-size: 18px; font-weight: 700; color: var(--primary); }
.header-right { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; transition: background .2s;
}
.icon-btn:hover { background: var(--border); }

/* ── Screen container ──────────────────────────────────────── */
.screen-container {
  flex: 1; padding: 16px;
  padding-bottom: calc(var(--nav-h) + 76px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom nav ────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: var(--nav-h);
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); font-size: 11px;
  transition: color .2s; position: relative;
}
.nav-item .nav-icon { font-size: 22px; transition: transform .2s; }
.nav-item.active    { color: var(--primary); }
.nav-item.active .nav-icon { transform: scale(1.12); }
.nav-item.active::after {
  content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 2px;
  background: var(--primary); border-radius: 0 0 4px 4px;
}
.nav-label { font-weight: 600; }

/* ── FAB ───────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  right: max(16px, calc(50vw - 224px));
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 26px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform .2s, background .2s;
  z-index: 99;
}
.fab:hover  { background: var(--primary-dark); transform: scale(1.06); }
.fab:active { transform: scale(.94); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Task card ─────────────────────────────────────────────── */
.task-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 13px 13px 13px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.task-card:hover  { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.task-card:active { transform: translateY(0); }
.task-card.priority-high   { border-left-color: var(--danger); }
.task-card.priority-medium { border-left-color: var(--warning); }
.task-card.priority-low    { border-left-color: var(--success); }
.task-card.status-done     { opacity: .6; }

.task-card-content { flex: 1; min-width: 0; }
.task-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-card.status-done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-meta  { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.task-dates { font-size: 11px; color: var(--text-light); margin-top: 5px; }
.task-actions { display: flex; flex-direction: column; align-items: flex-end; }

/* Quick-status buttons */
.quick-status { display: flex; gap: 3px; }
.qs-btn {
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid transparent; transition: all .15s;
}
.qs-btn.pending            { border-color: var(--text-light); color: var(--text-light); }
.qs-btn.inprogress         { border-color: var(--info);       color: var(--info); }
.qs-btn.onhold             { border-color: var(--warning);    color: var(--warning); }
.qs-btn.done               { border-color: var(--success);    color: var(--success); }
.qs-btn.pending.active     { background: var(--text-light); color: #fff; }
.qs-btn.inprogress.active  { background: var(--info);       color: #fff; }
.qs-btn.onhold.active      { background: var(--warning);    color: #fff; }
.qs-btn.done.active        { background: var(--success);    color: #fff; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize; white-space: nowrap;
}
.badge-status-pending    { background: #f1f5f9;              color: #475569; }
.badge-status-inprogress { background: var(--info-light);    color: var(--info); }
.badge-status-onhold     { background: var(--warning-light); color: #c2410c; }
.badge-status-done       { background: var(--success-light); color: #15803d; }
.badge-priority-high     { background: var(--danger-light);  color: #b91c1c; }
.badge-priority-medium   { background: var(--warning-light); color: #92400e; }
.badge-priority-low      { background: var(--success-light); color: #166534; }
.badge-category          { background: var(--primary-light); color: var(--primary-dark); }

/* ── Stats bar ─────────────────────────────────────────────── */
.stats-bar {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.stat-number { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label  { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 600; }

.stat-clickable { cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.stat-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-active { background: var(--primary) !important; }
.stat-active .stat-label { color: rgba(255,255,255,.75); }

/* ── Date header ───────────────────────────────────────────── */
.date-header     { margin-bottom: 16px; }
.date-greeting   { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.date-display    { font-size: 22px; font-weight: 800; color: var(--text); }

/* ── Section header ────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.section-title { font-size: 15px; font-weight: 700; color: var(--text); }
.section-count {
  font-size: 12px; color: var(--text-muted);
  background: var(--border); padding: 2px 8px;
  border-radius: 999px; font-weight: 700;
}

/* ── Filter chips ──────────────────────────────────────────── */
.filter-chips {
  display: flex; gap: 6px;
  overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 5px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  border: 1.5px solid var(--border);
  color: var(--text-muted); background: var(--bg-card);
  transition: all .15s;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Tag filter row (Today page) ───────────────────────────── */
.tags-filter-row {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 4px; margin-bottom: 10px;
  scrollbar-width: none;
}
.tags-filter-row::-webkit-scrollbar { display: none; }
.tag-filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1.5px solid var(--tc, var(--border));
  color: var(--tc, var(--text-muted));
  background: transparent; cursor: pointer;
  transition: all .15s; flex-shrink: 0;
}
.tag-filter-chip.tfc-active { background: var(--tc); color: #fff; }
.tag-fc-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Top filter bar (All Tasks — date icon + tag chips) ─────── */
.top-filter-bar {
  display: flex; align-items: center; gap: 5px;
  overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px;
  scrollbar-width: none;
}
.top-filter-bar::-webkit-scrollbar { display: none; }

.top-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text-muted);
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.top-chip.top-chip-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.tag-top-chip { border-color: var(--tc); color: var(--tc); background: transparent; }
.tag-top-chip.top-chip-active { background: var(--tc); color: #fff; border-color: var(--tc); }

.date-chip-wrapper { position: relative; display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.date-chip { font-size: 13px; padding: 4px 10px; min-width: 34px; justify-content: center; }
.date-chip-input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%; border: none; background: transparent;
}
.date-chip-clear {
  position: relative; z-index: 1;
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--text-muted);
  border: 1px solid var(--border); background: var(--bg-card);
  transition: all .15s;
}
.date-chip-clear:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ── All tasks / Search ────────────────────────────────────── */
.all-tasks-header  { margin-bottom: 14px; }
.all-tasks-title   { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.search-bar        { display: flex; gap: 8px; margin-bottom: 10px; }
.search-input {
  flex: 1; padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 14px;
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon  { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.empty-desc  { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: flex-end;
  animation: fade-in .2s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--bg-modal);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 20px 32px;
  max-height: 92vh; overflow-y: auto;
  animation: slide-up .25s cubic-bezier(.25,.8,.25,1);
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border); border-radius: 999px;
  margin: 0 auto 18px;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 18px; color: var(--text); }

/* ── Form ──────────────────────────────────────────────────── */
.form-group  { margin-bottom: 14px; }
.form-label  {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .6px;
}
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-group   { display: flex; gap: 6px; }
.btn-option  {
  flex: 1; padding: 9px 6px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 12px; font-weight: 700;
  color: var(--text-muted); background: var(--bg);
  text-align: center; cursor: pointer;
  transition: all .15s; text-transform: capitalize;
}
.btn-option.selected                   { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-option.priority-high.selected     { border-color: var(--danger);  color: var(--danger);  background: var(--danger-light); }
.btn-option.priority-medium.selected   { border-color: var(--warning); color: var(--warning); background: var(--warning-light); }
.btn-option.priority-low.selected      { border-color: var(--success); color: var(--success); background: var(--success-light); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; width: 100%; margin-top: 6px; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--border); }

/* ── Suggestion chips ──────────────────────────────────────── */
.suggestion-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.suggestion-chip  {
  padding: 3px 10px; border-radius: 999px;
  border: 1.5px solid var(--primary); color: var(--primary);
  font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .15s; background: transparent;
}
.suggestion-chip:hover { background: var(--primary); color: #fff; }

/* ── Detail screen ─────────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700;
  color: var(--primary); margin-bottom: 14px;
  transition: opacity .15s;
}
.back-btn:hover { opacity: .75; }

.detail-header {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.detail-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 10px; line-height: 1.3; }
.detail-meta  { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-info { display: none; }

.status-section {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.status-section-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.status-btns { display: flex; gap: 8px; }
.status-btn {
  flex: 1; padding: 10px 6px;
  border-radius: var(--radius-sm); border: 2px solid var(--border);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all .15s; text-align: center;
  color: var(--text-muted); background: var(--bg);
  text-transform: capitalize;
}
.status-btn.active.pending    { border-color: #94a3b8;         background: #f1f5f9;              color: #475569; }
.status-btn.active.inprogress { border-color: var(--info);    background: var(--info-light);    color: var(--info); }
.status-btn.active.onhold     { border-color: var(--warning); background: var(--warning-light); color: #c2410c; }
.status-btn.active.done       { border-color: var(--success); background: var(--success-light); color: #15803d; }
.status-btn:not(.active):hover{ background: var(--border); }

/* ── Timeline ──────────────────────────────────────────────── */
.timeline {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.timeline-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.timeline-item  {
  display: flex; gap: 12px; position: relative;
  padding-bottom: 16px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 11px; top: 22px;
  width: 2px; height: calc(100% - 10px); background: var(--border);
}
.timeline-dot {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; margin-top: 1px; border: 2px solid;
}
.timeline-dot.pending    { background: #f1f5f9;           color: #64748b; border-color: #94a3b8; }
.timeline-dot.inprogress { background: var(--info-light);    color: var(--info);    border-color: var(--info); }
.timeline-dot.done       { background: var(--success-light); color: #15803d; border-color: var(--success); }
.timeline-status { font-size: 13px; font-weight: 700; text-transform: capitalize; }
.timeline-note   { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.timeline-time   { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ── Detail info list ──────────────────────────────────────── */
.detail-info-list  { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.detail-info-row   { display: flex; justify-content: space-between; align-items: center; }
.detail-info-row .info-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.detail-info-row .info-value { font-size: 14px; font-weight: 700; color: var(--text); }

/* ── Daily note section ────────────────────────────────────── */
.daily-note-section {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.daily-note-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.daily-note-section textarea { resize: none; font-size: 13px; }

/* ── Timeline note entry ───────────────────────────────────── */
.timeline-dot.note {
  background: var(--bg); color: var(--text-muted);
  border-color: var(--border); font-size: 12px;
}
.note-edit-btn {
  font-size: 11px; color: var(--primary); margin-top: 4px;
  padding: 0; font-weight: 600; opacity: .8;
  transition: opacity .15s;
}
.note-edit-btn:hover { opacity: 1; }
.note-edit-input { resize: vertical; font-size: 13px; margin-top: 4px; }
.note-edit-actions { display: flex; gap: 6px; margin-top: 6px; }

/* ── Done banner ───────────────────────────────────────────── */
.done-banner {
  background: var(--success-light); color: #15803d;
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 14px; font-weight: 700;
  margin-bottom: 12px; text-align: center;
  box-shadow: var(--shadow);
}

/* ── Detail actions ────────────────────────────────────────── */
.detail-actions { display: flex; gap: 10px; margin-bottom: 16px; }

/* ── Weekly view ───────────────────────────────────────────── */
.week-nav {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.week-nav-title { font-size: 16px; font-weight: 800; text-align: center; }
.week-nav-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); box-shadow: var(--shadow);
  font-size: 18px; font-weight: 700; transition: background .15s;
}
.week-nav-btn:hover  { background: var(--border); }

.week-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.week-stat-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.week-stat-value { font-size: 24px; font-weight: 800; color: var(--primary); line-height: 1; }
.week-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-weight: 600; }

.day-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.day-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 12px 14px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); cursor: pointer; transition: all .15s;
  border: 2px solid transparent;
}
.day-card:hover    { transform: translateX(2px); box-shadow: var(--shadow-md); }
.day-card.today    { border-color: var(--primary); }

.day-date         { width: 42px; text-align: center; flex-shrink: 0; }
.day-name         { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.day-num          { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.day-card.today .day-num { color: var(--primary); }

.day-progress     { flex: 1; }
.day-task-summary { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.progress-bar     { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill    {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .4s ease;
}

.day-count        { text-align: right; flex-shrink: 0; }
.day-total        { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1; }
.day-total-label  { font-size: 10px; color: var(--text-muted); font-weight: 600; }

/* ── Status note textarea ──────────────────────────────────── */
.status-note-area textarea { resize: none; }

/* ── Date field (overlay trick) ────────────────────────────── */
.date-field         { position: relative; display: block; }
.date-field-display {
  display: block; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  font-size: 14px; cursor: pointer; min-height: 42px;
  line-height: 1.4; transition: border-color .2s;
}
.date-field-display.ph { color: var(--text-light); }
.date-field:focus-within .date-field-display { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.date-field-input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
  border: none; background: transparent;
}

/* ── Required star ─────────────────────────────────────────── */
.req { color: var(--danger); margin-left: 2px; }

/* ── Hidden tasks note ─────────────────────────────────────── */
.hidden-note {
  text-align: center; font-size: 12px; color: var(--text-muted);
  padding: 10px; margin-top: 6px;
  background: var(--bg-card); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* ── Stats bar — 4 columns on today view ───────────────────── */
.stats-bar.four { grid-template-columns: repeat(4,1fr); }

/* ── Tag add button + popup in form ────────────────────────── */
.form-tags-area  { display: flex; flex-direction: column; gap: 6px; }
.form-tag-plus {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px dashed var(--primary);
  background: var(--primary-light); color: var(--primary);
  font-size: 20px; font-weight: 300; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.form-tag-plus:hover { background: var(--primary); color: #fff; border-style: solid; }

.form-tag-popup {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm); padding: 8px 10px;
  animation: slide-up .18s ease;
}
.form-tag-popup input {
  flex: 1; border: none; background: transparent;
  padding: 0; font-size: 13px; outline: none; box-shadow: none;
}
.popup-add-btn {
  padding: 4px 12px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
  white-space: nowrap; transition: background .15s;
}
.popup-add-btn:hover    { background: var(--primary-dark); }
.popup-cancel-btn       { color: var(--text-muted); font-size: 14px; padding: 2px 4px; transition: color .15s; }
.popup-cancel-btn:hover { color: var(--danger); }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container  { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); max-width: 280px;
  animation: toast-in .25s ease, toast-out .3s ease 2.8s forwards;
}
.toast.success { background: var(--success); color: #fff; }
.toast.error   { background: var(--danger);  color: #fff; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(16px); } }

/* ── Sync warning box ──────────────────────────────────────── */
.sync-warning p code { background: var(--border); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ── Tags page ─────────────────────────────────────────────── */
.color-swatches  { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.color-swatch.active { border-color: var(--text); transform: scale(1.15); }

.tag-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.tag-card:hover { transform: translateX(2px); box-shadow: var(--shadow-md); }

.tag-dot-lg {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
}
.tag-info     { flex: 1; min-width: 0; }
.tag-name     { font-size: 14px; font-weight: 700; color: var(--text); }
.tag-meta     { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.cat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.cat-row:last-child { border-bottom: none; padding-bottom: 0; }
.cat-name { font-size: 14px; font-weight: 600; color: var(--text); }

.tag-locked-badge {
  font-size: 14px; opacity: .45; flex-shrink: 0;
  cursor: default;
}

.tag-delete-btn {
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 11px; color: var(--text-light);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; flex-shrink: 0;
}
.tag-delete-btn:hover { background: var(--danger-light); color: var(--danger); }

/* Task card tag dots */
.task-tag-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* Task form tag pills */
.form-tags-row { display: flex; gap: 6px; flex-wrap: wrap; }
.form-tag-pill {
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 2px solid var(--tc, var(--border));
  color: var(--tc, var(--text-muted));
  background: transparent; cursor: pointer;
  transition: all .15s;
}
.form-tag-pill.selected {
  background: var(--tc, var(--primary));
  color: #fff;
}

/* Active tag filter banner */
.active-tag-filter {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 10px; flex-wrap: wrap;
}
.active-tag-label {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.clear-tag-filter {
  font-size: 12px; font-weight: 600;
  color: var(--danger); cursor: pointer;
  padding: 2px 8px; border-radius: 999px;
  border: 1.5px solid var(--danger); transition: all .15s;
}
.clear-tag-filter:hover { background: var(--danger); color: #fff; }

/* ── Safe area (iPhone notch) ──────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .screen-container { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 76px); }
}

/* ── Login Screen ──────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.login-screen.hidden { display: none; }

.login-wrap {
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 4px;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.login-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.login-tabs {
  display: flex;
  gap: 0;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}

.login-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}

.login-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 8px;
  font-size: 13px;
}

/* ── Logout button ─────────────────────────────────────────── */
.logout-btn {
  padding: 6px 12px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}

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

/* ── Admin panel ───────────────────────────────────────────── */
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: none; }
.admin-user-email { font-size: 14px; font-weight: 600; color: var(--text); }
.admin-user-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.admin-user-actions { display: flex; gap: 6px; }
.admin-action-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.admin-action-btn.danger { border-color: var(--danger); color: var(--danger); }

/* ── Password toggle ───────────────────────────────────────── */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input {
  width: 100%;
  padding-right: 40px;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  color: var(--text-muted);
}

/* ── Today progress bar ────────────────────────────────────── */
.today-progress {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 16px 12px;
  box-shadow: var(--shadow);
}

.today-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.today-progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.today-progress-pct {
  font-size: 13px;
  font-weight: 700;
}

/* ── Custom calendar picker ────────────────────────────────── */
.cal-popup {
  position: fixed;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 12px;
  width: 260px;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-month-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.cal-nav-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 6px;
  line-height: 1;
}

.cal-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.cal-grid-head div {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  position: relative;
  text-align: center;
  font-size: 12px;
  padding: 5px 2px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}

.cal-day:hover { background: var(--primary-light); }

.cal-day.cal-today {
  font-weight: 700;
  color: var(--primary);
}

.cal-day.cal-selected {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.cal-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warning);
  margin: 1px auto 0;
}

.cal-day.cal-selected .cal-dot { background: rgba(255,255,255,.8); }

.date-chip-wrapper { position: relative; }

.cal-dot-done { background: var(--success); }
.cal-day.cal-all-done { color: var(--success); font-weight: 700; }
.cal-day.cal-all-done.cal-selected { color: #fff; }
