/* ══════════════════════════════════════════════════════════
   Insight — TML Hub  |  style.css
   ══════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-primary:    #4f46e5;
  --c-primary-h:  #4338ca;
  --c-sidebar:    #0f172a;
  --c-sidebar-h:  #1e293b;
  --c-bg:         #f1f5f9;
  --c-surface:    #ffffff;
  --c-border:     #e2e8f0;
  --c-text:       #0f172a;
  --c-muted:      #64748b;
  --c-pending:    #f59e0b;
  --c-ongoing:    #3b82f6;
  --c-completed:  #10b981;
  --c-overdue:    #ef4444;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font: inherit; }

/* ── Layout ───────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-icon {
  font-size: 1.75rem;
  color: var(--c-primary);
  line-height: 1;
}
.brand-icon--lg { font-size: 2.5rem; }
.brand-name { font-size: .95rem; font-weight: 700; color: #f1f5f9; }
.brand-sub  { font-size: .7rem;  color: #64748b; margin-top: .1rem; }

.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  padding: .75rem .5rem .3rem;
  margin-top: .25rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: 8px;
  color: #94a3b8;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { background: var(--c-sidebar-h); color: #e2e8f0; text-decoration: none; }
.nav-link.active { background: var(--c-primary); color: #fff; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-avatar-placeholder {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name  { font-size: .8rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: .7rem; color: #64748b; }
.logout-btn {
  color: #64748b;
  display: flex; align-items: center;
  transition: color .15s;
}
.logout-btn:hover { color: var(--c-overdue); text-decoration: none; }
.logout-btn svg { width: 16px; height: 16px; }

/* ── Main / Topbar ────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: .875rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.topbar-email {
  font-size: .78rem;
  color: var(--c-muted);
}
.dept-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #ede9fe;
  color: var(--c-primary);
  font-size: .73rem;
  font-weight: 600;
  padding: .22rem .65rem;
  border-radius: 999px;
}
.dept-badge--admin {
  background: #fef3c7;
  color: #92400e;
}

.content {
  padding: 1.5rem 1.75rem 2rem;
  flex: 1;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}
.form-card { max-width: 760px; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }

/* ── Stat cards ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--total     { background: #e0e7ff; color: var(--c-primary); }
.stat-icon--pending   { background: #fef3c7; color: var(--c-pending); }
.stat-icon--ongoing   { background: #dbeafe; color: var(--c-ongoing); }
.stat-icon--completed { background: #d1fae5; color: var(--c-completed); }
.stat-icon--overdue   { background: #fee2e2; color: var(--c-overdue); }

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}
.stat-label {
  font-size: .75rem;
  color: var(--c-muted);
  font-weight: 500;
  margin-top: .2rem;
}

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .855rem;
}
.table thead th {
  background: #f8fafc;
  padding: .65rem 1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.td-num  { color: var(--c-muted); width: 40px; text-align: center; }
.td-actions { white-space: nowrap; }
.empty-row { text-align: center; color: var(--c-muted); padding: 2rem !important; }
.task-link { font-weight: 600; color: var(--c-text); }
.task-link:hover { color: var(--c-primary); text-decoration: none; }
.task-title { font-weight: 600; }
.task-desc  { font-size: .78rem; color: var(--c-muted); margin-top: .15rem; }
.text-red   { color: var(--c-overdue); font-weight: 600; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge--pending   { background: #fef3c7; color: #92400e; }
.badge--ongoing   { background: #dbeafe; color: #1e40af; }
.badge--completed { background: #d1fae5; color: #065f46; }
.badge--overdue   { background: #fee2e2; color: #991b1b; }

.dept-pill {
  background: #f0f4ff;
  color: #3730a3;
  font-size: .72rem;
  font-weight: 600;
  padding: .18rem .55rem;
  border-radius: 999px;
}

.role-badge {
  display: inline-block;
  font-size: .72rem; font-weight: 700;
  padding: .18rem .55rem;
  border-radius: 999px;
  text-transform: capitalize;
}
.role-badge--admin   { background: #ede9fe; color: #5b21b6; }
.role-badge--manager { background: #fef3c7; color: #92400e; }
.role-badge--staff   { background: #f0f9ff; color: #0369a1; }

.sso-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600;
  color: #4285F4;
  background: #eff6ff;
  padding: .18rem .55rem;
  border-radius: 999px;
}

/* ── Inline status dropdown ───────────────────────────── */
.status-select {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: .25rem .5rem;
  font-size: .8rem;
  cursor: pointer;
  background: #f8fafc;
  transition: border .15s;
}
.status-select:focus { outline: none; border-color: var(--c-primary); }

/* ── User table avatars ───────────────────────────────── */
.table-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: .4rem;
}
.table-avatar-init {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: .72rem; font-weight: 700;
  vertical-align: middle;
  margin-right: .4rem;
}

/* ── Dept select (users table) ────────────────────────── */
.dept-select {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: .25rem .5rem;
  font-size: .8rem;
  background: #f8fafc;
  max-width: 180px;
}

/* ── Filter bar ───────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}
.filter-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.filter-input,
.filter-select {
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .45rem .75rem;
  font-size: .85rem;
  background: var(--c-surface);
  height: 38px;
}
.filter-input { min-width: 180px; }
.filter-select { min-width: 140px; }
.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  height: 38px;
}
.btn--primary {
  background: var(--c-primary);
  color: #fff;
}
.btn--primary:hover { background: var(--c-primary-h); text-decoration: none; color: #fff; }
.btn--outline {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn--outline:hover { background: #f8fafc; text-decoration: none; }
.btn--danger {
  background: #fee2e2;
  color: var(--c-overdue);
  border: 1px solid #fca5a5;
}
.btn--danger:hover { background: #fecaca; text-decoration: none; }
.btn--sm { height: 32px; padding: .3rem .75rem; font-size: .8rem; }
.btn--full { width: 100%; }
.btn--google {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow);
  height: 44px;
}
.btn--google:hover { background: #f8fafc; text-decoration: none; }

/* ── Forms ────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1.1rem;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--c-text);
}
.req { color: var(--c-overdue); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .55rem .8rem;
  font-size: .875rem;
  width: 100%;
  transition: border .15s, box-shadow .15s;
  background: var(--c-surface);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
textarea { resize: vertical; min-height: 90px; }
.field-hint { font-size: .75rem; color: var(--c-muted); margin-top: .2rem; }

.form-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--c-border);
}

/* Task view (staff read-only) */
.task-view-block { margin-bottom: 1rem; }
.task-view-label { font-size: .75rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.task-view-value { font-size: .9rem; color: var(--c-text); }

/* ── Alerts ───────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.alert--error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ── Auth page ────────────────────────────────────────── */
.auth-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.auth-wrap  { width: 100%; max-width: 420px; }
.auth-card  {
  background: var(--c-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 2.5rem;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.auth-brand-text h1 { font-size: 1.4rem; font-weight: 800; }
.auth-brand-text p  { font-size: .8rem; color: var(--c-muted); margin-top: .1rem; }
.auth-form { margin-bottom: 1.25rem; }
.auth-divider {
  text-align: center;
  position: relative;
  margin: 1.25rem 0;
  color: var(--c-muted);
  font-size: .78rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 55px);
  height: 1px;
  background: var(--c-border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-note {
  text-align: center;
  font-size: .75rem;
  color: var(--c-muted);
  margin-top: 1rem;
}
.btn--sso {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  height: 48px;
  font-size: .9rem;
  gap: .6rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: background .15s, box-shadow .15s;
}
.btn--sso:hover { background: #1e293b; text-decoration: none; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.auth-info-box {
  background: #f8fafc;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .9rem 1rem;
  font-size: .78rem;
  color: var(--c-muted);
  line-height: 1.7;
}
.auth-info-box strong { color: var(--c-text); }
.auth-info-box ul { margin: .25rem 0 .25rem 1.1rem; }
.auth-divider { border: none; border-top: 1px solid var(--c-border); margin: 1.25rem 0; }

/* ── Inline form ──────────────────────────────────────── */
.inline-form { display: inline; }

/* ── Toast notification ───────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  color: #f1f5f9;
  padding: .7rem 1.2rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast--success { border-left: 4px solid var(--c-completed); }
#toast.toast--error   { border-left: 4px solid var(--c-overdue); }

/* ── Utilities ────────────────────────────────────────── */
.tc   { text-align: center; }
.mb-6 { margin-bottom: 1.5rem; }

/* ── Stat icon colors (routine / adhoc) ───────────────── */
.stat-icon--routine { background: #f0fdf4; color: #16a34a; }
.stat-icon--adhoc   { background: #fff7ed; color: #ea580c; }

/* ── Employee stats table ─────────────────────────────── */
.emp-name-cell {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.stat-num {
  font-weight: 700;
  font-size: .95rem;
  color: var(--c-text);
}

/* ── Employee status dots (count pills) ───────────────── */
.emp-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}
.emp-dot--pending   { background: #fef3c7; color: #92400e; }
.emp-dot--ongoing   { background: #dbeafe; color: #1e40af; }
.emp-dot--completed { background: #d1fae5; color: #065f46; }
.emp-dot--overdue   { background: #fee2e2; color: #991b1b; }

/* ── Category pills (in employee table) ───────────────── */
.cat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: .15rem .45rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
}
.cat-pill--routine { background: #f0fdf4; color: #15803d; }
.cat-pill--adhoc   { background: #fff7ed; color: #c2410c; }

/* ── Category badges (in task rows) ──────────────────── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  padding: .18rem .55rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.cat-badge--routine { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.cat-badge--adhoc   { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* ── Notification Bell ────────────────────────────────── */
.notif-bell {
  position: relative;
}
.notif-btn {
  position: relative;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--c-muted);
  transition: background .15s, color .15s;
}
.notif-btn:hover { background: #f8fafc; color: var(--c-text); }
.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--c-overdue);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  min-width: 16px; height: 16px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  line-height: 1;
}
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-border);
  background: #f8fafc;
}
.notif-dropdown-title { font-size: .85rem; font-weight: 700; }
.notif-read-all-btn {
  font-size: .75rem;
  color: var(--c-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.notif-read-all-btn:hover { text-decoration: underline; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item {
  display: block;
  padding: .75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  transition: background .12s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item-msg  { font-size: .82rem; color: var(--c-text); line-height: 1.4; }
.notif-item-time { font-size: .72rem; color: var(--c-muted); margin-top: .2rem; }
.notif-loading, .notif-empty {
  padding: 1.25rem 1rem;
  font-size: .82rem;
  color: var(--c-muted);
  text-align: center;
}

/* ── Task View Page ───────────────────────────────────── */
.view-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.task-detail-card {}
.task-detail-header {
  align-items: flex-start;
}
.task-detail-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 .5rem;
  line-height: 1.3;
}
.task-detail-badges {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.task-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem 1.5rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}
.task-meta-item {}
.task-desc-block {
  padding: 1rem 1.25rem;
}
.task-desc-body {
  font-size: .9rem;
  color: var(--c-text);
  line-height: 1.7;
  white-space: pre-wrap;
  margin-top: .3rem;
}
.task-view-columns {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* ── Recurring badge ──────────────────────────────────── */
.recur-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: #fdf4ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
  font-size: .72rem;
  font-weight: 700;
  padding: .18rem .55rem;
  border-radius: 6px;
}

/* ── Recurring form toggle ────────────────────────────── */
.recur-group { margin-bottom: 1.1rem; }
.recur-toggle-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}
.recur-toggle-label input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--c-primary);
}
.recur-select {
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .45rem .75rem;
  font-size: .875rem;
  background: var(--c-surface);
  min-width: 180px;
}

/* ── Activity Log ─────────────────────────────────────── */
.log-list {
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.log-empty {
  padding: 1.25rem;
  text-align: center;
  font-size: .82rem;
  color: var(--c-muted);
}
.log-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.log-item:last-child { border-bottom: none; }
.log-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  background: #f1f5f9;
  color: var(--c-muted);
}
.log--created   .log-icon { background: #d1fae5; color: #065f46; }
.log--updated   .log-icon { background: #dbeafe; color: #1e40af; }
.log--status    .log-icon { background: #fef3c7; color: #92400e; }
.log--comment   .log-icon { background: #ede9fe; color: #5b21b6; }
.log--recurring .log-icon { background: #fdf4ff; color: #7c3aed; }
.log-body { flex: 1; min-width: 0; }
.log-actor { font-size: .8rem; font-weight: 700; color: var(--c-text); }
.log-detail {
  font-size: .8rem;
  color: var(--c-muted);
  margin-top: .1rem;
  word-break: break-word;
}
.log-time {
  font-size: .72rem;
  color: #94a3b8;
  margin-top: .15rem;
}

/* ── Comments ─────────────────────────────────────────── */
.comment-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  padding: 0 4px;
  margin-left: .35rem;
  vertical-align: middle;
}
.comment-list {
  padding: .5rem 0;
}
.comment-empty {
  padding: 1.25rem;
  text-align: center;
  font-size: .82rem;
  color: var(--c-muted);
}
.comment-item {
  display: flex;
  gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar-wrap { flex-shrink: 0; }
.comment-avatar-img {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.comment-avatar-init {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}
.comment-content { flex: 1; min-width: 0; }
.comment-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
  flex-wrap: wrap;
}
.comment-author {
  font-size: .82rem;
  font-weight: 700;
  color: var(--c-text);
}
.comment-time {
  font-size: .72rem;
  color: var(--c-muted);
}
.comment-delete-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 .2rem;
  margin-left: auto;
  transition: color .15s;
}
.comment-delete-btn:hover { color: var(--c-overdue); }
.comment-body-text {
  font-size: .85rem;
  color: var(--c-text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.mention-tag {
  color: var(--c-primary);
  font-weight: 600;
  background: #ede9fe;
  padding: .05rem .3rem;
  border-radius: 4px;
  font-size: .82rem;
}

/* Comment compose box */
.comment-compose {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--c-border);
  background: #f8fafc;
}
.comment-form { flex: 1; }
.comment-input {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .6rem .8rem;
  font-size: .875rem;
  font-family: inherit;
  background: #fff;
  resize: vertical;
  min-height: 72px;
  transition: border .15s, box-shadow .15s;
}
.comment-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.mention-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin: .5rem 0 .4rem;
}
.mention-chips-label {
  font-size: .72rem;
  color: var(--c-muted);
  font-weight: 600;
}
.mention-chip {
  background: #ede9fe;
  color: var(--c-primary);
  border: none;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .5rem;
  cursor: pointer;
  transition: background .15s;
}
.mention-chip:hover { background: #ddd6fe; }
.comment-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .5rem;
}
.comment-char-count {
  font-size: .72rem;
  color: var(--c-muted);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .task-view-columns { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 200px; min-width: 200px; }
  .content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .notif-dropdown { width: 290px; right: -60px; }
}
@media (max-width: 600px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem; }
  .nav-section-label { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
