:root {
  --accent: #ff9400;
  --accent-hover: #e08200;
  --radius: 10px;

  /* Dark theme (default) */
  --bg: #0f1117;
  --bg-2: #161a23;
  --bg-3: #1e2330;
  --border: rgba(255,255,255,0.08);
  --text: #f0f2f5;
  --text-2: #8b92a5;
  --text-3: #5a6070;
  --sidebar-bg: #0a0c10;
  --card-bg: #161a23;
  --card-hover: #1e2330;
  --input-bg: #1e2330;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);

  --status-not-started: #ef4444;
  --status-in-progress: #ff9400;
  --status-completed: #22c55e;
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-2: #ffffff;
  --bg-3: #eef0f4;
  --border: rgba(0,0,0,0.08);
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --sidebar-bg: #1a1f2e;
  --card-bg: #ffffff;
  --card-hover: #f8f9fb;
  --input-bg: #f4f5f7;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

/* ── Login ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 28px;
}
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text-2); margin-bottom: 28px; }

/* ── App Shell ──────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand { font-weight: 700; font-size: 14px; color: #fff; letter-spacing: 0.02em; }
.sidebar-nav { padding: 12px 8px; flex: 1; }
.sidebar-footer { padding: 12px 8px 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255,255,255,0.5);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(255,148,0,0.12); color: var(--accent); }

/* ── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  padding-bottom: 24px;
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px 16px 90px; }
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-title { font-size: 22px; font-weight: 700; }
.section-sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }

/* ── Cards ──────────────────────────────────────────────── */
.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s;
}
.card:hover { background: var(--card-hover); border-color: rgba(255,255,255,0.12); }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.card-desc { color: var(--text-2); font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── Status badges ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-not-started { background: rgba(239,68,68,0.12); color: var(--status-not-started); }
.badge-in-progress { background: rgba(255,148,0,0.12); color: var(--status-in-progress); }
.badge-completed { background: rgba(34,197,94,0.12); color: var(--status-completed); }
.dot-not-started { background: var(--status-not-started); }
.dot-in-progress { background: var(--status-in-progress); }
.dot-completed { background: var(--status-completed); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: rgba(255,255,255,0.2); }
.btn-danger { background: rgba(239,68,68,0.12); color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.btn-full { width: 100%; justify-content: center; padding: 10px 16px; }
.btn-icon { width: 14px; height: 14px; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Forms / Inputs ──────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-error { color: #ef4444; font-size: 13px; margin-bottom: 16px; padding: 10px 12px; background: rgba(239,68,68,0.08); border-radius: 8px; border: 1px solid rgba(239,68,68,0.2); }

/* ── Search bar ─────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 14px;
  margin-bottom: 20px;
}
.search-bar svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.search-bar input { background: transparent; border: none; padding: 0; font-size: 14px; }
.search-bar input:focus { border: none; }

/* ── Links list ─────────────────────────────────────────── */
.links-list { display: flex; flex-direction: column; gap: 10px; }
.link-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.link-item:hover { border-color: var(--accent); background: var(--card-hover); }
.link-icon { width: 36px; height: 36px; border-radius: 8px; background: rgba(255,148,0,0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.link-icon svg { width: 16px; height: 16px; color: var(--accent); }
.link-info { flex: 1; min-width: 0; }
.link-title { font-weight: 600; font-size: 14px; }
.link-desc { color: var(--text-2); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-arrow { color: var(--text-3); flex-shrink: 0; }
.link-arrow svg { width: 14px; height: 14px; }

/* ── Staff grid ─────────────────────────────────────────── */
.staff-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.staff-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
}
.staff-avatar:hover { border-color: var(--accent); transform: scale(1.06); }
.staff-profile {
  margin-top: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Avatars in project cards ───────────────────────────── */
.avatar-stack { display: flex; }
.avatar-stack .avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--card-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  margin-left: -6px;
  cursor: pointer;
}
.avatar-stack .avatar-sm:first-child { margin-left: 0; }

/* ── Settings ───────────────────────────────────────────── */
.settings-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 14px;
  max-width: 600px;
}
.settings-card h3 { font-weight: 600; margin-bottom: 16px; color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.setting-label { font-weight: 600; font-size: 14px; }
.setting-desc { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.theme-toggle { display: flex; background: var(--bg-3); border-radius: 8px; padding: 3px; gap: 2px; border: 1px solid var(--border); }
.theme-btn { padding: 5px 14px; border-radius: 6px; border: none; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.theme-btn.active { background: var(--accent); color: white; }

/* ── Admin ──────────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-3); border-radius: 9px; padding: 4px; border: 1px solid var(--border); width: fit-content; }
.admin-tab { padding: 6px 18px; border-radius: 6px; border: none; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.admin-tab.active { background: var(--accent); color: white; }

.users-table { width: 100%; border-collapse: collapse; }
.users-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.users-table td { padding: 12px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.users-table tr:last-child td { border-bottom: none; }
.table-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; overflow-x: auto; }

.audit-item { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 16px; align-items: flex-start; }
.audit-item:last-child { border-bottom: none; }
.audit-actor { font-weight: 600; font-size: 13px; }
.audit-action { color: var(--text-2); font-size: 13px; }
.audit-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ── Logo mark ──────────────────────────────────────────── */
.logo-mark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  flex-shrink: 0;
}
.logo-mark.small { width: 26px; height: 26px; border-radius: 6px; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-weight: 700; font-size: 16px; }
.modal-close { background: none; border: none; color: var(--text-2); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; }
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { background: var(--bg-3); color: var(--text); }
#modal-body { padding: 20px; }

/* ── Mobile nav ─────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
  overflow-x: auto;
}
.mobile-nav-item {
  flex: 1; min-width: 60px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  padding: 8px 4px;
  text-decoration: none;
  color: rgba(255,255,255,0.4);
  font-size: 10px; font-weight: 500;
  transition: color 0.15s;
}
.mobile-nav-item svg { width: 20px; height: 20px; }
.mobile-nav-item.active { color: var(--accent); }
@media (max-width: 768px) { .mobile-nav { display: flex; } }

/* ── Guide detail ───────────────────────────────────────── */
.guide-detail { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.guide-detail h1 { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.guide-detail-content { color: var(--text-2); line-height: 1.8; white-space: pre-wrap; }
.guide-back { margin-bottom: 16px; }

/* ── Util ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-2); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.3; }
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--bg-3); color: var(--text-2); margin: 2px; }
.select-inline { width: auto; padding: 4px 8px; font-size: 12px; }