:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #eff6ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --ink: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --sidebar-bg: #101a2c;
  --sidebar-ink: #cbd5e1;
  --sidebar-active: #2563eb;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
  font-size: 14px;
}

.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px; font-weight: 700; font-size: 17px; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: var(--brand); font-size: 22px; }
.sidebar-nav { padding: 10px 0 30px; }
.nav-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: #64748b; padding: 16px 18px 6px;
}
.sidebar .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; color: var(--sidebar-ink);
  border-left: 3px solid transparent; font-size: 13.5px;
}
.sidebar .nav-link i { width: 18px; text-align: center; font-size: 15px; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar .nav-link.active { background: rgba(37,99,235,.15); color: #fff; border-left-color: var(--brand); }

/* Main area */
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 12px 24px; position: sticky; top: 0; z-index: 50;
}
.btn-icon { border: none; background: transparent; font-size: 18px; color: var(--muted); }
.global-search { position: relative; flex: 1; max-width: 480px; }
.global-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.global-search input { padding-left: 36px; background: var(--bg); border: 1px solid var(--border); }
.global-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  max-height: 360px; overflow-y: auto; box-shadow: 0 12px 28px rgba(0,0,0,.12); z-index: 60;
}
.search-result-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--ink); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--brand-light); }
.topbar-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.role-badge { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; padding: 6px 10px; }

.content { padding: 24px; }

/* Page header */
.page-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 700; margin: 0; }
.page-header .subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Cards */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px; height: 100%;
}
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { color: var(--muted); font-size: 12.5px; }
.bg-soft-brand { background: var(--brand-light); color: var(--brand); }
.bg-soft-success { background: #ecfdf3; color: var(--success); }
.bg-soft-warning { background: #fffaeb; color: var(--warning); }
.bg-soft-danger { background: #fef2f2; color: var(--danger); }
.bg-soft-info { background: #ecfeff; color: var(--info); }

/* Tables */
.table thead th {
  background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { vertical-align: middle; font-size: 13.5px; }
.dt-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 14px; }
table.dataTable { width: 100% !important; }

.card-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Buttons */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* Badges */
.badge-soft-success { background: #ecfdf3; color: var(--success); }
.badge-soft-warning { background: #fffaeb; color: var(--warning); }
.badge-soft-danger { background: #fef2f2; color: var(--danger); }
.badge-soft-info { background: #ecfeff; color: var(--info); }
.badge-soft-secondary { background: #f1f5f9; color: var(--muted); }

.kanban-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }

/* Auth */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
}
.auth-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand i { font-size: 40px; color: var(--brand); }

@media (max-width: 991px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s ease; }
  .sidebar.show { left: 0; }
  .global-search { max-width: none; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-area { width: 100%; }
  .content { padding: 0; }
}
