:root {
  --primary: #534AB7;
  --primary-light: #ECEAF7;
  --primary-dark: #3D359E;
  --accent: #F59E0B;
  --success: #0F6E56;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --bg: #F5F4FF;
  --sidebar-bg: #1E1A3F;
  --sidebar-text: #C4C0E8;
  --sidebar-active: #534AB7;
  --card-bg: #FFFFFF;
  --border: #E5E3F5;
  --text: #1A1635;
  --text-muted: #7C77A8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Login ── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #2D2760 100%);
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 48px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.login-sub { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 32px; }
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.login-card input[type="password"]:focus { border-color: var(--primary); }
.btn-login {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-login:hover { background: var(--primary-dark); }
.login-error { color: var(--danger); font-size: 0.8rem; margin-top: 8px; display: none; }

/* ── Layout ── */
#app { display: none; min-height: 100vh; }
.app-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
aside {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand-name { font-weight: 800; color: white; font-size: 1.05rem; }
.sidebar-brand-sub { color: var(--sidebar-text); font-size: 0.75rem; margin-top: 2px; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-label { color: rgba(255,255,255,0.3); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0 8px; margin: 16px 0 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all .15s;
  font-size: 0.875rem;
  font-weight: 500;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.btn-logout {
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text);
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(239,68,68,0.2); color: #FCA5A5; }

/* ── Main content ── */
main {
  padding: 32px;
  overflow-y: auto;
}
.page-header {
  margin-bottom: 28px;
}
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(83,74,183,0.08), 0 4px 16px rgba(83,74,183,0.04);
  border: 1px solid var(--border);
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-weight: 700; font-size: 0.95rem; }
.card-body { padding: 20px; }

/* ── KPI Cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(83,74,183,0.06);
}
.kpi-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 2rem; font-weight: 800; color: var(--text); margin: 6px 0 2px; line-height: 1; }
.kpi-target { font-size: 0.78rem; color: var(--text-muted); }
.kpi-bar { height: 4px; background: var(--border); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.kpi-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7B6FE0); border-radius: 4px; transition: width .6s ease; }

/* ── Todo items ── */
.todo-list { display: flex; flex-direction: column; gap: 6px; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all .15s;
}
.todo-item:hover { border-color: var(--primary); }
.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--text-muted); }
.todo-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.todo-check:hover { border-color: var(--primary); }
.todo-check.checked { background: var(--primary); border-color: var(--primary); }
.todo-check.checked::after { content: '✓'; color: white; font-size: 0.7rem; font-weight: 700; }
/* ── View Toggle ── */
.view-toggle { display:flex; gap:6px; }
.view-toggle-btn { padding:7px 16px; border-radius:8px; border:1.5px solid var(--border); background:white; font-size:0.8rem; font-weight:600; cursor:pointer; color:var(--text-muted); transition:all .15s; }
.view-toggle-btn.active { background:var(--primary); color:white; border-color:var(--primary); }

/* ── Calendar ── */
.cal-nav { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.cal-nav-btn { width:34px; height:34px; border-radius:8px; border:1.5px solid var(--border); background:white; font-size:1.2rem; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .15s; color:var(--text-muted); }
.cal-nav-btn:hover { border-color:var(--primary); color:var(--primary); }
.cal-month-label { font-size:1.05rem; font-weight:800; flex:1; }
.cal-today-btn { padding:6px 14px; border-radius:8px; border:1.5px solid var(--border); background:white; font-size:0.78rem; font-weight:600; cursor:pointer; color:var(--text-muted); transition:all .15s; }
.cal-today-btn:hover { border-color:var(--primary); color:var(--primary); }
.cal-dow-row { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:4px; }
.cal-dow-row div { text-align:center; font-size:0.7rem; font-weight:700; color:var(--text-muted); padding:6px 0; text-transform:uppercase; letter-spacing:0.04em; }
.cal-dow-row .dow-sun { color:#EF4444; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:16px; }
.cal-cell { min-height:96px; background:white; border-radius:8px; border:1.5px solid var(--border); padding:6px 5px; cursor:pointer; transition:border-color .15s; position:relative; overflow:hidden; }
.cal-cell:hover { border-color:var(--primary); }
.cal-cell.today { border-color:var(--primary); }
.cal-cell.other-month { background:var(--bg); }
.cal-cell.other-month .cal-cell-num { opacity:0.35; }
.cal-cell.selected { border-color:var(--primary); background:var(--primary-light); }
.cal-cell.has-overdue:not(.today) { border-color:#FCA5A5; }
.cal-cell-num { width:22px; height:22px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:0.75rem; font-weight:700; color:var(--text-muted); margin-bottom:3px; }
.cal-cell.today .cal-cell-num { background:var(--primary); color:white; }
.cal-chip { display:flex; align-items:center; gap:3px; font-size:0.67rem; font-weight:500; padding:2px 5px; border-radius:4px; margin-bottom:2px; overflow:hidden; background:var(--primary-light); color:var(--text); cursor:pointer; transition:background .1s; white-space:nowrap; max-width:100%; }
.cal-chip:hover { background:rgba(83,74,183,.18); }
.cal-chip.done { background:#F0FDF4; color:var(--text-muted); text-decoration:line-through; }
.cal-chip.overdue { background:#FEE2E2; color:#B91C1C; }
.cal-chip-dot { width:5px; height:5px; border-radius:50%; flex-shrink:0; }
.cal-chip-dot.high { background:#EF4444; }
.cal-chip-dot.medium { background:var(--accent); }
.cal-chip-dot.low { background:#D1D5DB; }
.cal-chip-text { overflow:hidden; text-overflow:ellipsis; min-width:0; }
.cal-more { font-size:0.62rem; color:var(--text-muted); padding-left:2px; }
.cal-cell-add { position:absolute; bottom:3px; right:4px; background:none; border:none; cursor:pointer; font-size:0.72rem; color:var(--text-muted); opacity:0; transition:opacity .15s; border-radius:4px; padding:2px 4px; line-height:1; }
.cal-cell:hover .cal-cell-add { opacity:1; }
.cal-cell-add:hover { background:var(--primary-light); color:var(--primary); }

/* Day panel */
.cal-day-panel { background:white; border:1.5px solid var(--primary); border-radius:12px; padding:16px; margin-bottom:12px; display:none; }
.cal-day-panel.open { display:block; }
.cal-day-panel-hdr { font-weight:800; font-size:0.9rem; margin-bottom:12px; display:flex; align-items:center; justify-content:space-between; }
.cal-day-panel-close { background:none; border:none; cursor:pointer; font-size:1rem; color:var(--text-muted); padding:2px 6px; border-radius:6px; }
.cal-day-panel-close:hover { background:var(--bg); color:var(--danger); }
.cal-day-task-list { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.cal-day-task-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px; border:1px solid var(--border); background:white; font-size:0.855rem; font-weight:500; transition:background .1s; }
.cal-day-task-item:hover { background:var(--bg); }
.cal-day-task-item.done { text-decoration:line-through; color:var(--text-muted); background:#F0FDF4; }
.cal-day-task-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; cursor:pointer; }
.cal-day-task-dot.high { background:#EF4444; }
.cal-day-task-dot.medium { background:var(--accent); }
.cal-day-task-dot.low { background:#D1D5DB; }
.cal-day-task-title { flex:1; cursor:pointer; }
.cal-day-task-del { background:none; border:none; cursor:pointer; color:var(--border); font-size:0.8rem; padding:2px 4px; border-radius:4px; }
.cal-day-task-del:hover { color:var(--danger); background:#FEE2E2; }
.cal-day-add { display:flex; flex-direction:column; gap:6px; }
.cal-day-add-row { display:flex; gap:6px; }
.cal-day-add-inp { flex:1; padding:8px 10px; border:1.5px solid var(--primary); border-radius:8px; font-size:0.855rem; font-family:inherit; outline:none; }
.cal-day-prio { padding:7px 8px; border:1.5px solid var(--border); border-radius:8px; font-size:0.78rem; cursor:pointer; outline:none; background:white; }
.cal-day-add-btn { padding:8px 16px; background:var(--primary); color:white; border:none; border-radius:8px; font-size:0.8rem; font-weight:600; cursor:pointer; white-space:nowrap; }

/* Undated bin */
.cal-undated { background:var(--bg); border-radius:12px; padding:14px; border:1.5px dashed var(--border); }
.cal-undated-hdr { font-size:0.72rem; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.05em; margin-bottom:10px; display:flex; align-items:center; gap:8px; }
.cal-undated-hdr span { background:white; border:1px solid var(--border); border-radius:20px; padding:1px 8px; font-size:0.7rem; }
.cal-undated-chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.cal-undated-chip { display:flex; align-items:center; gap:6px; background:white; border:1px solid var(--border); border-radius:8px; padding:6px 10px; font-size:0.8rem; font-weight:500; cursor:pointer; transition:all .15s; position:relative; }
.cal-undated-chip:hover { border-color:var(--primary); background:var(--primary-light); }
.cal-undated-chip.done { opacity:0.55; text-decoration:line-through; }
.cal-undated-chip-del { background:none; border:none; cursor:pointer; color:var(--border); font-size:0.72rem; margin-left:2px; line-height:1; padding:0 2px; }
.cal-undated-chip-del:hover { color:var(--danger); }
.cal-undated-add-btn { background:none; border:1.5px dashed var(--border); border-radius:8px; color:var(--text-muted); font-size:0.78rem; padding:7px 14px; cursor:pointer; transition:all .15s; width:100%; text-align:left; }
.cal-undated-add-btn:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-light); }
.cal-undated-add-form { display:none; flex-direction:column; gap:6px; margin-top:8px; }
.cal-undated-add-form.open { display:flex; }

@media (max-width:768px) {
  .cal-grid { gap:2px; }
  .cal-cell { min-height:54px; padding:3px; }
  .cal-chip { font-size:0.58rem; padding:1px 3px; }
  .cal-cell-num { width:16px; height:16px; font-size:0.65rem; }
}

/* ── Kanban Board ── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: var(--bg);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.kanban-col.drag-over { border-color: var(--primary); background: var(--primary-light); }
.kanban-col-header {
  padding: 12px 14px 10px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.kanban-col-icon { font-size: 1rem; }
.kanban-col-title { font-weight: 800; font-size: 0.85rem; flex: 1; }
.kanban-col-count {
  font-size: 0.72rem; font-weight: 700;
  background: white; border: 1px solid var(--border);
  border-radius: 20px; padding: 1px 8px; color: var(--text-muted);
}
.kanban-cards {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 80px;
  flex: 1;
}
.kanban-card {
  background: white;
  border-radius: 10px;
  padding: 12px 12px 10px;
  border: 1px solid var(--border);
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow .15s, transform .1s;
  position: relative;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(83,74,183,0.12); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.45; cursor: grabbing; }
.kanban-card-title { font-size: 0.855rem; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 8px; padding-right: 20px; }
.kanban-card-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.kanban-card-del {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; cursor: pointer;
  font-size: 0.8rem; color: var(--border);
  opacity: 0; transition: opacity .15s; padding: 2px;
  border-radius: 4px; line-height: 1;
}
.kanban-card:hover .kanban-card-del { opacity: 1; }
.kanban-card-del:hover { color: var(--danger); background: #FEE2E2; }
.kanban-priority-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.kanban-priority-dot.high { background: #EF4444; }
.kanban-priority-dot.medium { background: var(--accent); }
.kanban-priority-dot.low { background: #D1D5DB; }

/* Quick-add per kolom */
.kanban-add-area { padding: 0 10px 10px; }
.kanban-add-btn {
  width: 100%; padding: 8px; background: none;
  border: 1.5px dashed var(--border); border-radius: 8px;
  color: var(--text-muted); font-size: 0.8rem; cursor: pointer;
  transition: all .15s; text-align: left;
}
.kanban-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.kanban-add-form { display: none; }
.kanban-add-form.open { display: flex; flex-direction: column; gap: 6px; }
.kanban-add-input {
  width: 100%; padding: 8px 10px;
  border: 1.5px solid var(--primary); border-radius: 8px;
  font-size: 0.855rem; font-family: inherit; outline: none;
  resize: none;
}
.kanban-add-row { display: flex; gap: 5px; }
.kanban-add-save {
  flex: 1; padding: 7px; background: var(--primary); color: white;
  border: none; border-radius: 7px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.kanban-add-cancel {
  padding: 7px 10px; background: var(--border); color: var(--text-muted);
  border: none; border-radius: 7px; font-size: 0.8rem; cursor: pointer;
}
.kanban-priority-sel {
  padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 0.78rem; cursor: pointer; outline: none; background: white;
}

/* Done column — sedikit redup */
.kanban-col.col-done .kanban-card { opacity: 0.7; }
.kanban-col.col-done .kanban-card:hover { opacity: 1; }
.kanban-col.col-done .kanban-card-title { text-decoration: line-through; color: var(--text-muted); }

@media (max-width: 768px) {
  .kanban-board { grid-template-columns: 1fr; }
}

.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 0.875rem; font-weight: 500; }
.todo-meta { display: flex; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.badge {
  font-size: 0.68rem; font-weight: 600; padding: 2px 7px; border-radius: 20px; display: inline-flex; align-items: center; gap: 3px;
}
.badge-high { background: #FEE2E2; color: #B91C1C; }
.badge-medium { background: #FEF3C7; color: #92400E; }
.badge-low { background: #F3F4F6; color: #6B7280; }
.badge-category { background: var(--primary-light); color: var(--primary); }
.badge-due { background: #FFF1F2; color: #BE123C; }
.badge-due.ok { background: #F0FDF4; color: #166534; }
.todo-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.todo-item:hover .todo-actions { opacity: 1; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 0.9rem; color: var(--text-muted); padding: 2px 4px; border-radius: 4px; transition: all .15s; }
.btn-icon:hover { background: var(--bg); color: var(--danger); }

/* ── Daily checklist ── */
.daily-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.daily-item:hover { border-color: var(--primary); }
.daily-item.done { background: var(--success-light); border-color: #6EE7B7; }
.daily-item.done .daily-title { color: var(--success); font-weight: 600; }
.daily-circle {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.75rem; transition: all .15s;
}
.daily-item.done .daily-circle { background: var(--success); border-color: var(--success); color: white; }
.daily-title { font-size: 0.875rem; font-weight: 500; flex: 1; }
.daily-category { font-size: 0.7rem; color: var(--text-muted); }

/* ── Notes ── */
.note-item {
  padding: 14px 16px;
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  position: relative;
}
.note-type-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.note-type-note .note-type-dot { background: var(--primary); }
.note-type-decision .note-type-dot { background: var(--accent); }
.note-type-insight .note-type-dot { background: var(--success); }
.note-type-blocker .note-type-dot { background: var(--danger); }
.note-meta { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; margin-bottom: 6px; }
.note-content { font-size: 0.875rem; line-height: 1.6; white-space: pre-wrap; }
.note-del { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; opacity: 0; transition: opacity .15s; }
.note-item:hover .note-del { opacity: 1; }

/* ── Forms ── */
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  background: white;
}
.input:focus { border-color: var(--primary); }
.input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
select.input { cursor: pointer; }

/* ── Buttons ── */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { background: #FEE2E2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

/* ── Progress ring ── */
.progress-ring { display: flex; align-items: center; gap: 12px; }
.ring { width: 60px; height: 60px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 5; }
.ring-fill { fill: none; stroke: var(--primary); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }

/* ── Misc ── */
.section-title { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; margin-top: 24px; }
.section-title:first-child { margin-top: 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.875rem; }
.empty-state-icon { font-size: 2rem; margin-bottom: 8px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.loading { color: var(--text-muted); text-align: center; padding: 24px; font-size: 0.875rem; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--sidebar-bg);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  transform: translateY(80px);
  opacity: 0;
  transition: all .25s;
  z-index: 999;
  max-width: 280px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { background: var(--success); }
#toast.error { background: var(--danger); }

/* ── Phase Accordion (menggantikan MVP Grid + MVP Task Details) ── */
.phase-overall-bar { margin-bottom: 20px; }
.phase-accordion-item {
  background: white; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 8px; overflow: hidden; transition: border-color .15s;
}
.phase-accordion-item.has-done { border-color: #6EE7B7; }
.phase-accordion-header {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; cursor: pointer; user-select: none;
  transition: background .1s;
}
.phase-accordion-header:hover { background: var(--bg); }
.phase-accordion-icon { font-size: 0.8rem; color: var(--text-muted); transition: transform .2s; flex-shrink: 0; }
.phase-accordion-item.open .phase-accordion-icon { transform: rotate(90deg); }
.phase-accordion-name { font-weight: 700; font-size: 0.9rem; flex: 1; }
.phase-accordion-progress {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.phase-accordion-count { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.phase-mini-bar { width: 60px; height: 5px; background: var(--border); border-radius: 5px; overflow: hidden; }
.phase-mini-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7B6FE0); border-radius: 5px; transition: width .4s; }
.phase-accordion-body { display: none; border-top: 1px solid var(--border); }
.phase-accordion-item.open .phase-accordion-body { display: block; }
.phase-task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer; transition: background .1s;
  font-size: 0.855rem; border-bottom: 1px solid var(--border);
}
.phase-task-row:last-child { border-bottom: none; }
.phase-task-row:hover { background: var(--bg); }
.phase-task-row.done { background: #F0FDF4; }
.phase-task-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 800; transition: all .15s;
}
.phase-task-row.done .phase-task-dot { background: var(--success); border-color: var(--success); color: white; }
.phase-task-label { flex: 1; font-weight: 500; }
.phase-task-row.done .phase-task-label { text-decoration: line-through; color: var(--text-muted); }

/* Validation Milestone bar */
.validation-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; background: var(--bg);
  border-radius: 10px; margin-bottom: 10px;
  border: 1px dashed var(--border);
}
.validation-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 20px; transition: all .15s;
  border: 1.5px solid var(--border); background: white;
  user-select: none;
}
.validation-item.done { background: var(--success-light); border-color: #6EE7B7; color: var(--success); }
.validation-label-text { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); margin-right: auto; }

/* Eksekusi task items (di Command tab) */
.exec-task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; cursor: pointer; transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.exec-task-item:last-child { border-bottom: none; }
.exec-task-item:hover { background: var(--bg); }
.exec-task-item.done { background: #F0FDF4; }
.exec-task-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 800; transition: all .15s;
}
.exec-task-item.done .exec-task-dot { background: var(--success); border-color: var(--success); color: white; }
.exec-task-label { flex: 1; font-size: 0.855rem; font-weight: 500; }
.exec-task-item.done .exec-task-label { text-decoration: line-through; color: var(--text-muted); }
.exec-task-fase { font-size: 0.67rem; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }

/* Progress bar (MVP + Revenue) */
.progress-bar-track { height: 8px; background: var(--border); border-radius: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7B6FE0); border-radius: 8px; transition: width .6s ease; }

/* Revenue Table inline edit */
.rev-actual-cell { cursor: pointer; text-decoration: underline dotted; color: var(--primary); font-weight: 600; }
.rev-inline-input { width: 110px; padding: 4px 8px; border: 1.5px solid var(--primary); border-radius: 6px; font-size: 0.85rem; text-align: right; outline: none; }
.rev-progress-mini { height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 4px; min-width: 80px; }
.rev-progress-mini-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7B6FE0); border-radius: 4px; transition: width .4s; }

/* Sprint Checklist */
.sprint-target-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: white; cursor: pointer; transition: all .15s; user-select: none;
}
.sprint-target-item:hover { border-color: var(--primary); }
.sprint-target-item.done { background: var(--success-light); border-color: #6EE7B7; }
.sprint-target-item.done .sprint-target-text { text-decoration: line-through; color: var(--success); }
.sprint-target-circle { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.75rem; transition: all .15s; }
.sprint-target-item.done .sprint-target-circle { background: var(--success); border-color: var(--success); color: white; }

/* Content Calendar */
.content-stats-row { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.content-stat-pill {
  display:flex; align-items:center; gap:6px;
  background:white; border:1px solid var(--border); border-radius:20px;
  padding:6px 14px; font-size:0.8rem; font-weight:600; color:var(--text-muted);
}
.content-stat-pill strong { color:var(--text); }

.content-week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }

.content-day-card {
  background: var(--card-bg); border-radius: 12px;
  border-top: 3px solid var(--border);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 12px 10px; text-align: center; position: relative;
  transition: transform .15s;
}
.content-day-card:hover { transform: translateY(-2px); }

/* Day types */
.content-day-card.type-live { border-top-color: #EF4444; }
.content-day-card.type-live .content-day-name { color: #DC2626; }
.content-day-card.type-prep { border-top-color: var(--accent); }
.content-day-card.type-prep .content-day-name { color: #92400E; }
.content-day-card.type-production { border-top-color: #0EA5E9; }
.content-day-card.type-production .content-day-name { color: #0369A1; }
.content-day-card.type-review { border-top-color: var(--success); }
.content-day-card.type-review .content-day-name { color: var(--success); }
.content-day-card.type-rest { border-top-color: #D1D5DB; background: var(--bg); }
.content-day-card.type-rest .content-day-name { color: #9CA3AF; }
.content-day-card.type-default { border-top-color: var(--primary); }
.content-day-card.type-default .content-day-name { color: var(--primary); }

/* Today highlight ring */
.content-day-card.today-card { box-shadow: 0 0 0 2px var(--primary); }

.content-day-type-badge {
  display:inline-block; font-size:0.6rem; font-weight:700; text-transform:uppercase;
  letter-spacing:0.06em; padding:2px 6px; border-radius:20px;
  background:var(--bg); color:var(--text-muted); margin-bottom:6px;
}
.type-live .content-day-type-badge { background:#FEE2E2; color:#B91C1C; }
.type-prep .content-day-type-badge { background:#FEF3C7; color:#92400E; }
.type-production .content-day-type-badge { background:#E0F2FE; color:#0369A1; }
.type-review .content-day-type-badge { background:var(--success-light); color:var(--success); }
.type-rest .content-day-type-badge { background:#F3F4F6; color:#9CA3AF; }

.content-day-name { font-weight: 800; font-size: 0.9rem; margin-bottom: 2px; }
.content-day-slot { font-size: 0.73rem; color: var(--text); line-height: 1.5; min-height: 48px; }
.content-day-duration {
  display:inline-block; font-size:0.68rem; color:var(--text-muted);
  margin-top:8px; font-weight:700; background:var(--bg);
  padding:2px 8px; border-radius:20px;
}

.content-edit-btn { position: absolute; top: 6px; right: 6px; background: none; border: none; font-size: 0.75rem; cursor: pointer; color: var(--text-muted); opacity: 0; transition: opacity .15s; padding: 2px 4px; border-radius: 4px; }
.content-day-card:hover .content-edit-btn { opacity: 1; }
.content-edit-form { display: none; margin-top: 8px; text-align: left; }
.content-edit-form.open { display: block; }
.content-edit-form textarea { width: 100%; border: 1.5px solid var(--primary); border-radius: 6px; padding: 5px 7px; font-size: 0.75rem; font-family: inherit; resize: none; outline: none; }
.content-edit-form .input-dur { width: 100%; border: 1.5px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 0.75rem; outline: none; margin-top: 4px; }
.content-edit-form .edit-actions { display: flex; gap: 5px; margin-top: 5px; }
.content-edit-form .btn-save-small { background: var(--primary); color: white; border: none; border-radius: 5px; padding: 4px 10px; font-size: 0.72rem; cursor: pointer; }
.content-edit-form .btn-cancel-small { background: var(--border); color: var(--text-muted); border: none; border-radius: 5px; padding: 4px 8px; font-size: 0.72rem; cursor: pointer; }

/* 8 Konten Tracker */
.content-8-grid {
  display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-top:0;
}
.content-8-item {
  display:flex; align-items:center; gap:10px;
  background:white; border:1px solid var(--border); border-radius:10px;
  padding:11px 14px; cursor:pointer; transition:all .15s; user-select:none;
}
.content-8-item:hover { border-color:var(--primary); }
.content-8-item.done { background:var(--success-light); border-color:#6EE7B7; }
.content-8-circle {
  width:22px; height:22px; border-radius:50%; border:2px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; font-size:0.7rem; transition:all .15s;
}
.content-8-item.done .content-8-circle { background:var(--success); border-color:var(--success); color:white; }
.content-8-info { flex:1; min-width:0; }
.content-8-name { font-size:0.82rem; font-weight:700; }
.content-8-sub { font-size:0.68rem; color:var(--text-muted); }
.content-8-icon { font-size:1.1rem; }
.content-8-reset {
  background:none; border:1.5px solid var(--border); border-radius:8px;
  color:var(--text-muted); font-size:0.75rem; padding:5px 12px; cursor:pointer;
  transition:all .15s;
}
.content-8-reset:hover { border-color:var(--danger); color:var(--danger); }

@media (max-width:768px) {
  .content-8-grid { grid-template-columns:1fr 1fr; }
}

/* ── Mission Brief ───────────────────────────────────────────────────────── */
.mission-header {
  background: var(--sidebar-bg);
  border-radius: 16px;
  padding: 22px 26px;
  margin-bottom: 14px;
  color: white;
}
.mission-header-date {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255,255,255,0.4); margin-bottom: 10px;
}
.mission-header-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.mission-header-title { font-size: 1.25rem; font-weight: 800; color: white; }
.mission-phase-pill {
  font-size: 0.75rem; font-weight: 600;
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.85);
  padding: 5px 14px; border-radius: 20px;
}
.mission-days-left {
  font-size: 1.4rem; font-weight: 800; color: var(--accent); letter-spacing: -0.02em;
}

.mission-revenue-card {
  background: white; border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 22px; margin-bottom: 12px;
}
.mission-rev-header {
  display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 10px;
}
.mission-rev-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.mission-rev-amount { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.mission-rev-pct { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.mission-rev-target { font-size: 0.75rem; color: var(--text-muted); }
.mission-rev-track { height: 14px; background: var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 10px; }
.mission-rev-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, #7B6FE0 60%, var(--accent) 100%); border-radius: 14px; transition: width 1s cubic-bezier(.4,0,.2,1); }
.mission-rev-sources { display: flex; gap: 6px; flex-wrap: wrap; }
.mission-rev-source-tag {
  font-size: 0.68rem; color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 20px; padding: 3px 9px;
}

.mission-kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px;
}
.mission-kpi-pill {
  background: white; border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px; text-align: center;
}
.mission-kpi-pill-label {
  font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 5px;
}
.mission-kpi-pill-value {
  font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1;
}
.mission-kpi-pill-value span { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }

.mission-card {
  background: white; border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; margin-bottom: 12px;
}
.mission-card-header {
  background: var(--primary-light); padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(83,74,183,0.12);
}
.mission-card-title {
  font-size: 0.72rem; font-weight: 800; color: var(--primary-dark);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.mission-day-tag {
  font-size: 0.7rem; font-weight: 700;
  background: var(--primary); color: white;
  padding: 3px 11px; border-radius: 20px;
}
.mission-count-tag {
  font-size: 0.78rem; font-weight: 800; color: var(--primary);
}

.mission-task-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px; cursor: pointer; transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.mission-task-item:last-child { border-bottom: none; }
.mission-task-item:hover { background: var(--bg); }
.mission-task-item.done { background: #F0FDF4; }
.mission-task-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.65rem; font-weight: 800;
  transition: all .15s;
}
.mission-task-item.done .mission-task-dot {
  background: var(--success); border-color: var(--success); color: white;
}
.mission-task-label { flex: 1; font-size: 0.875rem; font-weight: 500; }
.mission-task-item.done .mission-task-label { text-decoration: line-through; color: var(--text-muted); }

.mission-checklist-grid {
  display: grid; grid-template-columns: 1fr 1fr;
}
.mission-check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; cursor: pointer; transition: background .1s;
  font-size: 0.845rem; font-weight: 500;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.mission-check-item:nth-child(even) { border-right: none; }
.mission-check-item:nth-last-child(-n+2) { border-bottom: none; }
.mission-check-item:hover { background: var(--bg); }
.mission-check-item.done { color: var(--success); background: #F0FDF4; }
.mission-check-icon { font-size: 0.85rem; flex-shrink: 0; width: 16px; }

/* Quick Links */
.quick-links-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-link-item { display: block; padding: 12px 14px; background: var(--card-bg); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; text-decoration: none; color: var(--text); transition: all .15s; }
.quick-link-item:hover { border-left-color: var(--accent); background: var(--primary-light); transform: translateY(-1px); }
.quick-link-icon { font-size: 1.1rem; margin-bottom: 4px; }
.quick-link-label { font-weight: 700; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-link-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .app-grid { grid-template-columns: 1fr; }
  aside {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: auto; flex-direction: row;
    padding: 6px 8px;
    z-index: 100;
  }
  .sidebar-brand, .sidebar-footer, .nav-label { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0; overflow-x: auto; gap: 2px; }
  .nav-item { flex-direction: column; gap: 2px; padding: 5px 8px; font-size: 0.6rem; text-align: center; white-space: nowrap; }
  .nav-icon { font-size: 1.2rem; }
  main { padding: 20px 16px 110px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .input-row { flex-direction: column; }
  .phase-mini-bar { width: 40px; }
  .content-week-grid { grid-template-columns: 1fr; }
  .quick-links-grid { grid-template-columns: 1fr 1fr; }
  .rev-progress-mini { display: none; }
  .mission-kpi-grid { grid-template-columns: 1fr 1fr; }
  .mission-checklist-grid { grid-template-columns: 1fr; }
  .mission-check-item { border-right: none; }
  .mission-check-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .mission-check-item:last-child { border-bottom: none; }
  .mission-rev-amount { font-size: 1.2rem; }
  .mission-rev-pct { font-size: 1.5rem; }
}

/* ── Revenue Tracker ─────────────────────────────────────────────────────── */

.rev-th {
  padding: 10px 16px; text-align: left; color: var(--text-muted);
  font-weight: 600; font-size: 0.78rem; border-bottom: 1px solid var(--border);
  background: var(--bg); text-transform: uppercase; letter-spacing: 0.04em;
}
.rev-td { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 0.855rem; }
.rev-source-row:last-of-type .rev-td { border-bottom: none; }

.rev-edit-btn, .rev-del-btn {
  background: none; border: none; cursor: pointer; font-size: 0.85rem;
  padding: 3px 5px; border-radius: 5px; transition: background .1s; opacity: 0.6;
}
.rev-edit-btn:hover { background: var(--primary-light); opacity: 1; }
.rev-del-btn:hover { background: #FEE2E2; opacity: 1; }

.rev-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-input {
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.855rem; font-family: inherit; outline: none; transition: border-color .15s; background: white;
}
.form-input:focus { border-color: var(--primary); }

.rev-log-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 0.855rem;
  transition: background .1s;
}
.rev-log-row:last-child { border-bottom: none; }
.rev-log-row:hover { background: var(--bg); }
.rev-log-date { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; min-width: 80px; }
.rev-log-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rev-log-label { font-weight: 600; font-size: 0.82rem; }
.rev-log-desc { font-size: 0.75rem; color: var(--text-muted); }
.rev-log-amount { font-weight: 700; color: var(--primary); white-space: nowrap; }
.rev-log-del {
  background: none; border: none; cursor: pointer; color: var(--border);
  font-size: 0.8rem; padding: 3px 6px; border-radius: 5px; opacity: 0; transition: all .15s;
}
.rev-log-row:hover .rev-log-del { opacity: 1; }
.rev-log-del:hover { color: #EF4444; background: #FEE2E2; }

.bop-gratis-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  background: #DCFCE7; color: #16A34A; font-size: 0.72rem; font-weight: 700;
}

@media (max-width: 600px) {
  .rev-form-grid { grid-template-columns: 1fr; }
  .rev-log-date { min-width: 60px; font-size: 0.7rem; }
}

/* ── AI Chat ─────────────────────────────────────────────────────────────── */

#ai-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: white; border: none;
  font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(83, 74, 183, 0.35);
  transition: transform .2s, box-shadow .2s;
}
#ai-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(83,74,183,0.45); }

.ai-panel {
  position: fixed; bottom: 88px; right: 24px; z-index: 998;
  width: 360px; max-height: 520px;
  background: white; border: 1.5px solid var(--border);
  border-radius: 16px; display: none; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14); overflow: hidden;
}
.ai-panel.open { display: flex; }

.ai-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
  background: var(--primary-light);
}
.ai-panel-header button {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: var(--text-muted); line-height: 1;
  padding: 2px 6px; border-radius: 4px;
}
.ai-panel-header button:hover { background: var(--border); }

.ai-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.ai-messages:empty::before {
  content: 'Tanya apapun tentang todo, KPI, revenue, atau sprint kamu.';
  display: block; color: var(--text-muted); font-size: 0.82rem;
  text-align: center; margin-top: 24px; line-height: 1.6;
}

.ai-bubble {
  max-width: 85%; padding: 9px 13px; border-radius: 12px;
  font-size: 0.85rem; line-height: 1.55; white-space: pre-wrap;
}
.ai-bubble.user {
  background: var(--primary); color: white;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.ai-bubble.assistant {
  background: var(--bg); color: var(--text);
  align-self: flex-start; border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}
.ai-bubble.loading { color: var(--text-muted); font-style: italic; }

.ai-input-row {
  display: flex; gap: 6px; padding: 10px 12px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
#ai-input {
  flex: 1; padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.85rem; outline: none;
  font-family: inherit; transition: border-color .15s;
}
#ai-input:focus { border-color: var(--primary); }
#ai-send {
  padding: 8px 14px; background: var(--primary); color: white;
  border: none; border-radius: 8px; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: background .15s;
  white-space: nowrap;
}
#ai-send:hover { background: var(--primary-dark); }

/* Confirm modal */
#ai-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1000; display: none;
  align-items: center; justify-content: center;
}
#ai-confirm-overlay.open { display: flex; }
.ai-confirm-box {
  background: white; border-radius: 16px; padding: 24px;
  width: 320px; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: ai-pop .15s ease;
}
@keyframes ai-pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ai-confirm-title { font-weight: 800; margin-bottom: 12px; font-size: 1rem; }
.ai-confirm-desc {
  font-size: 0.88rem; color: var(--text); margin-bottom: 20px;
  line-height: 1.6; background: var(--bg); border-radius: 8px; padding: 10px 12px;
}
.ai-confirm-btns { display: flex; gap: 8px; }
#ai-confirm-yes {
  flex: 1; padding: 10px; background: var(--primary); color: white;
  border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
  font-size: 0.85rem; transition: background .15s;
}
#ai-confirm-yes:hover { background: var(--primary-dark); }
#ai-confirm-no {
  flex: 1; padding: 10px; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 8px;
  font-weight: 600; cursor: pointer; font-size: 0.85rem;
}
#ai-confirm-no:hover { border-color: var(--text-muted); }

@media (max-width: 480px) {
  .ai-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
  #ai-fab { bottom: 20px; right: 16px; }
}

/* ══════════════════════════════════════════════════════════════
   AI PAGE TAB — Full-screen chat with markdown + typing anim
══════════════════════════════════════════════════════════════ */

main.ai-mode {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#tab-ai { display: none; flex-direction: column; height: 100%; overflow: hidden; }
#tab-ai.active { display: flex !important; }

/* Header */
.ai-page-header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.ai-page-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-page-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.ai-page-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Messages area */
.ai-page-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

/* Welcome screen */
.ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 40px 24px;
  gap: 6px;
  min-height: 300px;
}
.ai-welcome-glow {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), #7B6FE0);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(83,74,183,0.35);
}
.ai-welcome-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.ai-welcome-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 380px;
  line-height: 1.5;
  margin-top: 4px;
}
.ai-quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
  max-width: 580px;
}
.ai-quick-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.ai-quick-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* Message bubbles */
.ai-msg {
  display: flex;
  gap: 10px;
  animation: aiMsgIn .28s ease;
  max-width: 820px;
}
.ai-msg.user { flex-direction: row-reverse; align-self: flex-end; }
.ai-msg.assistant { align-self: flex-start; }

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

.ai-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.ai-msg.user .ai-msg-avatar {
  background: linear-gradient(135deg, var(--primary), #7B6FE0);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}
.ai-msg.assistant .ai-msg-avatar {
  background: var(--primary-light);
  color: var(--primary);
}

.ai-msg-bubble {
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.65;
  max-width: 72vw;
}
.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, var(--primary), #6A61D0);
  color: white;
  border-bottom-right-radius: 5px;
  max-width: 60vw;
}
.ai-msg.assistant .ai-msg-bubble {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(83,74,183,0.07);
}

/* Markdown rendering inside assistant bubble */
.ai-msg-content h1, .ai-msg-content h2, .ai-msg-content h3 {
  font-weight: 700; color: var(--text); margin: 12px 0 5px;
}
.ai-msg-content h1 { font-size: 1rem; }
.ai-msg-content h2 { font-size: 0.92rem; }
.ai-msg-content h3 { font-size: 0.85rem; }
.ai-msg-content p { margin: 5px 0; }
.ai-msg-content p:first-child { margin-top: 0; }
.ai-msg-content p:last-child { margin-bottom: 0; }
.ai-msg-content ul, .ai-msg-content ol { margin: 5px 0; padding-left: 20px; }
.ai-msg-content li { margin: 3px 0; }
.ai-msg-content strong { font-weight: 700; }
.ai-msg-content em { font-style: italic; }
.ai-msg-content a { color: var(--primary); text-decoration: underline; }
.ai-msg-content code {
  background: rgba(83,74,183,0.1);
  color: var(--primary-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
}
.ai-msg-content pre {
  background: #1E1A3F;
  color: #C4C0E8;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 0.8rem;
  line-height: 1.55;
  font-family: 'Courier New', monospace;
}
.ai-msg-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.ai-msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.82rem;
  border-radius: 8px;
  overflow: hidden;
}
.ai-msg-content th {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 9px 13px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
}
.ai-msg-content td {
  padding: 8px 13px;
  border-bottom: 1px solid var(--border);
}
.ai-msg-content tr:last-child td { border-bottom: none; }
.ai-msg-content tr:nth-child(even) td { background: var(--bg); }
.ai-msg-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  color: var(--text-muted);
  margin: 8px 0;
  font-style: italic;
}

/* Typing animation */
.ai-typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
}
.ai-typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: aiBounce 1.3s infinite ease-in-out;
}
.ai-typing-dots span:nth-child(2) { animation-delay: .18s; }
.ai-typing-dots span:nth-child(3) { animation-delay: .36s; }

@keyframes aiBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.ai-page-input-area {
  padding: 14px 28px 20px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  flex-shrink: 0;
}
.ai-page-input-box {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.ai-page-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(83,74,183,0.12);
}
.ai-page-textarea {
  width: 100%;
  padding: 14px 16px 8px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  min-height: 52px;
  max-height: 160px;
  overflow-y: auto;
  display: block;
}
.ai-page-textarea::placeholder { color: var(--text-muted); }
.ai-page-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 10px;
}
.ai-page-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.ai-page-send-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.ai-page-send-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.ai-page-send-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Date divider */
.ai-date-divider {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  margin: 4px 0;
}
.ai-date-divider::before, .ai-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border);
}
.ai-date-divider::before { left: 0; }
.ai-date-divider::after  { right: 0; }
