/* =============================================================
   ZAP INNOVATIONS PORTAL — Design System
   Professional, warm, energetic. Space Grotesk + Inter.
   ============================================================= */

:root {
  /* Brand */
  --brand:        #FF6B35;
  --brand-2:      #F55525;
  --brand-3:      #E0461C;
  --brand-wash:   #FFF0E6;
  --brand-tint:   #FFF8F3;
  --brand-soft:   #FFD9C2;

  --accent:       #4F46E5;
  --accent-2:     #4338CA;
  --accent-wash:  #EEF0FF;

  /* Neutral surface stack */
  --bg:           #FBFAF7;
  --bg-2:         #F5F3EE;
  --surface:      #FFFFFF;
  --surface-2:    #FAF8F4;
  --border:       #ECE7DE;
  --border-2:     #D9D2C4;

  /* Text */
  --text:         #0F172A;
  --text-2:       #334155;
  --text-3:       #64748B;
  --text-muted:   #94A3B8;

  /* Semantic */
  --success:      #10B981;
  --success-wash: #ECFDF5;
  --warning:      #F59E0B;
  --warning-wash: #FEF3C7;
  --danger:       #EF4444;
  --danger-wash:  #FEF2F2;
  --info:         #3B82F6;
  --info-wash:    #EFF6FF;

  /* Shadow */
  --shadow-xs:    0 1px 2px rgba(15,23,42,.05);
  --shadow-sm:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md:    0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg:    0 12px 28px rgba(15,23,42,.10), 0 4px 8px rgba(15,23,42,.05);
  --shadow-xl:    0 24px 48px rgba(15,23,42,.14), 0 8px 16px rgba(15,23,42,.06);
  --shadow-brand: 0 8px 24px rgba(255,107,53,.28);

  /* Radius */
  --r-sm:  6px;
  --r:     10px;
  --r-md:  14px;
  --r-lg:  18px;
  --r-xl:  24px;

  /* Type */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --chat-w: 420px;
}

/* =============================================================
   RESET
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: var(--brand-soft); color: var(--brand-3); }

/* =============================================================
   BOOT SPLASH
   ============================================================= */
#boot-splash {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--brand-tint), var(--surface));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999;
  animation: bootFade 0.5s var(--ease-out) 0.8s forwards;
}
@keyframes bootFade { to { opacity: 0; visibility: hidden; } }
.boot-logo {
  width: 78px; height: 78px;
  filter: drop-shadow(0 12px 28px rgba(243,115,53,0.35)) drop-shadow(0 2px 4px rgba(0,0,0,0.08));
  animation: bootZap 1.4s var(--ease-spring) infinite;
}
@keyframes bootZap {
  0%, 100% { transform: scale(1) rotate(-6deg); }
  50%       { transform: scale(1.1) rotate(6deg); }
}
.boot-name {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-page {
  position: fixed; inset: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #FFF7F1 0%, #FFFDF8 50%, #F5F1E9 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.login-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 { top: -100px; left: -100px; width: 400px; height: 400px;
         background: radial-gradient(circle, var(--brand), transparent 65%); }
.orb-2 { bottom: -150px; right: -80px; width: 380px; height: 380px;
         background: radial-gradient(circle, var(--accent), transparent 65%);
         animation-delay: -6s; }
.orb-3 { top: 40%; right: 20%; width: 260px; height: 260px;
         background: radial-gradient(circle, #F0C994, transparent 65%);
         animation-delay: -12s; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -20px) scale(1.1); }
  66%      { transform: translate(-20px, 30px) scale(0.95); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  animation: loginIn 0.6s var(--ease-out) 1s both;
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--r-xl);
  padding: 40px 36px 28px;
  box-shadow: var(--shadow-xl);
}
.login-brand { text-align: center; margin-bottom: 28px; }

/* Logo bolt (SVG) — used in login card, sidebar */
.brand-logo {
  display: inline-block;
  filter: drop-shadow(0 8px 20px rgba(243,115,53,0.28)) drop-shadow(0 2px 4px rgba(0,0,0,0.06));
  margin-bottom: 20px;
  animation: bolt-hover 3s ease-in-out infinite;
}
.brand-logo.lg { width: 68px; height: 68px; }
.brand-logo.sm {
  width: 36px; height: 36px;
  margin-bottom: 0;
  filter: drop-shadow(0 3px 8px rgba(243,115,53,0.22));
  animation: none;
}

.brand-bolt {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  color: white;
  box-shadow: var(--shadow-brand);
  margin-bottom: 20px;
  animation: bolt-hover 3s ease-in-out infinite;
}
.brand-bolt.sm { width: 40px; height: 40px; border-radius: 12px; margin: 0; box-shadow: 0 4px 12px rgba(255,107,53,.25); }
.brand-bolt svg { width: 32px; height: 32px; }
.brand-bolt.sm svg { width: 20px; height: 20px; }
@keyframes bolt-hover {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}
.brand-title span { font-weight: 400; opacity: 0.75; margin-left: 2px; }
.brand-tag {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.field { display: block; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.12);
}
.field-input:disabled { opacity: 0.6; cursor: not-allowed; }
.field-with-toggle { position: relative; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.pw-toggle:hover { background: var(--surface-2); color: var(--text-2); }
.pw-toggle svg { width: 16px; height: 16px; }

.login-error {
  display: none;
  padding: 10px 12px;
  background: var(--danger-wash);
  color: var(--danger);
  border: 1px solid #FCA5A5;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  margin-bottom: 14px;
  animation: shake 0.4s;
}
.login-error.show { display: block; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.login-secure {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  margin-top: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--text-3);
}
.login-foot {
  display: flex; justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* =============================================================
   BUTTONS
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: all 0.15s var(--ease-in-out);
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  box-shadow: 0 2px 6px rgba(255,107,53,0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  box-shadow: 0 4px 14px rgba(255,107,53,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost {
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-full { width: 100%; }
.btn-lg { padding: 12px 20px; font-size: 14px; border-radius: var(--r); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* Icon button */
.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  color: var(--text-2);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--brand);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* =============================================================
   APP SHELL
   ============================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  animation: shellIn 0.5s var(--ease-out);
}
@keyframes shellIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  min-height: 0;
  transition: transform 0.3s var(--ease-out), width 0.3s var(--ease-out);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.sidebar-brand-title span { font-weight: 400; opacity: 0.7; }
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px;
  display: flex; flex-direction: column;
  gap: 4px;
  min-height: 0;
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, padding-left 0.2s var(--ease-out);
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  padding-left: 14px;
}
.nav-item.active {
  background: linear-gradient(90deg, var(--brand-wash), transparent);
  color: var(--brand-3);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--brand); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}
.nav-item { position: relative; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); }
.nav-icon svg { width: 100%; height: 100%; }
.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--brand-wash);
  color: var(--brand-3);
}

.sidebar-user {
  padding: 12px 4px 4px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-chip:hover { background: var(--surface-2); }
.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-role {
  font-size: 11px;
  color: var(--text-3);
  text-transform: capitalize;
}

/* =============================================================
   AVATARS
   ============================================================= */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-weight: 600;
  font-size: 13px;
  color: white;
  background: linear-gradient(135deg, #FF6B35, #E0461C);
  flex-shrink: 0;
  overflow: hidden;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.xl { width: 68px; height: 68px; font-size: 24px; }

.av-c0 { background: linear-gradient(135deg, #FF6B35, #E0461C); }
.av-c1 { background: linear-gradient(135deg, #4F46E5, #4338CA); }
.av-c2 { background: linear-gradient(135deg, #10B981, #059669); }
.av-c3 { background: linear-gradient(135deg, #F59E0B, #D97706); }
.av-c4 { background: linear-gradient(135deg, #EC4899, #DB2777); }
.av-c5 { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }
.av-c6 { background: linear-gradient(135deg, #06B6D4, #0891B2); }
.av-c7 { background: linear-gradient(135deg, #EF4444, #DC2626); }

/* =============================================================
   TOPBAR
   ============================================================= */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-toggle { display: none; }
.topbar-titles { min-width: 0; }
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.topbar-crumb {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

/* =============================================================
   CONTENT
   ============================================================= */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
  animation: contentIn 0.4s var(--ease-out);
}
@keyframes contentIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title-large {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}
.page-subtitle {
  font-size: 13.5px;
  color: var(--text-3);
  margin-top: 4px;
}

/* =============================================================
   CARDS & GRID
   ============================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out), border-color 0.15s;
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
  cursor: pointer;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Stat card */
.stat-card {
  display: flex; flex-direction: column;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card-icon {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand-wash);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.stat-card-icon svg { width: 18px; height: 18px; }
.stat-card-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  margin-top: 8px;
}
.stat-card-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.stat-card-sub {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* =============================================================
   BADGES
   ============================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.badge-success  { background: var(--success-wash); color: var(--success); }
.badge-warning  { background: var(--warning-wash); color: #B45309; }
.badge-danger   { background: var(--danger-wash);  color: var(--danger); }
.badge-info     { background: var(--info-wash);    color: var(--info); }
.badge-brand    { background: var(--brand-wash);   color: var(--brand-3); }
.badge-accent   { background: var(--accent-wash);  color: var(--accent-2); }
.badge-neutral  { background: var(--surface-2);    color: var(--text-3); }

/* =============================================================
   PROJECT CARD
   ============================================================= */
.project-card {
  display: flex; flex-direction: column;
  gap: 12px;
}
.project-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.project-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.project-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.project-team {
  display: flex;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.avatar-stack {
  display: flex;
}
.avatar-stack .avatar {
  margin-left: -6px;
  border: 2px solid var(--surface);
}
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack-more {
  margin-left: -6px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  border: 2px solid var(--surface);
}
.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 3px;
  transition: width 0.6s var(--ease-out);
}

/* =============================================================
   TABLE
   ============================================================= */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--brand-tint); }

/* =============================================================
   EMPTY STATE
   ============================================================= */
.empty {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  border-radius: 18px;
  background: var(--brand-wash);
  color: var(--brand);
  margin-bottom: 16px;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-text {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 16px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* =============================================================
   CHAT PANEL
   ============================================================= */
.chat-panel {
  position: fixed;
  right: 0; top: 0;
  height: 100vh;
  width: var(--chat-w);
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease-out);
  box-shadow: -12px 0 40px rgba(15,23,42,0.06);
  display: flex; flex-direction: column;
}
.chat-panel.open { transform: translateX(0); }
.chat-panel-inner {
  height: 100%;
  position: relative;
  overflow: hidden;
}
.chat-view {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  animation: chatViewIn 0.3s var(--ease-out);
}
@keyframes chatViewIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.chat-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.chat-backdrop.visible {
  opacity: 1; visibility: visible;
}

.chat-header {
  display: flex; align-items: center;
  gap: 10px;
  padding: 16px 18px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-title {
  display: flex; align-items: center; gap: 10px;
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.chat-current-header {
  flex: 1;
  min-width: 0;
}
.chat-group-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.chat-current-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-current-members {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
  font-family: var(--font-body);
}

.chat-header-sub {
  padding: 6px 18px 12px;
  font-size: 11.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.chat-groups-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px;
}
.chat-group-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-group-item:hover { background: var(--surface-2); }
.chat-group-item-info { flex: 1; min-width: 0; }
.chat-group-item-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-group-item-last {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.chat-group-item-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.chat-group-item-unread {
  background: var(--brand);
  color: white;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
.chat-msg {
  display: flex; flex-direction: column;
  gap: 4px;
  max-width: 85%;
  animation: msgIn 0.25s var(--ease-out);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
}
.chat-msg-name {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}
.chat-msg-time {
  color: var(--text-muted);
  font-size: 10.5px;
}
.chat-msg-body {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg.mine {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-msg.mine .chat-msg-body {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  border-color: transparent;
  border-radius: 12px 12px 4px 12px;
}
.chat-msg.mine .chat-msg-head { flex-direction: row-reverse; }

.chat-msg-day-divider {
  align-self: center;
  padding: 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  margin: 6px 0;
}

.chat-composer {
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13.5px;
  outline: none;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.chat-input:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.chat-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.chat-send:hover { background: var(--brand-2); }
.chat-send:active { transform: scale(0.9); }
.chat-send svg { width: 16px; height: 16px; }

.chat-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}
.chat-empty svg { color: var(--text-muted); margin: 0 auto 12px; display: block; opacity: 0.5; }

/* =============================================================
   MODAL
   ============================================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; animation: bkIn 0.2s var(--ease-out); }
@keyframes bkIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: modalIn 0.28s var(--ease-spring);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal.lg { max-width: 720px; }
.modal.xl { max-width: 920px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* =============================================================
   FORMS
   ============================================================= */
.form-field {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}

.member-picker {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-2);
}
.member-picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.member-picker-item:hover { background: var(--surface); }
.member-picker-item.selected { background: var(--brand-wash); }
.member-picker-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border-2);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.member-picker-item.selected .member-picker-check {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.member-picker-check svg { width: 12px; height: 12px; opacity: 0; }
.member-picker-item.selected .member-picker-check svg { opacity: 1; }
.member-picker-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.member-picker-dept {
  font-size: 11px;
  color: var(--text-3);
}

/* =============================================================
   DROPDOWN
   ============================================================= */
.dropdown {
  position: fixed;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 300;
  display: none;
  animation: dropIn 0.15s var(--ease-out);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.dropdown.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-3); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-wash); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* =============================================================
   TOAST
   ============================================================= */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 400;
  display: flex; flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--text);
  color: white;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--ease-spring);
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.leaving { animation: toastOut 0.2s var(--ease-in-out) forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

/* =============================================================
   SPINNER
   ============================================================= */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    z-index: 90;
    transform: translateX(-100%);
    box-shadow: 4px 0 30px rgba(0,0,0,.08);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar-toggle { display: inline-flex; }
  .content { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .chat-panel { width: 100vw; }
}

@media (max-width: 500px) {
  .page-title-large { font-size: 22px; }
  .content { padding: 16px; }
  .stat-card-value { font-size: 26px; }
}

/* =============================================================
   ATTENDANCE WIDGET
   ============================================================= */
.attend-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 18px 22px;
  background: linear-gradient(135deg, var(--brand-tint), var(--surface));
  border: 1px solid var(--brand-soft);
  flex-wrap: wrap;
}
.attend-info { min-width: 0; }
.attend-label {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.attend-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text);
}
.attend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.attend-dot-in {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.15);
  animation: attendPulse 2s ease-in-out infinite;
}
.attend-dot-off { background: var(--text-muted); }
@keyframes attendPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16,185,129,0.15); }
  50% { box-shadow: 0 0 0 8px rgba(16,185,129,0.08); }
}
.attend-actions { flex-shrink: 0; }

/* =============================================================
   SALARY SLIP DOCUMENT
   ============================================================= */
.slip-doc {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px 32px;
  max-width: 780px;
  margin: 0 auto;
  color: var(--text);
}
.slip-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--brand);
  margin-bottom: 24px;
}
.slip-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.slip-brand-sub {
  font-size: 11px;
  color: var(--text-3);
}
.slip-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--brand-3);
}
.slip-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}
.slip-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 20px;
  margin-bottom: 24px;
}
.slip-lbl {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 3px;
}
.slip-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.slip-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.slip-tbl {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.slip-tbl th {
  background: var(--surface-2);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
}
.slip-tbl td {
  padding: 8px 12px;
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}
.slip-tbl td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slip-tbl .slip-total td {
  font-weight: 700;
  background: var(--brand-tint);
  color: var(--brand-3);
}
.slip-net {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, #FEF3C7, #FED7AA);
  border-radius: 12px;
  margin-bottom: 20px;
}
.slip-net-words {
  font-size: 11px;
  color: #7C2D12;
  font-style: italic;
  margin-top: 4px;
  text-transform: capitalize;
}
.slip-net-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--brand-3);
}
.slip-notes {
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 20px;
}
.slip-foot {
  display: flex; justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-muted);
}

@media (max-width: 700px) {
  .slip-info-grid { grid-template-columns: repeat(2, 1fr); }
  .slip-tables { grid-template-columns: 1fr; }
  .slip-doc { padding: 16px; }
  .attend-card { flex-direction: column; align-items: flex-start; }
}

/* =============================================================
   UTILITY
   ============================================================= */
.row { display: flex; align-items: center; }
.row.gap-2 { gap: 8px; }
.row.gap-3 { gap: 12px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 10px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 10px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: 'Menlo', 'Consolas', monospace; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
