/* ==========================================================================
   THE CORE — Design System
   Minimalist · Bright · Premium · Scannable
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ───────────────────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --primary:       #4F6EF7;
  --primary-light: #EEF1FE;
  --primary-dark:  #3A56D4;
  --secondary:     #7C3AED;
  --secondary-light: #F3EFFE;

  /* Semantic Colors */
  --success:       #10B981;
  --success-light: #ECFDF5;
  --warning:       #F59E0B;
  --warning-light: #FFFBEB;
  --danger:        #EF4444;
  --danger-light:  #FEF2F2;
  --info:          #06B6D4;
  --info-light:    #ECFEFF;
  --purple:        #8B5CF6;
  --purple-light:  #F5F3FF;

  /* Neutral Scale */
  --n-50:  #F8FAFC;
  --n-100: #F1F5F9;
  --n-200: #E2E8F0;
  --n-300: #CBD5E1;
  --n-400: #94A3B8;
  --n-500: #64748B;
  --n-600: #475569;
  --n-700: #334155;
  --n-800: #1E293B;
  --n-900: #0F172A;

  /* Layout */
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --content-max:   1400px;

  /* Typography */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:       0.75rem;
  --text-sm:       0.8125rem;
  --text-base:     0.9375rem;
  --text-lg:       1.0625rem;
  --text-xl:       1.25rem;
  --text-2xl:      1.5rem;
  --text-3xl:      1.875rem;
  --fw-normal:     400;
  --fw-medium:     500;
  --fw-semibold:   600;
  --fw-bold:       700;
  --fw-extrabold:  800;

  /* Spacing (8px base) */
  --sp-1:   0.25rem;
  --sp-2:   0.5rem;
  --sp-3:   0.75rem;
  --sp-4:   1rem;
  --sp-5:   1.25rem;
  --sp-6:   1.5rem;
  --sp-8:   2rem;
  --sp-10:  2.5rem;
  --sp-12:  3rem;

  /* Radius */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .06), 0 1px 2px -1px rgb(0 0 0 / .04);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .07), 0 2px 4px -2px rgb(0 0 0 / .05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .08), 0 4px 6px -4px rgb(0 0 0 / .05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .10), 0 8px 10px -6px rgb(0 0 0 / .05);

  /* Transitions */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 350ms ease;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--n-800);
  background: var(--n-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

button { cursor: pointer; font-family: var(--font); border: none; background: none; }

::selection { background: var(--primary-light); color: var(--primary-dark); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--n-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--n-400); }

/* ── Layout — App Shell ──────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--n-100);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--t-slow);
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--n-100);
  text-decoration: none;
}

.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-mark svg { width: 20px; height: 20px; color: #fff; }

.sidebar-logo-text {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--n-900);
  letter-spacing: -0.02em;
}

.sidebar-logo-text span {
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--n-400);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--n-600);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: all var(--t-fast);
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--n-50);
  color: var(--n-900);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: var(--fw-semibold);
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: var(--fw-bold);
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--n-100);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  cursor: default;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--n-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--n-500);
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--n-100);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-8);
  gap: var(--sp-4);
  z-index: 90;
}

.topbar-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--n-900);
  letter-spacing: -0.02em;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ── Sidebar Overlay (mobile) ────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 98; /* below sidebar (100) so sidebar sits on top */
}

.sidebar-overlay.active {
  display: block;
}

.topbar-hamburger {
  display: none !important; /* hidden on desktop */
}

@media (max-width: 1024px) {
  .topbar-hamburger { display: flex !important; } /* only visible on mobile/tablet */
}

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  flex: 1;
}

.page-content {
  padding: var(--sp-8);
  max-width: var(--content-max);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--t-fast);
  font-family: var(--font);
  line-height: 1;
  height: 36px;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-secondary {
  background: var(--n-100);
  color: var(--n-700);
  border-color: transparent;
}
.btn-secondary:hover { background: var(--n-200); color: var(--n-900); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--n-200);
}
.btn-outline:hover { border-color: var(--primary); background: var(--primary-light); }

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

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--n-600);
}
.btn-ghost:hover { background: var(--n-100); color: var(--n-900); }

.btn-sm {
  height: 30px;
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 44px;
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-base);
}

.btn-icon {
  width: 36px;
  padding: 0;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--n-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--n-100);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--n-900);
}

.card-body { padding: var(--sp-6); }

.card-hover {
  cursor: pointer;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}

.kpi-card {
  background: #fff;
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  border: 1px solid var(--n-100);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  transition: all var(--t-base);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 24px; height: 24px; }

.kpi-icon-blue   { background: var(--primary-light); color: var(--primary); }
.kpi-icon-green  { background: var(--success-light); color: var(--success); }
.kpi-icon-amber  { background: var(--warning-light); color: var(--warning); }
.kpi-icon-red    { background: var(--danger-light);  color: var(--danger); }
.kpi-icon-purple { background: var(--purple-light);  color: var(--purple); }

.kpi-info { flex: 1; }

.kpi-value {
  font-size: var(--text-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--n-900);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi-label {
  font-size: var(--text-sm);
  color: var(--n-500);
  margin-top: var(--sp-1);
  font-weight: var(--fw-medium);
}

.kpi-trend {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  margin-top: var(--sp-2);
}
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.badge-neutral  { background: var(--n-100);          color: var(--n-600); }
.badge-blue     { background: var(--primary-light);  color: var(--primary-dark); }
.badge-green    { background: var(--success-light);  color: #065F46; }
.badge-amber    { background: var(--warning-light);  color: #92400E; }
.badge-red      { background: var(--danger-light);   color: #991B1B; }
.badge-purple   { background: var(--purple-light);   color: #5B21B6; }

/* ── Priority ────────────────────────────────────────────────────────────── */
.priority-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-low      { background: var(--success); }
.priority-medium   { background: var(--warning); }
.priority-high     { background: var(--danger); }
.priority-critical { background: #7C3AED; }

.priority-label { font-size: var(--text-xs); font-weight: var(--fw-medium); }

.priority-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}
.priority-tag.low      { background: var(--success-light); color: #065F46; }
.priority-tag.medium   { background: var(--warning-light); color: #92400E; }
.priority-tag.high     { background: var(--danger-light);  color: #991B1B; }
.priority-tag.critical { background: var(--purple-light);  color: #5B21B6; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--n-700);
  margin-bottom: var(--sp-2);
}

.form-required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-family: var(--font);
  color: var(--n-800);
  background: #fff;
  border: 1.5px solid var(--n-200);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  height: 40px;
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(79 110 247 / .12);
}

.form-control::placeholder { color: var(--n-400); }

select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394A3B8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}

textarea.form-control {
  height: auto;
  min-height: 100px;
  resize: vertical;
  padding: var(--sp-3);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--n-500);
  margin-top: var(--sp-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--sp-1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--n-100);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table thead th {
  background: var(--n-50);
  padding: var(--sp-3) var(--sp-5);
  font-weight: var(--fw-semibold);
  color: var(--n-600);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--n-100);
  white-space: nowrap;
  text-align: left;
}

.table tbody tr {
  border-bottom: 1px solid var(--n-50);
  transition: background var(--t-fast);
}

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

.table tbody tr:hover { background: var(--n-50); }

.table td {
  padding: var(--sp-4) var(--sp-5);
  color: var(--n-800);
  vertical-align: middle;
}

.table-link { color: var(--n-800); font-weight: var(--fw-medium); }
.table-link:hover { color: var(--primary); }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  color: #fff;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid #fff;
  margin-left: -8px;
}

.avatar-group .avatar:first-child { margin-left: 0; }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.progress {
  background: var(--n-100);
  border-radius: var(--r-full);
  overflow: hidden;
  height: 6px;
}

.progress-md { height: 8px; }
.progress-lg { height: 10px; }

.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width var(--t-slow);
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.page-header-left { flex: 1; }

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--n-900);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--n-500);
  margin-top: var(--sp-1);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ── Alert / Flash ───────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  margin-bottom: var(--sp-6);
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-light); border-color: #A7F3D0; color: #065F46; }
.alert-error   { background: var(--danger-light);  border-color: #FECACA; color: #991B1B; }
.alert-warning { background: var(--warning-light); border-color: #FDE68A; color: #92400E; }
.alert-info    { background: var(--info-light);    border-color: #A5F3FC; color: #164E63; }

.alert-dismiss {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--t-fast);
  flex-shrink: 0;
}
.alert-dismiss:hover { opacity: 1; }

/* ── Search/Filter Bar ───────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--n-400);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding-left: 38px;
}

/* ── Kanban Board ────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: var(--sp-4);
}

.kanban-col {
  flex: 0 0 280px;
  background: var(--n-50);
  border-radius: var(--r-lg);
  border: 1px solid var(--n-100);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--n-100);
  position: sticky; top: 0;
  background: var(--n-50);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  z-index: 1;
}

.kanban-col-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--n-700);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.kanban-col-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.kanban-col-count {
  background: var(--n-200);
  color: var(--n-600);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  padding: 2px 7px;
  border-radius: var(--r-full);
}

.kanban-tasks {
  padding: var(--sp-3);
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
}

.task-card {
  background: #fff;
  border-radius: var(--r-md);
  border: 1px solid var(--n-100);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.task-card.is-dragging {
  box-shadow: var(--shadow-xl);
  opacity: 0.9;
  transform: rotate(1.5deg);
}

.task-card-title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--n-800);
  margin-bottom: var(--sp-3);
  line-height: 1.4;
}

.task-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.task-card-due {
  font-size: var(--text-xs);
  color: var(--n-500);
  font-weight: var(--fw-medium);
}

.task-card-due.overdue { color: var(--danger); font-weight: var(--fw-semibold); }

.kanban-add-btn {
  width: 100%;
  padding: var(--sp-3);
  background: transparent;
  border: 1.5px dashed var(--n-200);
  border-radius: var(--r-md);
  color: var(--n-500);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--t-fast);
  margin: var(--sp-3);
  width: calc(100% - var(--sp-6));
  text-align: center;
}

.kanban-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.kanban-drop-zone {
  min-height: 60px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}

.kanban-drop-zone.drag-over {
  background: var(--primary-light);
  border: 2px dashed var(--primary);
}

/* ── Review action buttons in Kanban ─────────────────────────────────────── */
.task-verify-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--n-100);
}

/* ── Gantt Chart ─────────────────────────────────────────────────────────── */
#gantt-container {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--n-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.gantt .bar-group .bar {
  fill: var(--primary) !important;
}

.gantt .bar-group .bar-progress {
  fill: var(--primary-dark) !important;
}

.gantt .bar-label { fill: #fff !important; font-family: var(--font) !important; }

.gantt .tick line { stroke: var(--n-100) !important; }

.gantt .lower-text,
.gantt .upper-text {
  fill: var(--n-600) !important;
  font-family: var(--font) !important;
  font-size: 12px !important;
}

/* ── Project Cards Grid ──────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--sp-5);
}

.project-card {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--n-100);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition: all var(--t-base);
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
  color: inherit;
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.project-card-name {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--n-900);
  line-height: 1.3;
}

.project-card-client {
  font-size: var(--text-xs);
  color: var(--n-500);
  margin-top: 2px;
}

.project-card-progress {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.project-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--n-600);
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--n-50);
}

.project-card-date {
  font-size: var(--text-xs);
  color: var(--n-500);
}

/* ── Activity Feed ───────────────────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--n-50);
  position: relative;
}

.activity-item:last-child { border-bottom: none; }

.activity-content { flex: 1; }

.activity-description {
  font-size: var(--text-sm);
  color: var(--n-700);
  line-height: 1.4;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--n-400);
  margin-top: 2px;
}

/* ── Task Detail ─────────────────────────────────────────────────────────── */
.task-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-8);
  align-items: start;
}

.task-status-flow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.task-status-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--n-400);
}

.task-status-step.current { color: var(--primary); font-weight: var(--fw-semibold); }
.task-status-step.done    { color: var(--success); }

.task-status-step .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.task-status-arrow { color: var(--n-300); font-size: 10px; }

/* ── Comments ────────────────────────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: var(--sp-4); }

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.comment-bubble {
  background: var(--n-50);
  border-radius: 0 var(--r-md) var(--r-md) var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  flex: 1;
}

.comment-bubble.verification { background: var(--success-light); border-left: 3px solid var(--success); }
.comment-bubble.status_change { background: var(--primary-light); border-left: 3px solid var(--primary); }

.comment-meta {
  font-size: var(--text-xs);
  color: var(--n-500);
  margin-bottom: var(--sp-1);
}

.comment-content {
  font-size: var(--text-sm);
  color: var(--n-700);
  line-height: 1.5;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--t-base);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--n-100);
  position: sticky; top: 0; background: #fff;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  z-index: 1;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--n-900);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: var(--n-500);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  cursor: pointer;
  background: transparent;
  border: none;
}

.modal-close:hover { background: var(--n-100); color: var(--n-800); }

.modal-body { padding: var(--sp-6); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--n-100);
  background: var(--n-50);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

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

.auth-panel {
  flex: 1;
  background: linear-gradient(135deg, #1e3a8a 0%, var(--primary) 50%, var(--secondary) 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-12);
  position: relative;
  overflow: hidden;
}

.auth-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-panel-content { position: relative; z-index: 1; }

.auth-panel-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-12);
}

.auth-logo-mark {
  width: 48px; height: 48px;
  background: rgba(255,255,255,.2);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.auth-logo-mark svg { width: 28px; height: 28px; color: #fff; }

.auth-logo-text {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: #fff;
  letter-spacing: -0.03em;
}

.auth-tagline {
  font-size: var(--text-3xl);
  font-weight: var(--fw-extrabold);
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: var(--sp-5);
}

.auth-tagline span { color: rgba(255,255,255,0.7); }

.auth-description {
  font-size: var(--text-base);
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
  max-width: 380px;
}

.auth-features {
  margin-top: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: rgba(255,255,255,0.85);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

.auth-feature-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.auth-feature-icon svg { width: 16px; height: 16px; }

.auth-form-panel {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-10);
  background: #fff;
}

.auth-form-wrap { width: 100%; }

.auth-form-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--n-900);
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-2);
}

.auth-form-subtitle {
  font-size: var(--text-sm);
  color: var(--n-500);
  margin-bottom: var(--sp-8);
}

/* ── Client Portal ───────────────────────────────────────────────────────── */
.portal-header {
  background: linear-gradient(135deg, #1e3a8a 0%, var(--primary) 100%);
  padding: var(--sp-8) var(--sp-8) var(--sp-10);
  color: #fff;
}

.portal-header-name {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-1);
}

.portal-header-sub { font-size: var(--text-sm); opacity: 0.8; }

.portal-body { padding: var(--sp-8); max-width: 900px; margin: 0 auto; }

.portal-project-card {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--n-100);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--n-500);
  margin-bottom: var(--sp-5);
}

.breadcrumb a { color: var(--n-500); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--n-300); }
.breadcrumb .current { color: var(--n-800); font-weight: var(--fw-medium); }

/* ── Dashboard Grid Layout ───────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-8);
  align-items: start;
}

.dashboard-grid-full { grid-column: 1 / -1; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--n-100);
  margin-bottom: var(--sp-6);
}

.tab-btn {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--n-500);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  background: transparent;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--n-800); }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: var(--fw-semibold);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}

.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--n-100);
  border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-4);
}

.empty-state-icon svg { width: 32px; height: 32px; color: var(--n-400); }

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--n-700);
  margin-bottom: var(--sp-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--n-400);
  max-width: 300px;
  margin-bottom: var(--sp-5);
}

/* ── Deadline Countdown ──────────────────────────────────────────────────── */
.deadline-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--n-100);
  background: #fff;
  transition: all var(--t-fast);
}
.deadline-card:hover { border-color: var(--primary); }

.deadline-day-count {
  text-align: center;
  min-width: 40px;
}

.deadline-day-num {
  font-size: var(--text-xl);
  font-weight: var(--fw-extrabold);
  color: var(--n-900);
  letter-spacing: -0.03em;
  line-height: 1;
}

.deadline-day-label { font-size: 0.625rem; color: var(--n-500); font-weight: var(--fw-semibold); text-transform: uppercase; }

.deadline-info { flex: 1; min-width: 0; }

.deadline-project-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--n-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deadline-client-name { font-size: var(--text-xs); color: var(--n-400); }

/* ── Stats Row ───────────────────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: var(--sp-6);
  align-items: center;
}

.stat-item { text-align: center; }

.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--n-900);
  letter-spacing: -0.025em;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--n-500);
  font-weight: var(--fw-medium);
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--n-100);
  margin: var(--sp-6) 0;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--n-900);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 99;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Loading / Skeleton ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--n-100) 25%, var(--n-50) 50%, var(--n-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-12px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.fade-in { animation: fadeIn var(--t-slow) both; }

.fade-in-1 { animation-delay: 0.05s; }
.fade-in-2 { animation-delay: 0.10s; }
.fade-in-3 { animation-delay: 0.15s; }
.fade-in-4 { animation-delay: 0.20s; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .task-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .page-content { padding: var(--sp-4); }
  .topbar { padding: 0 var(--sp-4); }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .auth-form-panel { width: 100%; padding: var(--sp-8) var(--sp-5); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .auth-form-panel { padding: var(--sp-6) var(--sp-4); }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-medium { font-weight: var(--fw-medium); }
.font-semibold { font-weight: var(--fw-semibold); }
.font-bold { font-weight: var(--fw-bold); }
.text-xs  { font-size: var(--text-xs); }
.text-sm  { font-size: var(--text-sm); }
.text-lg  { font-size: var(--text-lg); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--n-500); }
.text-dark    { color: var(--n-900); }
.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: var(--sp-2); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-6  { margin-bottom: var(--sp-6); }
.mb-8  { margin-bottom: var(--sp-8); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mt-auto { margin-top: auto; }
.ml-auto { margin-left: auto; }
.p-0   { padding: 0; }
.rounded { border-radius: var(--r-md); }
.overflow-hidden { overflow: hidden; }
