@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_UltraLight.ttf') format('truetype'); font-weight: 200; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Light.ttf') format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Medium.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Black.ttf') format('truetype'); font-weight: 800; font-display: swap; }

:root {
  --bg: #FAFBFD;
  --surface: #FFFFFF;
  --surface-2: #F5F7FB;
  --border: #EFF1F6;
  --border-2: #E3E7EF;
  --ink: #1B2559;
  --ink-2: #6C7793;
  --ink-3: #A4ADC2;
  --accent: #5B76F7;
  --accent-soft: #EEF1FE;
  --accent-dark: #3D57D6;
  --accent-ink: var(--accent-dark);
  --accent-soft-hover: #E3E8FD;
  --green: #34C88A;
  --green-soft: #E6F9F0;
  --red: #F2757A;
  --red-soft: #FDEDEE;
  --amber: #F5B942;
  --amber-soft: #FEF6E6;
  --violet: #A78BFA;
  --pink: #F48FB9;
  --sky: #6FB4F5;
  --teal: #45C7C0;
  --sidebar-w: 224px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 68px;
  --radius-sm: 10px;
  --card-control-h: 36px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(27,37,89,.04), 0 6px 18px rgba(27,37,89,.04);
  --shadow: 0 8px 28px rgba(27,37,89,.08);
  --shadow-lg: 0 18px 50px rgba(27,37,89,.14);
  --shadow-accent: 0 8px 20px rgba(91,118,247,.25);
  --overlay: rgba(27,37,89,.28);
  --row-hover: #FCFCFE;
  --toast-bg: var(--ink);
  --toast-ink: #fff;
  --ease: cubic-bezier(.4,.14,.3,1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1020;
  --surface: #151A2D;
  --surface-2: #1D2339;
  --border: #232A43;
  --border-2: #2C3452;
  --ink: #E7EAF6;
  --ink-2: #A2AACA;
  --ink-3: #6D7697;
  --accent: #6A82FF;
  --accent-soft: rgba(106,130,255,.14);
  --accent-dark: #5670F0;
  --accent-ink: #A9B8FF;
  --accent-soft-hover: rgba(106,130,255,.22);
  --green: #3DD598;
  --green-soft: rgba(61,213,152,.13);
  --red: #FF7C82;
  --red-soft: rgba(255,124,130,.13);
  --amber: #F7C35C;
  --amber-soft: rgba(247,195,92,.13);
  --shadow-sm: 0 0 0 1px rgba(255,255,255,.035), 0 8px 24px rgba(0,0,0,.28);
  --shadow: 0 0 0 1px rgba(255,255,255,.05), 0 14px 36px rgba(0,0,0,.4);
  --shadow-lg: 0 0 0 1px rgba(255,255,255,.06), 0 24px 60px rgba(0,0,0,.55);
  --shadow-accent: 0 6px 16px rgba(106,130,255,.18);
  --overlay: rgba(5,7,16,.62);
  --row-hover: rgba(255,255,255,.02);
  --toast-bg: #262D4A;
  --toast-ink: var(--ink);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 560px at 100% -8%, rgba(106,130,255,.09), transparent 62%),
    radial-gradient(900px 520px at 0% 108%, rgba(167,139,250,.06), transparent 60%);
  background-attachment: fixed;
}

[data-theme="dark"] .form-input:-webkit-autofill,
[data-theme="dark"] .form-input:-webkit-autofill:hover,
[data-theme="dark"] .form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--surface-2) inset;
}

[data-theme="dark"] .btn-launch.enter:not(:disabled),
[data-theme="dark"] .btn-primary:not(:disabled),
[data-theme="dark"] .btn-add { box-shadow: var(--shadow-accent); }

.theme-switching :not(.theme-toggle, .theme-toggle *),
.theme-switching :not(.theme-toggle, .theme-toggle *)::before,
.theme-switching :not(.theme-toggle, .theme-toggle *)::after { transition: none !important; }

.theme-fading,
.theme-fading :not(.theme-toggle, .theme-toggle *),
.theme-fading :not(.theme-toggle, .theme-toggle *)::before,
.theme-fading :not(.theme-toggle, .theme-toggle *)::after {
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease), fill .35s var(--ease), stroke .35s var(--ease) !important;
}

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'IRANSans', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--accent-ink); }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }

/* ─── LOGIN PAGE ─────────────────────────────── */
.login-page { display: flex; min-height: 100vh; min-height: 100dvh; background: var(--surface); }

.login-form-side {
  flex: 0 0 470px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 48px 64px;
  position: relative;
  z-index: 1;
}

.login-visual-side {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #FDFDFF 0%, #F3F6FE 45%, #EFF6FB 100%);
}

.login-visual-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 30% 30%, rgba(167,139,250,.16) 0%, transparent 70%),
    radial-gradient(ellipse 50% 55% at 72% 72%, rgba(111,180,245,.18) 0%, transparent 70%);
}

.login-waves {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.login-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-name { font-size: 14px; font-weight: 700; letter-spacing: -.2px; line-height: 1.6; }

.login-heading { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 26px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.check-group { display: flex; gap: 20px; flex-wrap: wrap; }

.secret-text {
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: center;
  direction: ltr;
  word-break: break-all;
  margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }

.form-input-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; right: 14px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; flex-shrink: 0; }

.form-input {
  width: 100%;
  padding: 12px 42px 12px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.form-input::placeholder { color: var(--ink-3); }
.form-input.ltr { direction: ltr; text-align: left; padding-right: 14px; padding-left: 42px; }
.form-input.credential { direction: ltr; text-align: right; }
.form-input.credential::placeholder { direction: rtl; text-align: right; unicode-bidi: plaintext; }
.form-input.code { direction: ltr; text-align: center; letter-spacing: 6px; }
.form-input.has-toggle { padding-left: 42px; }
.form-group.tight { margin-bottom: 0; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-file { padding: 9px; }
.label-note { font-weight: 400; color: var(--ink-3); }

.input-icon-btn {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color .2s;
}
.input-icon-btn:hover { color: var(--ink-2); }

.login-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  box-shadow: var(--shadow-accent);
  transition: background .2s, box-shadow .2s, transform .15s;
}
.login-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.login-error {
  background: var(--red-soft);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  animation: shake .3s ease;
}
.login-error.show { display: block; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

.tfa-hint {
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
  margin-bottom: 20px;
}

.tfa-back {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-3);
  width: 100%;
  text-align: center;
  padding: 10px;
  margin-top: 4px;
  transition: color .2s;
}
.tfa-back:hover { color: var(--accent); }

.qr-wrap { display: flex; justify-content: center; margin: 16px 0; }
.qr-wrap svg, .qr-wrap img { border-radius: var(--radius-sm); padding: 12px; background: #fff; box-shadow: var(--shadow-sm); }

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .2s var(--ease), transform .2s var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 22px 22px 18px;
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-name { font-size: 12.5px; font-weight: 700; letter-spacing: -.2px; line-height: 1.6; }

.sidebar-nav {
  flex: 1;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: right;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.nav-item svg { flex-shrink: 0; color: var(--ink-3); transition: color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover svg { color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.nav-item.active svg { color: var(--accent); }
.nav-label { white-space: nowrap; overflow: hidden; }
.nav-logout:hover { background: var(--red-soft); color: var(--red); }
.nav-logout:hover svg { color: var(--red); }

.sidebar-footer { padding: 14px; flex-shrink: 0; }

body.sidebar-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 22px 0 18px; }
body.sidebar-collapsed .sidebar-brand-name,
body.sidebar-collapsed .nav-label { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 11px 0; }

.sidebar-scrim { display: none; }

/* ─── MAIN AREA ───────────────────────────────── */
.main-area {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin .2s var(--ease);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 30px;
  gap: 14px;
}

.topbar-title { font-size: 15px; font-weight: 700; flex-shrink: 0; letter-spacing: -.2px; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface-2);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 60px;
  height: 32px;
  margin-right: auto;
  padding: 0;
  border: none;
  border-radius: 99px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-2);
  overflow: hidden;
  transition: background .35s var(--ease), box-shadow .35s var(--ease);
}
.theme-toggle::before,
.theme-toggle::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.theme-toggle::before { width: 3px; height: 3px; top: 9px; right: 14px; box-shadow: 8px 9px 0 -.5px #fff, -4px 12px 0 -1px #fff; }
.theme-toggle::after { width: 2px; height: 2px; top: 19px; right: 22px; }
.theme-toggle:hover { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.theme-toggle:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }

.theme-toggle-thumb {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #FFD37A, #F5B942);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245,185,66,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .4s cubic-bezier(.34,1.4,.5,1), background .35s var(--ease), box-shadow .35s var(--ease);
}
.theme-toggle-thumb svg {
  position: absolute;
  transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.theme-toggle-moon { opacity: 0; transform: rotate(-70deg) scale(.5); }

.theme-toggle[aria-checked="true"] { background: linear-gradient(135deg, #1B2250, #2A2F6B); box-shadow: inset 0 0 0 1px rgba(106,130,255,.35); }
.theme-toggle[aria-checked="true"]::before,
.theme-toggle[aria-checked="true"]::after { opacity: .85; transform: scale(1); }
.theme-toggle[aria-checked="true"] .theme-toggle-thumb {
  transform: translateX(-28px);
  background: linear-gradient(145deg, #8FA2FF, #6A82FF);
  box-shadow: 0 2px 10px rgba(106,130,255,.55);
}
.theme-toggle[aria-checked="true"] .theme-toggle-sun { opacity: 0; transform: rotate(90deg) scale(.5); }
.theme-toggle[aria-checked="true"] .theme-toggle-moon { opacity: 1; transform: none; }
.theme-toggle[aria-checked="true"]:hover,
.theme-toggle[aria-checked="true"]:focus-visible { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }

.page-body { flex: 1; padding: 26px 30px 40px; }

/* ─── MODULE GRID ─────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.module-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.module-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

.module-icon { display: flex; align-items: center; height: 32px; }
.module-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; }
.module-body { flex: 1; }
.module-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; letter-spacing: -.2px; }
.module-desc { font-size: 12px; color: var(--ink-3); line-height: 1.6; }

.module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 99px;
}
.status-dot.connected { background: var(--green-soft); color: var(--green); }
.status-dot.connected::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.status-dot.disconnected { background: var(--surface-2); color: var(--ink-3); }
.status-dot.disconnected::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }

.btn-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--card-control-h);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: background .15s, color .15s, transform .15s;
}
.btn-launch.enter { background: var(--accent); color: #fff; }
.btn-launch.enter:hover { background: var(--accent-dark); }
.btn-launch.connect { background: var(--accent-soft); color: var(--accent); }
.btn-launch.connect:hover { background: var(--accent-soft-hover); }
.btn-launch:hover { transform: translateY(-1px); }
.btn-launch:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.module-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-buttons .action-btn {
  width: var(--card-control-h);
  height: var(--card-control-h);
  border-radius: var(--radius-sm);
}

.grid-loading {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
}

.apps-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-3);
}
.apps-empty svg { margin-bottom: 16px; opacity: .35; }
.apps-empty p { font-size: 14px; }

/* ─── MODALS ──────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 28px;
  width: 100%;
  max-width: 430px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  animation: modal-in .2s cubic-bezier(.22,1,.36,1);
}
@keyframes modal-in { from { opacity:0; transform:scale(.97) translateY(8px); } to { opacity:1; transform:scale(1) translateY(0); } }

.modal-md { max-width: 560px; }
.modal-wide { max-width: 720px; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 18px; letter-spacing: -.2px; }
.modal-sub { font-size: 12.5px; color: var(--ink-3); margin: -14px 0 20px; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

.btn {
  flex: 1;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, color .15s, transform .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:not(:disabled):hover { transform: translateY(-1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-dark); }
.btn-auto { flex: 0 0 auto; padding: 10px 22px; }
.btn-start { align-self: flex-start; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); }
.btn-ghost:not(:disabled):hover { background: var(--border); }

/* ─── SETTINGS ────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
  gap: 20px;
  max-width: 940px;
}

.settings-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
}
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card-hint { font-size: 12.5px; color: var(--ink-2); margin-bottom: 14px; }
.tfa-status-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.tfa-status-label { font-size: 13px; color: var(--ink-2); }
.tfa-setup-section { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 20px; }

.settings-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -.2px;
}

/* ─── ADMIN ───────────────────────────────────── */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 22px; }

.admin-tab {
  padding: 9px 20px;
  border: none;
  border-radius: 99px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.admin-tab.active { background: var(--accent-soft); color: var(--accent-ink); }
.admin-tab:hover:not(.active) { color: var(--ink-2); background: var(--surface-2); }

.table-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
}
.table-header-title { font-size: 14px; font-weight: 700; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: right;
  padding: 11px 24px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  background: var(--surface-2);
  white-space: nowrap;
}
.data-table td {
  padding: 15px 24px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: var(--row-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--accent-soft); color: var(--accent); }

.table-strong { font-weight: 700; }
.table-link { color: var(--accent); font-size: 12px; }
.table-link:hover { text-decoration: underline; }
.table-empty { text-align: center; padding: 30px; color: var(--ink-3); }
.ltr-inline { direction: ltr; display: inline-block; }

.table-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}
.table-logo img { width: 100%; height: 100%; object-fit: contain; }

.access-list { max-height: 300px; overflow-y: auto; }
.access-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.access-row:last-child { border-bottom: none; }
.access-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.access-name { font-weight: 600; }
.access-url { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-actions { display: flex; gap: 6px; }
.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: none;
  background: var(--surface-2);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.action-btn:hover { background: var(--accent-soft); color: var(--accent); }
.action-btn.danger:hover { background: var(--red-soft); color: var(--red); }

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  transition: background .15s;
}
.btn-add:hover { background: var(--accent-dark); }

/* ─── MISC ────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--toast-bg);
  color: var(--toast-ink);
  padding: 10px 22px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow);
  animation: toast-in .25s ease, toast-out .25s ease 2.5s forwards;
  pointer-events: auto;
}
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes toast-out { to { opacity:0; transform:translateY(6px); } }

@media (max-width: 1100px) {
  .module-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  .main-area { margin-right: 0; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: var(--overlay);
  }
}
@media (max-width: 700px) {
  .topbar { padding: 0 18px; }
  .page-body { padding: 20px 18px 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (max-width: 600px) {
  .module-grid { grid-template-columns: 1fr; }
  .login-form-side { flex: 1; padding: 34px 24px; }
  .login-visual-side { display: none; }
}
