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

/* ── Light Theme Variables ───────────────────────────────────────────────────── */
:root {
  --sb-bg: #0c0c0f;
  --sb-border: rgba(255,255,255,0.06);
  --sb-text: #6b6b80;
  --sb-text-hover: #a0a0b8;
  --sb-text-active: #ffffff;
  --sb-item-hover: rgba(255,255,255,0.04);
  --sb-item-active: rgba(255,255,255,0.08);
  --sb-width: 224px;

  --bg: #f5f5f8;
  --card-bg: #ffffff;
  --card-border: #e8e8f0;
  --card-shadow: 0 1px 3px rgba(15,15,30,0.06), 0 1px 2px rgba(15,15,30,0.04);
  --card-shadow-hover: 0 4px 16px rgba(15,15,30,0.1);

  --text: #111118;
  --text-muted: #6b6b80;
  --text-faint: #a0a0b8;

  --accent: #6366f1;
  --accent-light: #eeefff;
  --accent-hover: #4f52e3;

  --green: #16a34a; --green-bg: #f0fdf4; --green-border: #bbf7d0;
  --red: #dc2626;   --red-bg: #fef2f2;   --red-border: #fecaca;
  --amber: #d97706; --amber-bg: #fffbeb; --amber-border: #fde68a;
  --blue: #2563eb;  --blue-bg: #eff6ff;  --blue-border: #bfdbfe;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-full: 999px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Dark Theme Variables ────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0f0f12;
  --card-bg: #17171f;
  --card-border: #2a2a3a;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 4px 20px rgba(0,0,0,0.5);

  --text: #e4e4f0;
  --text-muted: #7878a0;
  --text-faint: #44445a;

  --accent: #6366f1;
  --accent-light: rgba(99,102,241,0.15);

  --green: #4ade80; --green-bg: rgba(74,222,128,0.08); --green-border: rgba(74,222,128,0.25);
  --red: #f87171;   --red-bg: rgba(248,113,113,0.08);   --red-border: rgba(248,113,113,0.25);
  --amber: #fbbf24; --amber-bg: rgba(251,191,36,0.08);  --amber-border: rgba(251,191,36,0.25);
  --blue: #60a5fa;  --blue-bg: rgba(96,165,250,0.08);   --blue-border: rgba(96,165,250,0.25);

  --sb-bg: #0a0a0d;
  --sb-border: rgba(255,255,255,0.05);
}

/* ── Sidebar dark mode adjustments ─────────────────────────────────────────── */
[data-theme="dark"] .page-header {
  background: rgba(15,15,18,0.85);
  border-bottom-color: var(--card-border);
}
[data-theme="dark"] .form-input {
  background: #1f1f2a;
  border-color: #2a2a3a;
  color: var(--text);
}
[data-theme="dark"] .form-input:focus { border-color: var(--accent); }
[data-theme="dark"] .form-input[readonly] { background: #14141c; color: var(--text-muted); }
[data-theme="dark"] .table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .table td { border-bottom-color: #1f1f2a; }
[data-theme="dark"] .card-danger { border-color: var(--red-border); }
[data-theme="dark"] .stat-icon-blue   { background: var(--blue-bg);  color: var(--blue); }
[data-theme="dark"] .stat-icon-violet { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .stat-icon-amber  { background: var(--amber-bg); color: var(--amber); }
[data-theme="dark"] .stat-icon-green  { background: var(--green-bg); color: var(--green); }
[data-theme="dark"] .stat-icon-red    { background: var(--red-bg);   color: var(--red); }
[data-theme="dark"] .meta-chip { background: rgba(255,255,255,0.04); border-color: var(--card-border); color: var(--text-muted); }
[data-theme="dark"] .meta-chip-discord { background: rgba(88,101,242,0.15); color: #7289da; border-color: rgba(88,101,242,0.3); }
[data-theme="dark"] .perm-tag { background: rgba(99,102,241,0.12); color: #818cf8; }
[data-theme="dark"] .icon-btn { background: var(--card-bg); border-color: var(--card-border); color: var(--text-muted); }
[data-theme="dark"] .icon-btn:hover { background: #222232; }
[data-theme="dark"] .icon-btn-danger:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
[data-theme="dark"] .search-bar { background: var(--card-bg); border-color: var(--card-border); color: var(--text-muted); }
[data-theme="dark"] .search-input { color: var(--text); }
[data-theme="dark"] .discord-role-item:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .role-card:hover { box-shadow: var(--card-shadow-hover); }
[data-theme="dark"] .quick-action-card:hover { border-color: var(--accent); box-shadow: var(--card-shadow-hover); }
[data-theme="dark"] .nav-item.active { background: rgba(99,102,241,0.12); }
[data-theme="dark"] .entry-item:hover { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .notes-box { background: #1a1a22; border-color: var(--card-border); }
[data-theme="dark"] .info-box { background: rgba(255,255,255,0.03); border-color: var(--card-border); }
[data-theme="dark"] .info-box-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }
[data-theme="dark"] .perm-checkbox:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .role-checkbox-item:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .btn-secondary { background: var(--card-bg); border-color: var(--card-border); color: var(--text); }
[data-theme="dark"] .btn-secondary:hover { background: #222232; }
[data-theme="dark"] .btn-ghost { border-color: var(--card-border); color: var(--text-muted); }
[data-theme="dark"] .btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }
[data-theme="dark"] .modal { background: #1a1a22; border-color: var(--card-border); }
[data-theme="dark"] .color-picker { background: #1f1f2a; border-color: var(--card-border); }
[data-theme="dark"] .page-header.sticky { background: rgba(15,15,18,0.9); backdrop-filter: blur(12px); }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; transition: background 0.2s, color 0.2s; }
a { color: inherit; text-decoration: none; }

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

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar { width: var(--sb-width); min-height: 100vh; background: var(--sb-bg); border-right: 1px solid var(--sb-border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 1px solid var(--sb-border); flex-shrink: 0; }
.logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; }
.logo-text { font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.sidebar-nav { flex: 1; padding: 8px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sb-text); padding: 12px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--sb-text); font-size: .82rem; font-weight: 500; transition: background var(--transition), color var(--transition); cursor: pointer; }
.nav-item:hover { background: var(--sb-item-hover); color: var(--sb-text-hover); }
.nav-item.active { background: var(--sb-item-active); color: var(--sb-text-active); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.sidebar-bottom { padding: 10px 10px 14px; border-top: 1px solid var(--sb-border); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }

/* Theme toggle */
.theme-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); background: none; border: 1px solid var(--sb-border); color: var(--sb-text); cursor: pointer; font-family: var(--font); font-size: .78rem; font-weight: 500; transition: all var(--transition); }
.theme-toggle:hover { background: var(--sb-item-hover); color: var(--sb-text-hover); border-color: rgba(255,255,255,.1); }
.icon-sun, .icon-moon { flex-shrink: 0; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* Sidebar user */
.sidebar-user { display: flex; align-items: center; gap: 8px; }
.user-link { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; border-radius: var(--radius-sm); padding: 4px; transition: background var(--transition); }
.user-link:hover { background: var(--sb-item-hover); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-avatar-fallback { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .76rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .67rem; color: var(--sb-text); }
.logout-btn { color: var(--sb-text); padding: 4px; border-radius: 4px; display: flex; transition: color var(--transition); flex-shrink: 0; }
.logout-btn:hover { color: var(--red); }

/* ── Main ─────────────────────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sb-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.page-header { padding: 24px 28px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--card-border); background: rgba(255,255,255,.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 50; }
[data-theme="dark"] .page-header { background: rgba(15,15,18,.85); }
.page-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -.025em; }
.page-subtitle { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.breadcrumb { font-size: .78rem; color: var(--text-muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { opacity: .4; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; flex: 1; }

/* ── Flash ───────────────────────────────────────────────────────────────────── */
.flash { margin: 14px 28px 0; padding: 11px 14px; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.flash-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }
.flash-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .6; font-size: 1.1rem; padding: 0 4px; line-height: 1; }
.flash-close:hover { opacity: 1; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); overflow: hidden; }
.card-danger { border-color: var(--red-border); }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: .875rem; font-weight: 600; letter-spacing: -.01em; }
.card-action { font-size: .78rem; color: var(--accent); font-weight: 500; }
.card-action:hover { text-decoration: underline; }
.card-actions-row { display: flex; gap: 6px; }
.card-body { padding: 18px; }
.card-body.p-0 { padding: 0; }

/* ── Stats Grid ──────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 14px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 18px; display: flex; align-items: flex-start; gap: 12px; transition: box-shadow var(--transition); }
.stat-card:hover { box-shadow: var(--card-shadow-hover); }
.stat-icon { width: 40px; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon-blue   { background: var(--blue-bg);    color: var(--blue); }
.stat-icon-violet { background: var(--accent-light); color: var(--accent); }
.stat-icon-amber  { background: var(--amber-bg);   color: var(--amber); }
.stat-icon-green  { background: var(--green-bg);   color: var(--green); }
.stat-icon-red    { background: var(--red-bg);     color: var(--red); }
.stat-value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.stat-sub   { font-size: .72rem; color: var(--text-faint); margin-top: 2px; }

/* Stats mini (profile) */
.stats-mini { display: flex; gap: 20px; }
.stat-mini-item { text-align: center; }
.stat-mini-val { font-size: 1.4rem; font-weight: 700; letter-spacing: -.03em; }
.stat-mini-label { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* ── Status ──────────────────────────────────────────────────────────────────── */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--radius-full); font-size: .78rem; font-weight: 600; }
.status-online  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.status-offline { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }
.status-dot-sm { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-full); font-size: .73rem; font-weight: 600; }
.status-chip-active   { background: var(--green-bg); color: var(--green); }
.status-chip-suspended{ background: var(--red-bg);   color: var(--red); }
.status-chip-inactive { background: rgba(100,100,120,.08); color: var(--text-muted); }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-weight: 600; }
.badge-red  { background: var(--red-bg);  color: var(--red); }
.badge-gray { background: rgba(100,100,120,.08); color: var(--text-muted); }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .862rem; }
.table thead { border-bottom: 1px solid var(--card-border); }
.table th { padding: 10px 14px; text-align: left; font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid rgba(100,100,150,.06); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(99,102,241,.03); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 40px 16px !important; font-style: italic; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: var(--radius-sm); font-family: var(--font); font-size: .82rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(99,102,241,.3); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--card-border); box-shadow: var(--card-shadow); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--card-border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-full { width: 100%; justify-content: center; }
.btn-xs { padding: 4px 10px; font-size: .72rem; }
.mt-2 { margin-top: 8px; }
.icon-btn { width: 29px; height: 29px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); border: 1px solid var(--card-border); background: var(--card-bg); cursor: pointer; transition: all var(--transition); }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn-danger:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 18px; }
.form-side { display: flex; flex-direction: column; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.required { color: var(--red); }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--card-border); border-radius: var(--radius-sm); font-family: var(--font); font-size: .862rem; color: var(--text); background: var(--card-bg); transition: border-color var(--transition), box-shadow var(--transition); outline: none; appearance: none; }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.form-input[readonly] { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.form-textarea { resize: vertical; min-height: 86px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .862rem; cursor: pointer; }
.checkbox-label input { cursor: pointer; accent-color: var(--accent); width: 14px; height: 14px; }
.ml-auto { margin-left: auto; }

/* ── Color Picker ────────────────────────────────────────────────────────────── */
.color-picker-row { display: flex; align-items: center; gap: 12px; }
.color-picker { width: 46px; height: 36px; border: 1px solid var(--card-border); border-radius: var(--radius-sm); cursor: pointer; padding: 2px; background: var(--card-bg); }
.color-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.color-preset { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform var(--transition); }
.color-preset:hover { transform: scale(1.2); }

/* ── Permission checkboxes ───────────────────────────────────────────────────── */
.perm-group { margin-bottom: 18px; }
.perm-group-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--card-border); }
.perm-checkboxes { display: flex; flex-direction: column; gap: 1px; }
.perm-checkbox { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; transition: background var(--transition); }
.perm-checkbox:hover { background: var(--bg); }
.perm-checkbox input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.perm-checkbox-label { font-size: .83rem; font-weight: 500; }
.perm-checkbox-key { font-size: .7rem; color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; }

/* ── Perm Tags ───────────────────────────────────────────────────────────────── */
.perm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.perm-tag { background: var(--accent-light); color: var(--accent); padding: 2px 7px; border-radius: 4px; font-size: .68rem; font-family: var(--font-mono); font-weight: 500; }
.perm-tag-more { background: var(--bg); color: var(--text-muted); }

/* ── Roles Grid ──────────────────────────────────────────────────────────────── */
.roles-grid { display: flex; flex-direction: column; gap: 9px; }
.role-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px 18px; transition: box-shadow var(--transition); }
.role-card:hover { box-shadow: var(--card-shadow-hover); }
.role-card-header { display: flex; align-items: center; gap: 11px; }
.role-color-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.role-card-info { flex: 1; min-width: 0; }
.role-name { font-size: .875rem; font-weight: 600; }
.role-desc { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.role-actions { display: flex; gap: 5px; }
.role-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.meta-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); color: var(--text-muted); padding: 2px 8px; border-radius: var(--radius-full); font-size: .73rem; font-weight: 500; border: 1px solid var(--card-border); }
.meta-chip-discord { background: #eef2ff; color: #5865F2; border-color: #c7d2fe; }
.discord-roles-list { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.discord-role-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--radius-sm); cursor: pointer; font-size: .83rem; transition: background var(--transition); }
.discord-role-item:hover { background: var(--bg); }
.discord-role-item input { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.discord-role-name { flex: 1; font-weight: 500; }
.discord-role-id { font-family: var(--font-mono); font-size: .68rem; color: var(--text-muted); }

/* ── Members ─────────────────────────────────────────────────────────────────── */
.member-cell { display: flex; align-items: center; gap: 9px; }
.member-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.member-avatar-fallback { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.member-name { font-weight: 600; font-size: .862rem; }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.role-chip { padding: 1px 7px; border-radius: 4px; font-size: .7rem; font-weight: 600; border: 1px solid; }
.role-chip-more { padding: 1px 7px; border-radius: 4px; font-size: .7rem; background: var(--bg); color: var(--text-muted); border: 1px solid var(--card-border); }
.invite-chip { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; font-size: .73rem; font-weight: 600; }
.invite-sent   { background: var(--green-bg); color: var(--green); }
.invite-failed { background: var(--red-bg);   color: var(--red); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.search-bar-wrap { }
.search-bar { display: flex; align-items: center; gap: 9px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 7px 13px; max-width: 320px; box-shadow: var(--card-shadow); color: var(--text-muted); }
.search-input { border: none; outline: none; background: none; font-family: var(--font); font-size: .862rem; color: var(--text); flex: 1; }
.search-input::placeholder { color: var(--text-muted); }
.roles-checkbox-list { display: flex; flex-direction: column; gap: 4px; }
.role-checkbox-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--card-border); transition: all var(--transition); }
.role-checkbox-item:hover { background: var(--bg); }
.role-checkbox-item input { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.role-checkbox-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.role-checkbox-name { font-size: .862rem; font-weight: 500; }
.role-checkbox-desc { font-size: .73rem; color: var(--text-muted); margin-top: 1px; }

/* ── Detail Layout ───────────────────────────────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 18px; }
.detail-side { display: flex; flex-direction: column; gap: 14px; }
.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.profile-avatar { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 0 0 3px var(--accent-light); }
.profile-avatar-fallback { width: 68px; height: 68px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.profile-name { font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item { }
.info-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.info-value { font-size: .862rem; font-weight: 500; }
.notes-box { background: var(--bg); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 11px; font-size: .862rem; color: var(--text-muted); white-space: pre-wrap; margin-top: 5px; }
.member-roles-list { display: flex; flex-direction: column; gap: 9px; }
.member-role-item { display: flex; align-items: center; gap: 9px; }

/* ── Activity/Timeline ───────────────────────────────────────────────────────── */
.activity-list { padding: 6px 0; }
.activity-item { display: flex; gap: 11px; padding: 9px 18px; position: relative; }
.activity-item + .activity-item::before { content: ''; position: absolute; left: 25px; top: 0; width: 1px; height: 9px; background: var(--card-border); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.activity-content { flex: 1; }
.activity-desc { font-size: .862rem; }
.activity-meta { display: flex; gap: 10px; font-size: .73rem; color: var(--text-muted); margin-top: 2px; }
.activity-time { margin-left: auto; font-family: var(--font-mono); }

/* ── Entry items (team files) ────────────────────────────────────────────────── */
.entry-item { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(100,100,150,.06); transition: background var(--transition); align-items: flex-start; }
.entry-item:last-child { border-bottom: none; }
.entry-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.entry-body-wrap { flex: 1; min-width: 0; }
.entry-header-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entry-badge { padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-weight: 600; }
.mt-1 { margin-top: 4px; }
.font-medium { font-weight: 500; }

/* ── Audit ───────────────────────────────────────────────────────────────────── */
.action-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: .7rem; font-family: var(--font-mono); font-weight: 600; }
.action-user   { background: var(--blue-bg);    color: var(--blue); }
.action-role   { background: var(--accent-light); color: var(--accent); }
.action-member { background: var(--green-bg);   color: var(--green); }
.action-system { background: rgba(100,100,120,.08); color: var(--text-muted); }
.actor-cell { display: flex; align-items: center; gap: 7px; }
.actor-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.filter-form { display: flex; gap: 8px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 4px; }
.page-btn { color: var(--accent); font-weight: 500; font-size: .862rem; }
.page-btn:hover { text-decoration: underline; }
.page-info { font-size: .83rem; color: var(--text-muted); }

/* ── Info boxes ──────────────────────────────────────────────────────────────── */
.info-box { display: flex; align-items: flex-start; gap: 8px; background: var(--bg); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: .78rem; color: var(--text-muted); }
.info-box-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 26px; max-width: 400px; width: 90%; animation: slideUp .15s ease; }
@keyframes slideUp { from{transform:translateY(10px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-icon { width: 46px; height: 46px; border-radius: 11px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.modal-icon-danger { background: var(--red-bg); color: var(--red); }
.modal-title { font-size: .95rem; font-weight: 700; margin-bottom: 7px; }
.modal-text  { font-size: .862rem; color: var(--text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Settings ────────────────────────────────────────────────────────────────── */
.env-grid { display: flex; flex-direction: column; gap: 9px; }
.env-key { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.env-value { font-size: .8rem; font-weight: 500; word-break: break-all; }
.bot-status-block { }
.bot-status-indicator { display: flex; align-items: center; gap: 8px; padding: 11px; border-radius: var(--radius-sm); }
.bot-online  { background: var(--green-bg); color: var(--green); }
.bot-offline { background: var(--red-bg);   color: var(--red); }
.bot-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.quick-links { display: flex; flex-direction: column; gap: 2px; }
.quick-link { display: block; padding: 8px 11px; border-radius: var(--radius-sm); font-size: .862rem; color: var(--text-muted); transition: all var(--transition); }
.quick-link:hover { background: var(--bg); color: var(--text); }

/* ── Quick Actions ───────────────────────────────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 11px; }
.quick-action-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px; display: flex; align-items: center; gap: 13px; transition: all var(--transition); }
.quick-action-card:hover { box-shadow: var(--card-shadow-hover); border-color: var(--accent); }
.qa-icon { width: 38px; height: 38px; border-radius: 8px; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qa-title { font-size: .862rem; font-weight: 600; }
.qa-desc  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 52px 20px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); }
.empty-icon { width: 60px; height: 60px; border-radius: 14px; background: var(--bg); color: var(--text-muted); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.empty-state h3 { font-size: .95rem; font-weight: 600; margin-bottom: 6px; }
.empty-state p  { color: var(--text-muted); font-size: .862rem; margin-bottom: 18px; }
.empty-inline { padding: 22px; text-align: center; color: var(--text-muted); font-size: .862rem; }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.text-sm    { font-size: .8rem; }
.text-muted { color: var(--text-muted); }
.text-mono  { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.ml-auto { margin-left: auto; }

/* ── Login Page ──────────────────────────────────────────────────────────────── */
.login-body { min-height: 100vh; background: #0c0c0f; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(99,102,241,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(99,102,241,.07) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at center, black 0%, transparent 72%); }
.login-container { position: relative; z-index: 10; width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: rgba(22,22,28,.95); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 38px; backdrop-filter: blur(20px); box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-logo-icon { width: 38px; height: 38px; background: var(--accent); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; }
.login-logo-text { font-size: 1.05rem; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.login-title    { font-size: 1.35rem; font-weight: 700; color: #fff; letter-spacing: -.03em; margin-bottom: 8px; }
.login-subtitle { font-size: .862rem; color: rgba(255,255,255,.42); line-height: 1.6; margin-bottom: 26px; }
.login-error { display: flex; align-items: center; gap: 8px; background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.3); color: #f87171; border-radius: var(--radius-sm); padding: 10px 13px; font-size: .83rem; margin-bottom: 18px; }
.discord-btn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; background: #5865F2; color: #fff; border: none; border-radius: 9px; padding: 12px 20px; font-family: var(--font); font-size: .92rem; font-weight: 600; cursor: pointer; transition: all var(--transition); box-shadow: 0 2px 8px rgba(88,101,242,.4); text-decoration: none; }
.discord-btn:hover { background: #4752c4; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(88,101,242,.5); }
.login-footer { text-align: center; font-size: .76rem; color: rgba(255,255,255,.22); margin-top: 18px; }
.login-meta { text-align: center; font-size: .73rem; color: rgba(255,255,255,.13); margin-top: 18px; }

/* ── Error Page ──────────────────────────────────────────────────────────────── */
.error-code { font-size: 3.8rem; font-weight: 800; letter-spacing: -.05em; color: var(--card-border); line-height: 1; margin-bottom: 6px; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 960px) { .form-layout, .detail-layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) { :root { --sb-width: 0px; } .sidebar { display: none; } .page-header { padding: 14px; } .page-body { padding: 14px; } .stats-grid { grid-template-columns: 1fr 1fr; } }

/* ══════════════════════════════════════════════════════════════════════════════
   NEW COMPONENT STYLES – v3
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Top bar (search + shortcuts) ─────────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 49;
}
.search-wrap {
  flex: 1; max-width: 400px;
  display: flex; align-items: center; gap: 9px;
  background: var(--bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 7px 12px; position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.search-wrap .search-input { border: none; outline: none; background: none; font-family: var(--font); font-size: .83rem; color: var(--text); flex: 1; min-width: 0; }
.search-wrap .search-input::placeholder { color: var(--text-muted); }
.search-hint { font-size: .68rem; color: var(--text-faint); background: var(--card-border); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.15);
  z-index: 1000; overflow: hidden;
}
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: .83rem; color: var(--text);
  transition: background var(--transition); outline: none;
}
.search-result:hover, .search-result:focus { background: var(--bg); }
.sr-icon { font-size: 1rem; width: 22px; text-align: center; }
.sr-name { flex: 1; font-weight: 500; }
.sr-type { font-size: .7rem; color: var(--text-muted); background: var(--bg); padding: 1px 7px; border-radius: 10px; }

.top-bar-actions { display: flex; gap: 4px; margin-left: auto; }
.top-bar-link {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
  border: 1px solid transparent;
}
.top-bar-link:hover { background: var(--bg); color: var(--accent); border-color: var(--card-border); }

/* ── Nav Badges ────────────────────────────────────────────────────────────── */
.nav-item { position: relative; }
.nav-badge {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--red); color: #fff;
  font-size: .62rem; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 10px;
  min-width: 16px; text-align: center;
  pointer-events: none;
}

/* ── Sidebar Clock Widget ──────────────────────────────────────────────────── */
.sidebar-clock-wrap {
  padding: 10px 10px 0;
  border-top: 1px solid var(--sb-border);
}
.clock-in-btn {
  width: 100%; padding: 8px 12px;
  background: rgba(99,102,241,.15); color: #818cf8;
  border: 1px solid rgba(99,102,241,.3); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .78rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition); text-align: left;
  display: flex; align-items: center; gap: 7px;
}
.clock-in-btn:hover { background: rgba(99,102,241,.25); }
.clock-running { }
.clock-row { display: flex; align-items: center; gap: 7px; }
.clock-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; animation: pulse 2s infinite; }
.clock-label { font-size: .72rem; font-weight: 600; color: var(--sb-text-hover); flex: 1; min-width: 0; }
.clock-timer { font-size: .75rem; font-family: var(--font-mono); color: var(--sb-text-active); font-weight: 700; }
.clock-sel {
  flex: 1; padding: 4px 6px; border: 1px solid var(--sb-border);
  border-radius: 4px; background: rgba(255,255,255,.05); color: var(--sb-text-hover);
  font-family: var(--font); font-size: .7rem; cursor: pointer; outline: none;
  appearance: none;
}
.clock-stop-btn {
  width: 26px; height: 26px; border-radius: 4px;
  background: rgba(248,113,113,.15); color: #f87171;
  border: 1px solid rgba(248,113,113,.3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: .65rem; transition: all var(--transition); flex-shrink: 0;
}
.clock-stop-btn:hover { background: rgba(248,113,113,.3); }

/* ── Quick FAB (floating action button) ────────────────────────────────────── */
.quick-fab-wrap { position: fixed; bottom: 28px; right: 28px; z-index: 200; }
.quick-fab {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer; box-shadow: 0 4px 16px rgba(99,102,241,.4);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); font-size: 1.2rem;
}
.quick-fab:hover { background: var(--accent-hover); transform: scale(1.08); box-shadow: 0 6px 24px rgba(99,102,241,.5); }
.quick-fab:active { transform: scale(0.95); }
.quick-menu {
  position: absolute; bottom: 58px; right: 0;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: 6px; min-width: 160px;
  flex-direction: column; gap: 2px;
  animation: slideUp .15s ease;
}
.quick-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-size: .83rem; font-weight: 500;
  transition: background var(--transition);
}
.quick-item:hover { background: var(--bg); color: var(--accent); }

/* ── Toast notifications ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius);
  font-family: var(--font); font-size: .862rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  transform: translateY(20px); opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: auto;
}
.toast-show { transform: translateY(0); opacity: 1; }
.toast-success { background: #022c22; color: #4ade80; border: 1px solid rgba(74,222,128,.3); }
.toast-error   { background: #2c0a0a; color: #f87171; border: 1px solid rgba(248,113,113,.3); }
.toast-warning { background: #2a1f00; color: #fbbf24; border: 1px solid rgba(251,191,36,.3); }
.toast-info    { background: #0a1a2c; color: #60a5fa; border: 1px solid rgba(96,165,250,.3); }
.toast-icon { font-weight: 700; font-size: .95rem; }
[data-theme="light"] .toast-success { background: var(--green-bg); color: var(--green); }
[data-theme="light"] .toast-error   { background: var(--red-bg);   color: var(--red); }
[data-theme="light"] .toast-warning { background: var(--amber-bg); color: var(--amber); }
[data-theme="light"] .toast-info    { background: var(--blue-bg);  color: var(--blue); }

/* ── Team Active Cards (dashboard) ────────────────────────────────────────── */
.team-active-grid { display: flex; flex-direction: column; gap: 2px; }
.team-active-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  transition: background var(--transition); color: var(--text);
}
.team-active-card:hover { background: var(--bg); }
.team-active-av { flex-shrink: 0; }
.team-active-info { flex: 1; min-width: 0; }
.team-active-name { font-size: .83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-active-sub { font-size: .72rem; margin-top: 1px; }
.team-active-dur { font-size: .72rem; font-family: var(--font-mono); color: var(--text-muted); flex-shrink: 0; }

/* ── Dashboard improvements ────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dash-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.dash-wide { grid-column: 1 / -1; }
.activity-card { }
.activity-feed { display: flex; flex-direction: column; }
.activity-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 18px; border-bottom: 1px solid rgba(100,100,150,.05);
  font-size: .83rem;
}
.activity-row:last-child { border-bottom: none; }
.activity-row-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex-shrink: 0; }
.activity-row-main { flex: 1; }
.activity-row-time { font-size: .72rem; font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; }

/* ── Inline task status select ─────────────────────────────────────────────── */
.inline-status-sel {
  padding: 3px 22px 3px 8px; border-radius: 20px;
  font-family: var(--font); font-size: .73rem; font-weight: 600;
  border: 1px solid var(--card-border); background: var(--bg);
  color: var(--text-muted); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center;
  transition: all var(--transition); outline: none;
}
.inline-status-sel:hover { border-color: var(--accent); }
.inline-status-sel:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,.15); }

/* ── Priority pills ────────────────────────────────────────────────────────── */
.priority-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600;
}
.prio-urgent { background: var(--red-bg);   color: var(--red); }
.prio-high   { background: var(--amber-bg); color: var(--amber); }
.prio-normal { background: var(--accent-light); color: var(--accent); }
.prio-low    { background: rgba(100,100,120,.08); color: var(--text-muted); }

/* ── Quick filter tabs ─────────────────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-tab {
  padding: 5px 13px; border-radius: var(--radius-full);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--card-border); background: var(--card-bg);
  color: var(--text-muted); transition: all var(--transition);
  text-decoration: none;
}
.filter-tab:hover { border-color: var(--accent); color: var(--accent); }
.filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Hover quick actions on table rows ─────────────────────────────────────── */
.row-quick { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); }
tr:hover .row-quick { opacity: 1; }

/* ── Overdue indicator ─────────────────────────────────────────────────────── */
.overdue { color: var(--red) !important; font-weight: 600; }

/* ── Copy button ───────────────────────────────────────────────────────────── */
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px; cursor: pointer;
  font-size: .7rem; font-family: var(--font-mono);
  background: var(--bg); border: 1px solid var(--card-border);
  color: var(--text-muted); transition: all var(--transition);
}
.copy-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ── Tooltip ────────────────────────────────────────────────────────────────── */
.tooltip {
  position: fixed; z-index: 9000;
  background: #1a1a22; color: #e4e4f0;
  padding: 5px 10px; border-radius: 6px;
  font-size: .75rem; font-family: var(--font);
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

/* ── Stats with change indicator ──────────────────────────────────────────── */
.stat-change { font-size: .72rem; margin-top: 3px; font-weight: 600; }
.stat-change-up   { color: var(--green); }
.stat-change-down { color: var(--red); }

/* ── Better empty state on dashboard ──────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, rgba(99,102,241,.1) 0%, rgba(139,92,246,.08) 100%);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius); padding: 24px;
  display: flex; align-items: center; gap: 20px;
}
.welcome-banner-icon { font-size: 2.5rem; }
.welcome-banner-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.welcome-banner-desc { font-size: .83rem; color: var(--text-muted); }

/* ── Sidebar adjustments ──────────────────────────────────────────────────── */
.sidebar-bottom { padding: 10px 10px 12px; border-top: 1px solid var(--sb-border); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.page-header { padding: 16px 24px; }

/* Dark mode for new components */
[data-theme="dark"] .top-bar { background: var(--card-bg); border-bottom-color: var(--card-border); }
[data-theme="dark"] .search-wrap { background: #1a1a22; }
[data-theme="dark"] .search-dropdown { background: #1e1e28; }
[data-theme="dark"] .quick-menu { background: #1e1e28; border-color: var(--card-border); }
[data-theme="dark"] .filter-tab { background: var(--card-bg); }
[data-theme="dark"] .inline-status-sel { background: #1a1a22; color: var(--text-muted); border-color: var(--card-border); }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-wrap { background: var(--bg); border-radius: var(--radius-full); height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); background: var(--accent); width: 0; transition: width 0.8s cubic-bezier(.34,1.56,.64,1); }

/* ═══════════════════════════════════════════════════════════════════════════
   TEAMVAULT UPDATE — New Components & Animations
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Skeleton Screen Animations ──────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--card-border) 25%, rgba(200,200,220,0.4) 50%, var(--card-border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1f1f2a 25%, #2a2a38 50%, #1f1f2a 75%);
  background-size: 600px 100%;
}
.skeleton-text  { height: 14px; border-radius: 6px; }
.skeleton-block { border-radius: var(--radius); width: 100%; }

/* ── Widget Fade-In Animation ───────────────────────────────────────────────── */
@keyframes widgetIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.widget-fadein {
  animation: widgetIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Row Fade-In ────────────────────────────────────────────────────────────── */
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.fade-in {
  animation: rowIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Page Transition ────────────────────────────────────────────────────────── */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-body { animation: pageIn 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs-wrap {
  display: flex; gap: 4px; border-bottom: 2px solid var(--card-border);
  margin-bottom: 0; padding-bottom: 0;
}
.tab-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; font-size: .83rem; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-family: var(--font);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--text); background: rgba(99,102,241,.04); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff;
  border-radius: var(--radius-full); font-size: .65rem; font-weight: 700;
  animation: badgePop 0.3s cubic-bezier(0.34,1.56,.64,1);
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.tab-content { display: flex; flex-direction: column; gap: 18px; }
.tab-content.hidden { display: none; }

/* ── Nav Badges ─────────────────────────────────────────────────────────────── */
.nav-item-badge-wrap { position: relative; }
.nav-badge {
  margin-left: auto; display: inline-flex; align-items: center;
  justify-content: center; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: var(--radius-full);
  font-size: .6rem; font-weight: 700; animation: badgePop 0.3s cubic-bezier(0.34,1.56,.64,1);
}

/* ── Dashboard Widget Grid ──────────────────────────────────────────────────── */
.dash-widget-grid {
  column-count: 2;
  column-gap: 18px;
  grid-auto-rows: unset; /* Not a grid anymore */
}
.dash-widget {
  break-inside: avoid;
  margin-bottom: 18px;
  display: block;
}
@media (max-width: 960px) {
  .dash-widget-grid { column-count: 1; }
}
.dash-widget { position: relative; }
.dash-widget.dragging { opacity: 0.4; }
.dash-widget.drag-over .card {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,.25), var(--card-shadow);
}
.dash-widget.edit-mode .card { border-style: dashed; }

/* Widget Controls */
.widget-drag-handle {
  cursor: grab; color: var(--text-faint);
  display: flex; align-items: center;
  transition: color var(--transition);
}
.widget-drag-handle:hover { color: var(--text-muted); }
.widget-drag-handle:active { cursor: grabbing; }
.widget-remove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-faint); padding: 3px; border-radius: 4px;
  display: flex; align-items: center; transition: all var(--transition);
}
.widget-remove-btn:hover { color: var(--red); background: var(--red-bg); }

/* ── Widget Picker ─────────────────────────────────────────────────────────── */
.widget-picker {
  background: var(--card-bg); border: 2px dashed var(--card-border);
  border-radius: var(--radius); padding: 16px 20px;
  flex-direction: column; gap: 12px;
  animation: pageIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.widget-picker-title { font-size: .8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.widget-picker-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.widget-add-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: var(--radius-full);
  background: var(--accent-light); color: var(--accent);
  border: 1px solid rgba(99,102,241,.25); font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: all var(--transition);
}
.widget-add-chip:hover { background: var(--accent); color: #fff; transform: scale(1.04); }

/* ── Task Mini List (widget) ─────────────────────────────────────────────────── */
.task-mini-list { display: flex; flex-direction: column; }
.task-mini-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--card-border);
  text-decoration: none; color: var(--text);
  transition: background var(--transition);
  border-radius: 4px;
}
.task-mini-row:last-of-type { border-bottom: none; }
.task-mini-row:hover { background: var(--accent-light); padding-left: 4px; }
.task-mini-prio { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio-urgent { background: var(--red); }
.prio-high   { background: var(--amber); }
.prio-normal { background: var(--accent); }
.prio-low    { background: var(--text-faint); }
.task-mini-title { flex: 1; font-size: .83rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-mini-due { font-size: .75rem; color: var(--text-faint); flex-shrink: 0; }
.task-mini-due.overdue { color: var(--red); font-weight: 600; }
.task-mini-more { display: inline-block; margin-top: 10px; font-size: .78rem; color: var(--accent); font-weight: 600; }
.task-mini-more:hover { text-decoration: underline; }

/* ── Absence Mini List (widget) ──────────────────────────────────────────────── */
.absence-mini-list { display: flex; flex-direction: column; gap: 8px; }
.absence-mini-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
}

/* ── Filter Bar (chip style) ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 4px 0;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 13px; border-radius: var(--radius-full);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--card-border); background: var(--card-bg);
  color: var(--text-muted); transition: all var(--transition);
  text-decoration: none;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip-active { background: var(--accent); color: #fff !important; border-color: var(--accent); }

/* ── Priority Chips ─────────────────────────────────────────────────────────── */
.priority-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600;
}
.priority-urgent { background: var(--red-bg);    color: var(--red); }
.priority-high   { background: var(--amber-bg);  color: var(--amber); }
.priority-normal { background: var(--green-bg);  color: var(--green); }

/* ── Form helpers ────────────────────────────────────────────────────────────── */
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-row-3 { grid-template-columns: 1fr; } }
.form-input-sm { padding: 5px 10px; font-size: .8rem; height: auto; }
.form-hint { font-size: .75rem; color: var(--text-faint); margin-top: 5px; }
.absence-form { display: flex; flex-direction: column; gap: 14px; }

/* ── Logo components ─────────────────────────────────────────────────────────── */
.logo-img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.logo-preview-box {
  width: 88px; height: 88px; border-radius: var(--radius);
  border: 2px solid var(--card-border); display: flex;
  align-items: center; justify-content: center;
  background: var(--bg); flex-shrink: 0;
  transition: border-color var(--transition);
}
.logo-preview-box:hover { border-color: var(--accent); }
.logo-placeholder { color: var(--text-faint); display: flex; align-items: center; justify-content: center; }

/* ── Toast Container ─────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--radius);
  font-size: .85rem; font-weight: 500; max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transform: translateX(120%); transition: transform 0.35s cubic-bezier(0.22,1,.36,1), opacity 0.35s;
  pointer-events: all;
}
.toast-show { transform: translateX(0); }
.toast-success { background: var(--green); color: #fff; }
.toast-error   { background: var(--red);   color: #fff; }
.toast-warning { background: var(--amber); color: #fff; }
.toast-info    { background: var(--accent); color: #fff; }
.toast-icon    { font-size: .9rem; font-weight: 700; }

/* ── Smooth hover transitions on cards ──────────────────────────────────────── */
.card { transition: box-shadow 0.2s, border-color 0.2s; }
.quick-action-card { transition: all 0.2s cubic-bezier(0.22,1,.36,1); }
.quick-action-card:hover { transform: translateY(-2px); }
.stat-card { transition: box-shadow 0.2s, transform 0.2s; }
.stat-card:hover { transform: translateY(-1px); }

/* ── Status Badge ────────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: .75rem; font-weight: 600;
}
.status-online  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.status-offline { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(.85); }
}

/* ── Link hover ─────────────────────────────────────────────────────────────── */
.link-hover { transition: color var(--transition); }
.link-hover:hover { color: var(--accent); text-decoration: underline; }
.text-red { color: var(--red); }

/* ── Empty State ────────────────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px; text-align: center; }
.empty-icon  { font-size: 2.2rem; margin-bottom: 4px; opacity: .6; }
.empty-title { font-size: .9rem; font-weight: 600; }
.empty-sub   { font-size: .82rem; color: var(--text-muted); }
.empty-inline{ padding: 18px; text-align: center; font-size: .83rem; color: var(--text-muted); }

/* ── Sidebar clock area removed — clean padding ──────────────────────────────── */
.sidebar-clock-wrap { display: none !important; }

/* ── Improved nav item with badge ────────────────────────────────────────────── */
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--sb-text); font-size: .82rem; font-weight: 500; transition: background var(--transition), color var(--transition); cursor: pointer; position: relative; }

/* ── Dark mode additions ─────────────────────────────────────────────────────── */
[data-theme="dark"] .widget-picker { background: #13131a; border-color: #2a2a3a; }
[data-theme="dark"] .tabs-wrap { border-bottom-color: #2a2a3a; }
[data-theme="dark"] .tab-btn:hover { background: rgba(99,102,241,.06); }
[data-theme="dark"] .filter-chip { background: #17171f; border-color: #2a2a3a; }
[data-theme="dark"] .absence-mini-row { background: #13131a; border-color: #2a2a3a; }
[data-theme="dark"] .task-mini-row:hover { background: rgba(99,102,241,.08); }
[data-theme="dark"] .logo-preview-box { background: #13131a; border-color: #2a2a3a; }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #1a1a24 25%, #252530 50%, #1a1a24 75%); background-size: 600px 100%; animation: shimmer 1.4s ease-in-out infinite; }

/* ── Sidebar glow on active item ─────────────────────────────────────────────── */
.nav-item.active {
  background: var(--sb-item-active);
  color: var(--sb-text-active);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ── Responsive: collapse widget grid on small screens ───────────────────────── */
@media (max-width: 900px) {
  .dash-widget-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NEW MODULES — Protocols, Playerfiles, Pages, ToDo, Discord
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Recording Obligation Banner ─────────────────────────────────────────────── */
.recording-obligation-banner {
  background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
  color: #fff; padding: 12px 28px; font-size: .88rem; font-weight: 600;
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 60;
  box-shadow: 0 2px 8px rgba(220,38,38,.4);
  animation: slideDown 0.4s cubic-bezier(0.22,1,.36,1);
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ── Protocol Type Badge ─────────────────────────────────────────────────────── */
.protocol-type-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: .75rem; font-weight: 600;
}
.protocol-type-support { background: var(--blue-bg);   color: var(--blue); }
.protocol-type-entry   { background: var(--green-bg);  color: var(--green); }
.protocol-type-analyst { background: var(--amber-bg);  color: var(--amber); }

/* ── Player Chips ────────────────────────────────────────────────────────────── */
.player-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: .75rem; font-weight: 500;
  background: var(--bg); border: 1px solid var(--card-border);
}
.player-chip-linked { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }

/* ── Player Search Row ───────────────────────────────────────────────────────── */
.player-row-wrap { margin-bottom: 10px; }
.player-search-row { display: flex; align-items: center; gap: 8px; }
.player-search-input-wrap { position: relative; flex: 1; }
.player-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 260px; overflow-y: auto;
}
.player-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background var(--transition);
  border-bottom: 1px solid var(--card-border);
}
.player-dd-item:last-child { border-bottom: none; }
.player-dd-item:hover { background: var(--accent-light); }
.player-dd-new { color: var(--accent); font-weight: 500; }
.player-dd-icon { font-size: 1rem; flex-shrink: 0; }
.player-badge { display: flex; align-items: center; }
.player-linked-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-full);
  background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border);
  font-size: .72rem; font-weight: 600;
}
.player-detail-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--card-border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); transition: all var(--transition);
}
.player-detail-card:hover { border-color: var(--accent); box-shadow: var(--card-shadow-hover); }
.player-detail-avatar { font-size: 1.4rem; }
.player-file-avatar { font-size: 1.2rem; }
.recording-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: 4px;
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border);
  font-size: .65rem; font-weight: 700;
}

/* ── Type Selector Cards ─────────────────────────────────────────────────────── */
.type-selector-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media(max-width:600px) { .type-selector-grid { grid-template-columns: 1fr; } }
.type-selector-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 14px; border: 2px solid var(--card-border);
  border-radius: var(--radius); cursor: pointer; text-align: center;
  transition: all var(--transition); background: var(--card-bg);
}
.type-selector-card:hover { border-color: var(--accent); background: var(--accent-light); }
.type-selector-card.selected { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.type-selector-icon { font-size: 2rem; }
.type-selector-label { font-size: .88rem; font-weight: 700; }
.type-selector-desc { font-size: .75rem; color: var(--text-muted); }

/* ── Splitscreen ────────────────────────────────────────────────────────────── */
.voice-splitscreen-wrap { overflow: hidden; }
.splitscreen-grid {
  display: grid; gap: 0; min-height: 600px;
}
.splitscreen-panel { display: flex; flex-direction: column; border-right: 1px solid var(--card-border); }
.splitscreen-panel:last-child { border-right: none; }
.splitscreen-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}
.splitscreen-iframe { flex: 1; border: none; min-height: 560px; width: 100%; }

/* ── Custom Pages Grid ───────────────────────────────────────────────────────── */
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.page-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  text-decoration: none; color: var(--text); position: relative;
  transition: all var(--transition);
}
.page-card:hover { border-color: var(--accent); box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.page-card-icon { font-size: 1.8rem; flex-shrink: 0; }
.page-card-body { flex: 1; min-width: 0; }
.page-card-title { font-size: .9rem; font-weight: 600; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-card-edit-btn {
  position: absolute; top: 10px; right: 10px;
  opacity: 0; transition: opacity var(--transition);
  padding: 4px 8px; border-radius: 4px; background: var(--accent-light); color: var(--accent);
  font-size: .75rem;
}
.page-card:hover .page-card-edit-btn { opacity: 1; }

/* ── Custom Page Content ─────────────────────────────────────────────────────── */
.custom-page-heading { margin: 4px 0; }
.custom-page-text { white-space: pre-wrap; line-height: 1.7; }
.custom-page-link-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  transition: all var(--transition);
}
.custom-page-link-card:hover { border-color: var(--accent); background: var(--accent-light); }
.clc-icon { font-size: 1.4rem; }
.clc-title { font-size: .9rem; font-weight: 600; }
.clc-url { font-size: .75rem; color: var(--text-faint); }
.clc-arrow { margin-left: auto; font-size: 1.1rem; color: var(--accent); }
.custom-page-divider { border: none; border-top: 2px solid var(--card-border); margin: 4px 0; }
.page-todo-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .88rem; }
.page-todo-icon { font-size: 1rem; }

/* ── Block Editor ────────────────────────────────────────────────────────────── */
.block-editor-item {
  border-bottom: 1px solid var(--card-border); transition: background var(--transition);
}
.block-editor-item:last-child { border-bottom: none; }
.block-editor-item:hover { background: rgba(99,102,241,.02); }
.block-editor-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: grab;
}
.block-editor-header:active { cursor: grabbing; }
.block-editor-drag { color: var(--text-faint); font-size: 1rem; }
.block-editor-type { font-size: .8rem; font-weight: 600; color: var(--accent); }
.block-editor-fields { padding: 0 16px 14px; }

/* ── ToDo Grid ───────────────────────────────────────────────────────────────── */
.todos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.todo-items-list { display: flex; flex-direction: column; gap: 4px; }
.todo-item-row { display: flex; align-items: center; gap: 8px; background: none; border: none; padding: 0; }
.todo-check-btn { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 2px; transition: transform var(--transition); }
.todo-check-btn:hover { transform: scale(1.15); }
.todo-item-text { font-size: .85rem; text-align: left; }
.todo-item-text.done { text-decoration: line-through; opacity: .5; }

/* ── Discord Actions ─────────────────────────────────────────────────────────── */
.embed-builder-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px dashed var(--card-border); border-radius: var(--radius);
  cursor: pointer; font-size: .83rem; color: var(--accent); font-weight: 600;
  transition: all var(--transition);
}
.embed-builder-toggle:hover { background: var(--accent-light); border-color: var(--accent); }
.discord-embed-preview {
  display: flex; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--card-border); background: var(--bg);
}
.dep-bar { width: 4px; flex-shrink: 0; }
.dep-content { padding: 12px 14px; flex: 1; }
.dep-title { font-size: .9rem; font-weight: 700; margin-bottom: 4px; }

/* ── Checkbox Label ──────────────────────────────────────────────────────────── */
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .85rem; }
.checkbox-label input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); }

/* ── Info Box Red ────────────────────────────────────────────────────────────── */
.info-box-red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

/* ── Role Checkbox List ─────────────────────────────────────────────────────── */
.role-checkbox-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; padding: 6px 0; }
.role-checkbox-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; cursor: pointer; transition: background var(--transition); }
.role-checkbox-item:hover { background: var(--accent-light); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Dark mode extras */
[data-theme="dark"] .type-selector-card { background: #13131a; }
[data-theme="dark"] .player-dropdown { background: #1a1a24; border-color: #2a2a3a; }
[data-theme="dark"] .player-detail-card { background: #13131a; }
[data-theme="dark"] .page-card { background: var(--card-bg); }
[data-theme="dark"] .discord-embed-preview { background: #13131a; }
[data-theme="dark"] .splitscreen-panel-header { background: #13131a; }
[data-theme="dark"] .recording-obligation-banner { background: linear-gradient(90deg, #991b1b 0%, #7f1d1d 100%); }

/* ═══════════════════════════════════════════════════════════════════════════════
   CHAT MODULE
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Chat layout (overrides main-content for room page) ─────────────────────── */
.chat-layout {
  display: flex; flex: 1; height: calc(100vh - 0px); overflow: hidden;
  margin-left: 0;
}
.chat-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  border-right: 1px solid var(--card-border);
}
.chat-members-sidebar {
  width: 220px; flex-shrink: 0; overflow-y: auto;
  background: var(--card-bg); padding: 12px 0;
}

/* ── Chat topbar ─────────────────────────────────────────────────────────────── */
.chat-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--card-border);
  background: var(--card-bg); flex-shrink: 0;
}
.chat-topbar-left { display: flex; align-items: center; gap: 10px; }
.chat-topbar-icon { font-size: 1.4rem; }
.chat-topbar-name { font-size: 1rem; font-weight: 700; }
.chat-topbar-desc { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.chat-topbar-actions { display: flex; gap: 8px; }

/* ── Messages area ───────────────────────────────────────────────────────────── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 0;
  display: flex; flex-direction: column; gap: 2px;
}
.chat-empty {
  margin: auto; color: var(--text-faint); font-size: .9rem;
  text-align: center; padding: 40px;
}
.chat-date-divider {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px; color: var(--text-faint); font-size: .72rem; font-weight: 600;
}
.chat-date-divider span {
  white-space: nowrap; padding: 0 8px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
}
.chat-date-divider::before, .chat-date-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--card-border);
}

/* ── Chat message ────────────────────────────────────────────────────────────── */
.chat-message {
  display: flex; gap: 10px; padding: 4px 18px;
  transition: background var(--transition);
  position: relative;
}
.chat-message:hover { background: var(--sb-item-hover); }
.chat-message:hover .chat-msg-actions { opacity: 1; }
.chat-msg-avatar-wrap { width: 36px; flex-shrink: 0; padding-top: 2px; }
.chat-msg-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.chat-msg-avatar-fallback {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: #fff; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-msg-body { flex: 1; min-width: 0; }
.chat-msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.chat-msg-author {
  font-weight: 600; font-size: .88rem; cursor: pointer;
  transition: color var(--transition);
}
.chat-msg-author:hover { color: var(--accent); text-decoration: underline; }
.chat-msg-time { font-size: .72rem; color: var(--text-faint); }
.chat-msg-edited { font-size: .68rem; color: var(--text-faint); font-style: italic; }
.chat-msg-content {
  font-size: .875rem; line-height: 1.6; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.chat-msg-actions {
  display: flex; gap: 4px; align-items: center;
  margin-left: auto; opacity: 0; transition: opacity var(--transition);
}
.chat-msg-action-btn {
  background: none; border: none; cursor: pointer; font-size: .8rem;
  padding: 2px 5px; border-radius: 4px; line-height: 1;
  transition: background var(--transition);
}
.chat-msg-action-btn:hover { background: var(--card-border); }
.chat-msg-action-delete:hover { background: var(--red-bg); }

/* ── Edit form ───────────────────────────────────────────────────────────────── */
.chat-edit-input {
  width: 100%; background: var(--card-bg); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text);
  font-family: var(--font); font-size: .875rem; resize: none; min-height: 60px;
  outline: none;
}
.chat-edit-actions { display: flex; gap: 6px; margin-top: 6px; }

/* ── Input area ──────────────────────────────────────────────────────────────── */
.chat-input-area {
  padding: 12px 18px; border-top: 1px solid var(--card-border);
  background: var(--card-bg); flex-shrink: 0;
}
.chat-input-readonly {
  color: var(--text-muted); font-size: .82rem; text-align: center; padding: 14px;
}
.chat-input-wrap { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; background: var(--bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 10px 14px; color: var(--text);
  font-family: var(--font); font-size: .875rem; resize: none; outline: none;
  max-height: 150px; line-height: 1.5; transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius);
  padding: 10px 14px; cursor: pointer; display: flex; align-items: center;
  transition: background var(--transition); flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--accent-hover); }

/* ── Members sidebar ─────────────────────────────────────────────────────────── */
.chat-members-title {
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); padding: 0 12px 8px;
}
.chat-role-group { margin-bottom: 16px; }
.chat-role-header {
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 12px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-member-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px; cursor: pointer; border-radius: 4px; margin: 0 4px;
  transition: background var(--transition);
}
.chat-member-item:hover { background: var(--sb-item-hover); }
.chat-member-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-member-avatar-fallback {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: .65rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.chat-member-name { font-size: .78rem; color: var(--sb-text-hover); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-member-badge-suspended { color: var(--red); font-size: .6rem; margin-left: auto; }

/* ── Profile popup ───────────────────────────────────────────────────────────── */
.profile-popup-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.3);
}
.profile-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 1001; width: 300px; background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.profile-popup-inner { padding: 20px; }
.profile-popup-close {
  position: absolute; top: 12px; right: 12px; background: none; border: none;
  cursor: pointer; color: var(--text-muted); font-size: 1rem; line-height: 1; padding: 4px 8px;
  border-radius: 4px; transition: background var(--transition);
}
.profile-popup-close:hover { background: var(--card-border); }
.profile-popup-header { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.profile-popup-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: 1.3rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; overflow: hidden;
}
.profile-popup-name { font-size: 1rem; font-weight: 700; }
.profile-popup-username { font-size: .78rem; color: var(--text-muted); }
.profile-popup-roles { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.chat-popup-role {
  font-size: .68rem; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-full);
}
.profile-popup-meta { font-size: .78rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }

/* ── Chat index grid ─────────────────────────────────────────────────────────── */
.chats-grid { display: flex; flex-direction: column; gap: 8px; }
.chat-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  text-decoration: none; color: var(--text);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.chat-card:hover { box-shadow: var(--card-shadow-hover); border-color: var(--accent); }
.chat-card-icon { font-size: 1.8rem; flex-shrink: 0; }
.chat-card-body { flex: 1; min-width: 0; }
.chat-card-name { font-size: .95rem; font-weight: 700; }
.chat-card-desc { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.chat-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.chat-badge {
  font-size: .67rem; font-weight: 600; padding: 1px 7px; border-radius: var(--radius-full);
  background: var(--accent-light); color: var(--accent);
}
.chat-badge-public { background: var(--green-bg); color: var(--green); }
.chat-last-msg { font-size: .75rem; color: var(--text-faint); }
.chat-card-arrow { color: var(--text-faint); flex-shrink: 0; }

/* Dark mode chat ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] .chat-input { background: #1f1f2a; border-color: #2a2a3a; }
[data-theme="dark"] .chat-edit-input { background: #1f1f2a; }
[data-theme="dark"] .chat-members-sidebar { background: var(--card-bg); }
[data-theme="dark"] .profile-popup { background: #1a1a22; }
