/* === WishTracker - AI-Tech + Warm Sunshine Theme === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Core palette: deep tech blues + warm amber/gold */
  --bg-deep: #0B1120;
  --bg-card: #131B2E;
  --bg-card-hover: #1A2540;
  --bg-surface: #0F172A;
  --bg-input: #1E293B;

  --accent: #F59E0B;       /* warm amber */
  --accent-light: #FBBF24;
  --accent-glow: rgba(245, 158, 11, 0.25);
  --accent-soft: rgba(245, 158, 11, 0.08);

  --blue: #3B82F6;
  --blue-glow: rgba(59, 130, 246, 0.2);
  --teal: #14B8A6;
  --teal-bg: rgba(20, 184, 166, 0.12);
  --green: #22C55E;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red: #EF4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --orange: #F97316;
  --orange-bg: rgba(249, 115, 22, 0.12);
  --purple: #A855F7;
  --purple-bg: rgba(168, 85, 247, 0.12);

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);

  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font: "PingFang SC","Microsoft YaHei","Hiragino Sans GB","Noto Sans CJK SC",system-ui,sans-serif;
  --font-mono: "SF Mono","Fira Code",monospace;

  --sidebar-w: 220px;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
h1,h2,h3 { font-weight: 600; letter-spacing: -0.02em; }
input,textarea,select,button { font-family: var(--font); font-size: 0.95rem; }

/* === Screens === */
.screen { display: none; }
.screen.active { display: flex; }

/* === LOGIN === */
.login-bg {
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(245,158,11,0.1) 0%, transparent 50%),
              var(--bg-deep);
}
.login-particles {
  position: fixed; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 60% 30%, rgba(245,158,11,0.3), transparent),
    radial-gradient(1px 1px at 80% 60%, rgba(59,130,246,0.3), transparent),
    radial-gradient(1px 1px at 50% 90%, rgba(255,255,255,0.15), transparent);
}
.login-container {
  width: 380px; padding: 2.5rem;
  background: rgba(19, 27, 46, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow), 0 0 60px rgba(59,130,246,0.08);
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-logo-icon {
  width: 56px; height: 56px; margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--blue), var(--accent));
  border-radius: 14px; position: relative;
  box-shadow: 0 0 30px var(--accent-glow);
}
.login-logo-icon::after {
  content: ''; position: absolute; inset: 6px;
  background: var(--bg-card); border-radius: 10px;
}
.login-brand h1 { font-size: 1.6rem; color: var(--text-primary); }
.login-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.3rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.input-group { position: relative; }
.input-group input {
  width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-group input::placeholder { color: var(--text-muted); }
.input-icon {
  position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem;
}
.error-text { color: var(--red); font-size: 0.85rem; text-align: center; min-height: 1.2em; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.4rem; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 500; transition: all 0.2s; white-space: nowrap;
}
.btn-glow {
  background: linear-gradient(135deg, var(--accent), #D97706);
  color: #1a1a1a; font-weight: 600;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-glow:hover { box-shadow: 0 0 30px rgba(245,158,11,0.4); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #1a1a1a; font-weight: 600; }
.btn-accent:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.05rem; }

/* === MAIN LAYOUT === */
#main-screen { display: none; width: 100vw; min-height: 100vh; }
#main-screen.active { display: flex; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 1.2rem 1rem; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 1.05rem; color: var(--text-primary);
}
.brand-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--accent));
  position: relative;
}
.brand-icon::after {
  content: ''; position: absolute; inset: 4px;
  background: var(--bg-surface); border-radius: 5px;
}
.sidebar-nav { flex: 1; padding: 0.5rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.8rem; border: none; background: none;
  color: var(--text-secondary); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.92rem; transition: all 0.15s; width: 100%; text-align: left;
}
.sidebar-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.si-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; }
.sidebar-user {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1rem; border-top: 1px solid var(--border);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: white; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }
.btn-logout {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 0.3rem; font-size: 1rem; transition: color 0.2s;
}
.btn-logout:hover { color: var(--red); }

/* === CONTENT AREA === */
.content-area {
  margin-left: var(--sidebar-w); flex: 1; min-height: 100vh;
  padding: 1.5rem 2rem;
  background: radial-gradient(ellipse at 80% 10%, rgba(59,130,246,0.04) 0%, transparent 50%),
              radial-gradient(ellipse at 20% 90%, rgba(245,158,11,0.03) 0%, transparent 50%),
              var(--bg-deep);
}
.view { display: none; }
.view.active { display: block; }
.view-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.5rem; }
.view-topbar h2 { font-size: 1.4rem; }

/* === CARD === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-hover); }
.card h3 { margin-bottom: 0.8rem; font-size: 1rem; }

/* === WISHES GRID === */
.wishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.wish-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  cursor: pointer;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
.wish-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--accent));
  opacity: 0.7;
}
.wish-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-2px);
}
.wish-card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.3rem; }
.wish-card-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wish-card-meta { display: flex; gap: 0.8rem; font-size: 0.78rem; color: var(--text-muted); }
.wish-card-progress { margin-top: 0.8rem; }
.wish-progress-bar { height: 4px; background: var(--bg-input); border-radius: 2px; overflow: hidden; }
.wish-progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--accent)); border-radius: 2px; transition: width 0.5s; }
.wish-progress-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; display: flex; justify-content: space-between; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* === STATUS BADGE === */
.status-badge {
  padding: 0.2rem 0.7rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.status-active { background: var(--green-bg); color: var(--green); }
.status-draft { background: var(--bg-input); color: var(--text-muted); }
.status-completed { background: var(--teal-bg); color: var(--teal); }
.status-paused { background: var(--orange-bg); color: var(--orange); }

/* === SUB TABS === */
.sub-tabs {
  display: flex; gap: 0.3rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border); padding-bottom: 0.5rem;
}
.sub-tab {
  padding: 0.5rem 1rem; border: none; background: none;
  color: var(--text-muted); cursor: pointer; font-size: 0.9rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all 0.2s; position: relative;
}
.sub-tab:hover { color: var(--text-primary); background: var(--bg-card); }
.sub-tab.active { color: var(--accent); font-weight: 600; }
.sub-tab.active::after {
  content: ''; position: absolute; bottom: -0.5px; left: 0.5rem; right: 0.5rem;
  height: 2px; background: var(--accent); border-radius: 1px;
}
.subtab-panel { display: none; }
.subtab-panel.active { display: block; }

/* === STATS GRID (OVERVIEW) === */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.2rem; text-align: center;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-value.blue { color: var(--blue); }
.stat-value.green { color: var(--green); }
.stat-value.teal { color: var(--teal); }
.progress-bar-sm { height: 5px; background: var(--bg-input); border-radius: 3px; margin-top: 0.5rem; overflow: hidden; }
.progress-fill-sm { height: 100%; background: linear-gradient(90deg, var(--blue), var(--accent)); border-radius: 3px; transition: width 0.5s; }

/* === PHASE PROGRESS === */
.phase-list { display: flex; flex-direction: column; gap: 0.8rem; }
.phase-item { display: flex; align-items: center; gap: 1rem; }
.phase-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.phase-info { flex: 1; }
.phase-name { font-weight: 600; font-size: 0.9rem; }
.phase-bar { height: 6px; background: var(--bg-input); border-radius: 3px; margin-top: 0.3rem; overflow: hidden; }
.phase-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.phase-pct { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); min-width: 3rem; text-align: right; }

/* === CHECKPOINT === */
.checkpoint-alert {
  background: var(--orange-bg); border: 1px solid rgba(249,115,22,0.3);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem;
}
.checkpoint-alert h4 { color: var(--orange); margin-bottom: 0.5rem; }
.checkpoint-condition { padding: 0.2rem 0; font-size: 0.9rem; color: var(--text-secondary); }
.checkpoint-condition::before { content: '\25A1 '; color: var(--orange); }

/* === WEEK NAVIGATOR === */
.week-navigator { display: flex; align-items: center; gap: 0.5rem; }
.week-display { font-weight: 600; min-width: 5rem; text-align: center; font-size: 0.95rem; }

/* === DAY SELECTOR === */
.day-selector { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.day-btn {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer; font-weight: 600;
  transition: all 0.2s; font-size: 0.85rem;
}
.day-btn:hover { border-color: var(--accent); color: var(--accent); }
.day-btn.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }

/* === TASK LIST === */
.task-list { display: flex; flex-direction: column; gap: 0.5rem; }
.task-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.8rem 1rem;
  display: flex; align-items: flex-start; gap: 0.8rem;
  border-left: 3px solid var(--text-muted);
  transition: all 0.2s;
}
.task-item:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.task-item.priority-critical { border-left-color: var(--red); }
.task-item.priority-high { border-left-color: var(--orange); }
.task-item.priority-normal { border-left-color: var(--blue); }
.task-item.status-completed { opacity: 0.5; }
.task-item.status-deferred { opacity: 0.6; }
.task-checkbox {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--text-muted); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 0.15rem; transition: all 0.2s;
}
.task-checkbox:hover { border-color: var(--accent); }
.task-checkbox.checked { background: var(--green); border-color: var(--green); }
.task-checkbox.checked::after { content: '\2713'; font-size: 0.7rem; color: white; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 0.92rem; }
.task-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }
.task-meta { display: flex; gap: 0.4rem; margin-top: 0.4rem; flex-wrap: wrap; }
.task-tag {
  font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 6px;
  background: var(--bg-input); color: var(--text-muted);
}
.task-tag.cat-bridge_income { background: var(--purple-bg); color: var(--purple); }
.task-tag.cat-boarding { background: var(--green-bg); color: var(--green); }
.task-tag.cat-training { background: var(--blue-glow); color: var(--blue); }
.task-tag.cat-research { background: rgba(245,158,11,0.12); color: var(--accent); }
.task-tag.cat-operations { background: var(--red-bg); color: var(--red); }
.task-tag.cat-mindset { background: var(--purple-bg); color: var(--purple); }
.task-tag.tag-daily { background: var(--teal-bg); color: var(--teal); }
.task-tag.tag-deferred { background: var(--orange-bg); color: var(--orange); }
.task-tag.tag-from { background: var(--blue-glow); color: var(--blue); }
.task-actions { flex-shrink: 0; }
.task-action-btn {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.2rem 0.5rem;
  font-size: 0.75rem; cursor: pointer; color: var(--text-secondary);
  transition: all 0.2s;
}
.task-action-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* === FILTER BAR === */
.filter-bar { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.filter-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.4rem 1rem; border-radius: 20px; cursor: pointer;
  font-size: 0.85rem; color: var(--text-secondary); transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }

/* === REPORT FORM === */
.report-form { }
.form-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.5rem; margin-bottom: 1rem;
}
.form-section h3 { margin-bottom: 0.8rem; font-size: 1rem; color: var(--text-primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group textarea, .form-group select {
  padding: 0.6rem 0.8rem; background: var(--bg-input);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow);
}
.form-group textarea { resize: vertical; min-height: 2.5rem; }
.form-actions { display: flex; gap: 0.8rem; margin-top: 1rem; flex-wrap: wrap; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.help-text { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.settings-form { max-width: 420px; }

/* === ADJUSTMENTS === */
.adjust-item {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.8rem 1rem;
  margin-bottom: 0.5rem; border-left: 3px solid var(--blue);
}
.adjust-item .adjust-reason { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.adjust-item .adjust-title { font-weight: 600; font-size: 0.92rem; }
.adjust-item .adjust-desc { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* === HISTORY === */
.history-tabs { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.history-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 0.8rem;
}
.history-item h4 { color: var(--accent); margin-bottom: 0.3rem; }
.history-item .meta { font-size: 0.82rem; color: var(--text-muted); }

/* === ADMIN TABLE === */
.admin-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.admin-table th {
  text-align: left; padding: 0.8rem 1rem;
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 0.82rem; font-weight: 600; border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-card-hover); }
.admin-actions { display: flex; gap: 0.4rem; }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 480px;
  box-shadow: var(--shadow), 0 0 40px rgba(0,0,0,0.3);
  max-height: 85vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: 0.2rem;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.2rem 1.5rem; }

/* === TOAST === */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--accent);
  color: var(--text-primary); padding: 0.7rem 1.5rem;
  border-radius: var(--radius); font-size: 0.9rem; z-index: 300;
  box-shadow: 0 0 20px var(--accent-glow);
  animation: toastIn 0.3s;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* === HIDDEN / UTILS === */
.hidden { display: none !important; }
.admin-only { display: none; }
/* Admin elements: only reveal cards, buttons, table cells — never views or containers */
body.is-admin .card.admin-only { display: block; }
body.is-admin button.sidebar-item.admin-only { display: flex; }
body.is-admin td.admin-only { display: table-cell; }

/* === AI CHAT MODAL === */
.chat-container { display: flex; flex-direction: column; height: 55vh; min-height: 300px; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 0.5rem 0;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.chat-msg {
  max-width: 85%; padding: 0.7rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; line-height: 1.6; word-break: break-word;
}
.chat-msg.user {
  align-self: flex-end; background: var(--accent); color: #1a1a1a; border-bottom-right-radius: 2px;
}
.chat-msg.ai {
  align-self: flex-start; background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border); border-bottom-left-radius: 2px;
}
.chat-msg.system {
  align-self: center; background: var(--bg-input); color: var(--text-muted);
  font-size: 0.82rem; padding: 0.4rem 0.8rem; border-radius: 20px;
}
.chat-msg.error {
  align-self: center; background: var(--red-bg); color: var(--red);
  font-size: 0.85rem; padding: 0.5rem 1rem; border-radius: var(--radius-sm);
}
.chat-input-area {
  display: flex; gap: 0.5rem; padding-top: 0.8rem;
  border-top: 1px solid var(--border); margin-top: 0.5rem;
}
.chat-input-area input {
  flex: 1; padding: 0.6rem 1rem; background: var(--bg-input);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); outline: none; font-size: 0.9rem;
}
.chat-input-area input:focus { border-color: var(--accent); }
.chat-typing { color: var(--text-muted); font-size: 0.82rem; padding: 0.3rem 0; }
.chat-typing::after { content: '...'; animation: dots 1.5s infinite; }
@keyframes dots { 0%,20%{content:'.'} 40%{content:'..'} 60%,100%{content:'...'} }

/* Plan preview in chat */
.plan-preview {
  background: var(--bg-surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 1.2rem; margin-top: 0.8rem;
  box-shadow: 0 0 20px var(--accent-glow);
}
.plan-preview h4 { color: var(--accent); margin-bottom: 0.8rem; }
.plan-phase-preview {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0; font-size: 0.88rem;
}
.plan-phase-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.plan-task-count { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }
.plan-confirm-area { display: flex; gap: 0.8rem; margin-top: 1rem; }

/* Wider modal for chat */
.modal.modal-wide { max-width: 600px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    width: 100%; height: auto; min-height: auto;
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    flex-direction: row; border-right: none; border-top: 1px solid var(--border);
    z-index: 100;
  }
  .sidebar-brand { display: none; }
  .sidebar-nav { flex-direction: row; padding: 0.3rem; flex: 1; justify-content: center; }
  .si-label { display: none; }
  .sidebar-user { display: none; }
  .content-area { margin-left: 0; padding: 1rem; padding-bottom: 4rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .wishes-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  html { font-size: 14px; }
}
