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

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  /* Brand */
  --primary:       #189f9d;
  --primary-dark:  #0e8c8a;
  --primary-light: rgba(24,159,157,0.12);
  --primary-glow:  rgba(24,159,157,0.28);

  /* Semantic */
  --danger:        #ef4444;
  --danger-light:  rgba(239,68,68,0.1);
  --success:       #22c55e;
  --success-light: rgba(34,197,94,0.1);
  --warning:       #f59e0b;
  --warning-light: rgba(245,158,11,0.1);

  /* Sidebar — always dark, never changes */
  --sb-bg:          #080e1a;
  --sb-border:      rgba(255,255,255,0.055);
  --sb-hover:       rgba(255,255,255,0.05);
  --sb-active-bg:   rgba(24,159,157,0.14);
  --sb-text:        #8a9ab5;
  --sb-text-hover:  #c8d3e5;
  --sb-text-active: #189f9d;
  --sb-title:       #f1f5f9;
  --sb-section:     rgba(138,154,181,0.45);

  /* Main area — light mode */
  --bg:       #f0f4f8;
  --bg2:      #e8edf3;
  --surface:  #ffffff;
  --border:   #dde3ec;
  --text:     #0d1929;
  --text-2:   #2d3f57;
  --text-muted: #6b7a95;

  /* Shadows — light mode */
  --shadow-xs: 0 1px 2px rgba(13,25,41,0.05);
  --shadow:    0 2px 6px rgba(13,25,41,0.07), 0 1px 2px rgba(13,25,41,0.04);
  --shadow-md: 0 6px 16px rgba(13,25,41,0.09), 0 2px 4px rgba(13,25,41,0.05);
  --shadow-lg: 0 16px 40px rgba(13,25,41,0.12), 0 4px 8px rgba(13,25,41,0.06);

  /* Layout */
  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --sidebar-w: 256px;
  --topbar-h:  62px;
  --tx: 0.16s ease;
}

/* ── Dark Mode (main area only, sidebar unchanged) ───────── */
:root[data-theme="dark"] {
  --bg:       #030712;
  --bg2:      #080e1a;
  --surface:  #0d1b2e;
  --border:   rgba(255,255,255,0.075);
  --text:     #eef2f8;
  --text-2:   #c8d3e5;
  --text-muted: #6b7a95;
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 2px 8px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.35);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.55), 0 3px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.65), 0 6px 12px rgba(0,0,0,0.45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       #030712;
    --bg2:      #080e1a;
    --surface:  #0d1b2e;
    --border:   rgba(255,255,255,0.075);
    --text:     #eef2f8;
    --text-2:   #c8d3e5;
    --text-muted: #6b7a95;
    --shadow-xs: 0 1px 3px rgba(0,0,0,0.4);
    --shadow:    0 2px 8px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.35);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.55), 0 3px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.65), 0 6px 12px rgba(0,0,0,0.45);
  }
}

/* ── Base ───────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: .875em;
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--primary-glow), 0 4px 12px rgba(24,159,157,0.3);
}

.sidebar-logo-text {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--sb-title);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Nav */
.sidebar-nav {
  padding: 10px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 18px 10px 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sb-section);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--sb-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--tx), color var(--tx), transform var(--tx);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  user-select: none;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--sb-hover);
  color: var(--sb-text-hover);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--sb-active-bg);
  color: var(--sb-text-active);
  font-weight: 600;
}

/* Active left-border indicator */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%; transform: translateY(-50%);
  width: 3px;
  height: 55%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--primary-glow);
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: transform var(--tx);
}
.nav-item:hover .nav-icon { transform: scale(1.12); }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--sb-border);
  padding: 10px 8px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--tx);
}
.user-info:hover { background: var(--sb-hover); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px var(--primary-glow);
  letter-spacing: -0.01em;
}

.user-name { font-weight: 700; font-size: 13px; color: var(--sb-title); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--sb-section); margin-top: 2px; }

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

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Page Content ───────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 22px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--tx);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.01em;
  user-select: none;
}

.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 4px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg2);
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 1px 4px rgba(239,68,68,0.25);
}
.btn-danger:hover:not(:disabled) {
  opacity: .88;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239,68,68,0.3);
}

.btn-sm  { padding: 6px 12px; font-size: 12.5px; }
.btn-xs  { padding: 4px 9px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--tx), box-shadow var(--tx), background var(--tx);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--surface);
}

input::placeholder { color: var(--text-muted); opacity: 0.6; }

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1.5px solid transparent;
}
.alert-error   { background: var(--danger-light);  color: var(--danger);  border-color: rgba(239,68,68,0.3); }
.alert-success { background: var(--success-light); color: #16a34a;        border-color: rgba(34,197,94,0.3); }
.alert:empty { display: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-muted   { background: var(--bg2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-success { background: var(--success-light); color: #16a34a; }
.badge-danger  { background: var(--danger-light); color: var(--danger); }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--tx); }
tbody tr:hover td { background: var(--bg2); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,10,20,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(18px) scale(0.97);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ── Module Cards ────────────────────────────────────────── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.module-card:hover::before { opacity: 1; }

.module-card:hover .module-card-icon { transform: scale(1.12); }

.module-card-icon {
  font-size: 30px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.module-card-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.module-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  line-height: 1.5;
}

/* ── Status Dots ─────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 2px rgba(34,197,94,0.2); }
.status-dot.offline { background: var(--danger); }
.status-dot.unknown { background: var(--text-muted); }

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

/* ── Theme Toggle ────────────────────────────────────────── */
#theme-toggle {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  transition: all var(--tx);
  line-height: 1;
}
#theme-toggle:hover {
  background: var(--bg2);
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #04090f;
  background-image:
    linear-gradient(rgba(24,159,157,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,159,157,.045) 1px, transparent 1px);
  background-size: 48px 48px;
  position: relative;
  overflow: hidden;
}

/* Radial glow top-center */
.login-page::before {
  content: '';
  position: absolute;
  top: -15%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 420px;
  background: radial-gradient(ellipse, rgba(24,159,157,0.18) 0%, transparent 65%);
  pointer-events: none;
}

/* Radial glow bottom-right */
.login-page::after {
  content: '';
  position: absolute;
  bottom: -8%;
  right: -8%;
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(24,159,157,0.07) 0%, transparent 65%);
  pointer-events: none;
}

.login-box {
  background: rgba(10,17,30,0.95);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 18px;
  box-shadow:
    0 30px 70px rgba(0,0,0,0.65),
    0 0 0 1px rgba(24,159,157,0.07),
    inset 0 1px 0 rgba(255,255,255,0.04);
  width: 100%;
  max-width: 400px;
  padding: 42px 38px 38px;
  position: relative;
  z-index: 1;
  animation: loginIn 0.4s cubic-bezier(0.34,1.2,0.64,1);
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 18px;
  font-size: 30px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px var(--primary-glow), 0 0 0 4px rgba(24,159,157,0.12);
}

.login-brand {
  font-size: 24px;
  font-weight: 900;
  color: #eef2f8;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.login-brand span { color: var(--primary); }

.login-subtitle {
  font-size: 13px;
  color: #5a6a84;
}

/* Form fields inside dark login card */
.login-box label {
  color: #6b7a95;
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.login-box input[type="text"],
.login-box input[type="password"] {
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.09);
  color: #eef2f8;
  border-radius: 8px;
}

.login-box input:focus {
  background: rgba(255,255,255,0.07);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24,159,157,0.18);
}

.login-box input::placeholder { color: #384557; }

.login-box .alert-error {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.25);
  color: #f87171;
}

.login-box .btn-ghost {
  color: #6b7a95;
  border-color: rgba(255,255,255,0.09);
}
.login-box .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.18);
  color: #c8d3e5;
}

/* TOTP 6-digit input */
.code-input {
  text-align: center !important;
  font-size: 28px !important;
  letter-spacing: .28em !important;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace !important;
  padding: 14px !important;
}

/* QR Code */
.qr-container {
  text-align: center;
  padding: 10px 0 4px;
}

.qr-container img {
  width: 184px;
  height: 184px;
  border-radius: 12px;
  border: 3px solid rgba(255,255,255,0.07);
  padding: 6px;
  background: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.secret-key {
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 9px 12px;
  word-break: break-all;
  text-align: center;
  margin-top: 12px;
  color: #4a5a72;
}

/* Setup instruction steps */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
}

.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 13px;
  color: #8a9ab5;
  line-height: 1.4;
}

.setup-step-num {
  width: 21px; height: 21px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Divider with text in login */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.07);
}
.login-divider span {
  font-size: 11.5px;
  color: #4a5a72;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Mini Avatar (Tabellen) ──────────────────────────────── */
.mini-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ── Permission Rows ─────────────────────────────────────── */
.perm-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--tx);
}
.perm-row:last-child { border-bottom: none; }
.perm-row:hover { color: var(--primary); }

.perm-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.perm-row-icon { font-size: 18px; }

/* ── Activity Log ────────────────────────────────────────── */
.log-entry {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  transition: background var(--tx);
}
.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background: var(--bg); }

.log-action {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.log-detail {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 3px;
}

.log-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: "SF Mono", ui-monospace, monospace;
}

/* ── Toast System ────────────────────────────────────────── */
.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: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 0.25s cubic-bezier(0.34,1.3,0.64,1);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }

.toast-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
  line-height: 1;
}
.toast-success .toast-icon { background: var(--success-light); color: #16a34a; }
.toast-error   .toast-icon { background: var(--danger-light);  color: var(--danger); }

@keyframes toastIn {
  from { transform: translateX(32px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(32px); opacity: 0; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--tx); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .modules-grid { grid-template-columns: 1fr; }
}

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.fw-bold  { font-weight: 700; }
.fw-black { font-weight: 900; }
.w-full   { width: 100%; }
.text-center { text-align: center; }
