/* Portal Control — Super Admin */
:root {
  --bg: #F1F4F7;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --muted: #64748B;
  --faint: #94A3B8;
  --line: #E2E8F0;
  --sidebar: #0B1220;
  --sidebar-hover: #152033;
  --sidebar-active: #1C2A40;
  --accent: #0F766E;
  --accent-hover: #0D9488;
  --danger: #B91C1C;
  --danger-bg: #FEF2F2;
  --warn-bg: #FFFBEB;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --sidebar-w: 260px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}

body.nav-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
code, .mono-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}
code {
  background: #F1F5F9;
  padding: 2px 6px;
  border-radius: 4px;
}

.mobile-only { display: none !important; }
.desktop-only { display: inline-flex; }

/* ——— Login ——— */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(15, 118, 110, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(37, 99, 235, 0.1), transparent 50%),
    linear-gradient(160deg, #0B1220 0%, #152033 45%, #1E293B 100%);
}

.login-panel {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.login-intro {
  padding: clamp(28px, 5vw, 48px);
  color: #E2E8F0;
  background: linear-gradient(145deg, rgba(15, 118, 110, 0.22), transparent 60%), rgba(11, 18, 32, 0.55);
}

.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5EEAD4;
  margin: 14px 0 8px;
  font-weight: 600;
}

.login-intro h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 400;
  color: #F8FAFC;
  margin-bottom: 12px;
}

.lede { color: #94A3B8; max-width: 36ch; margin-bottom: 24px; }

.portal-pills { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.portal-pills li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #CBD5E1;
}
.portal-pills em { margin-left: auto; font-style: normal; color: #64748B; font-size: 0.75rem; }
.portal-pills .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.login-foot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.75rem;
  color: #64748B;
}

.login-form {
  background: #fff;
  padding: clamp(28px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form h2 { font-size: 1.2rem; font-weight: 600; }
.hint { color: var(--muted); font-size: 0.85rem; }

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.login-form input,
.settings-form input,
.settings-form textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
  background: #F8FAFC;
  width: 100%;
}

.login-form input:focus,
.settings-form input:focus,
.settings-form textarea:focus,
.search-wrap input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--accent);
  background: #fff;
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
}

.cred-box {
  margin-top: 4px;
  padding: 12px;
  background: #F8FAFC;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.center { text-align: center; }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #0F766E, #115E59);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.brand-mark.large { width: 52px; height: 52px; font-size: 1rem; border-radius: 14px; }

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: #F8FAFC; }
.btn.block { width: 100%; }
.btn-tiny {
  padding: 5px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}
.btn-tiny.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
}
.icon-btn svg { width: 18px; height: 18px; }

/* ——— Shell ——— */
.app-shell { display: flex; min-height: 100vh; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 18px;
}

.brand-name { font-weight: 700; font-size: 0.95rem; color: #F8FAFC; }
.brand-sub { font-size: 0.7rem; color: #64748B; text-transform: uppercase; letter-spacing: 0.06em; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0 12px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #94A3B8;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #F1F5F9; }
.nav-item.active { background: var(--sidebar-active); color: #F8FAFC; }

.nav-badge {
  margin-left: auto;
  background: #0F766E;
  color: #fff;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}
.nav-badge.soft { background: #334155; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 6px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334155;
  color: #F8FAFC;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar.sm { width: 32px; height: 32px; font-size: 0.68rem; background: #E2E8F0; color: #0F172A; }

.user-name { font-size: 0.85rem; font-weight: 600; color: #F1F5F9; }
.user-role { font-size: 0.7rem; color: #64748B; }

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #CBD5E1;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.06); }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 24px 6px;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-left { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.page-title {
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}
.page-sub { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
}

.top-chip {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.top-chip svg { width: 18px; height: 18px; }
.dot-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #DC2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.page-content {
  padding: 12px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ——— Content blocks ——— */
.hero-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 2px;
}
.hero-strip.compact { align-items: center; }
.hero-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 2px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stats-row.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stat-card.warn { background: linear-gradient(180deg, #FFFBEB, #fff); }
.stat-card.danger { background: linear-gradient(180deg, #FEF2F2, #fff); }
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.stat-value { font-size: clamp(1.3rem, 2vw, 1.75rem); font-weight: 700; letter-spacing: -0.03em; word-break: break-word; }
.stat-foot { font-size: 0.75rem; color: var(--faint); }
.stat-pill {
  background: #F1F5F9;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 1rem; font-weight: 600; }
.text-link { color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.text-link:hover { text-decoration: underline; }

.split-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}
.split-grid.equal { grid-template-columns: 1fr 1fr; }

.alert-banner-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.alert-banner {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #64748B;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.alert-banner.critical { border-left-color: #DC2626; background: #FFFBFB; }
.alert-banner.warning { border-left-color: #D97706; background: #FFFCF5; }
.alert-banner.info { border-left-color: #0F766E; }
.alert-banner em { font-style: normal; color: var(--faint); font-size: 0.72rem; }

.portal-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.portal-card {
  border: 1px solid var(--line);
  border-top: 3px solid var(--portal-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #FAFBFC;
}
.portal-card h3 { font-size: 0.92rem; margin: 8px 0 6px; }
.portal-card p { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; min-height: 3.4em; }
.portal-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.portal-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--portal-color, var(--accent));
}
.portal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--faint);
}

.health-bar {
  height: 5px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.health-bar span { display: block; height: 100%; border-radius: 3px; }

.incident-note {
  margin-top: 10px;
  font-size: 0.75rem;
  color: #92400E;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 8px 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: capitalize;
  background: #F1F5F9;
  color: #475569;
  white-space: nowrap;
}
.status-pill.online { background: #ECFDF5; color: #047857; }
.status-pill.away { background: #FFFBEB; color: #B45309; }
.status-pill.offline { background: #F1F5F9; color: #64748B; }
.status-pill.suspended { background: #FEF2F2; color: #B91C1C; }

.online-list, .stack-list, .mini-user-list, .notif-list, .activity-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.online-list { gap: 12px; }
.online-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.online-list li:last-child { border-bottom: none; padding-bottom: 0; }
.online-name { font-weight: 600; font-size: 0.88rem; }
.online-action { font-size: 0.78rem; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--chip, #64748B) 14%, white);
  color: var(--chip, #64748B);
  white-space: nowrap;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 640px;
}
.data-table.compact { min-width: 480px; }
.data-table th {
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
.data-table tr:hover td { background: #F8FAFC; }
.data-table.compact th, .data-table.compact td { padding: 8px 10px; }

.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; }
.muted { color: var(--muted); }
.tiny { font-size: 0.72rem; }
.strong { font-weight: 600; }
.empty { text-align: center; padding: 32px; color: var(--muted); }
.center { text-align: center; }
.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.user-cell { display: flex; align-items: center; gap: 10px; }
.action-cell { max-width: 280px; font-size: 0.82rem; color: var(--muted); }
.actions-cell { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }

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

.search-wrap { flex: 1; min-width: 200px; }
.search-wrap input {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: #fff;
}

.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: capitalize;
}
.filter-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.filter-pill[style*="--pill"].active {
  background: var(--pill);
  border-color: var(--pill);
}

.legend-panel h3, .subhead {
  font-size: 0.92rem;
  margin-bottom: 6px;
}
.legend-row { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.callout {
  margin-top: 14px;
  padding: 10px 12px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
  border-radius: 8px;
  font-size: 0.82rem;
}

.check.yes { color: #059669; font-size: 1rem; }
.check.no { color: #CBD5E1; font-size: 1rem; }

.portal-detail-grid,
.role-grid,
.dept-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.role-grid, .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.portal-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--portal-color);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.portal-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.portal-detail h2 { font-size: 1.1rem; margin: 6px 0; }
.portal-detail-head p { color: var(--muted); font-size: 0.82rem; }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: #F8FAFC;
  border-radius: var(--radius-sm);
  padding: 12px 8px;
}
.detail-stats div { text-align: center; }
.detail-stats strong { display: block; font-size: 1.1rem; }
.detail-stats span {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.kv-grid div {
  background: #F8FAFC;
  border-radius: 8px;
  padding: 8px 10px;
}
.kv-grid span {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.kv-grid strong { font-size: 0.8rem; font-weight: 600; word-break: break-word; }

.metric-callout {
  font-size: 0.8rem;
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.detail-block h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.module-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: #F1F5F9;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}
.tag.off { opacity: 0.5; text-decoration: line-through; }
.mono-tag { font-family: ui-monospace, Menlo, Consolas, monospace; }

.mini-user-list { gap: 10px; }
.mini-user-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.mini-user-list li .tiny { grid-column: 1 / -1; }
.mini-user-list .live { color: #0F766E; font-weight: 600; }

.avatar-row { display: flex; flex-wrap: wrap; gap: 6px; }

.stack-list { gap: 12px; }
.stack-list li {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.stack-list li:last-child { border-bottom: none; padding-bottom: 0; }
.stack-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 72px 14px 1fr;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid #F1F5F9;
}
.activity-time { display: flex; flex-direction: column; gap: 2px; }
.activity-rail {
  width: 3px;
  border-radius: 2px;
  background: var(--rail);
  justify-self: center;
  margin: 4px 0;
}
.activity-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.activity-action { font-weight: 600; margin-bottom: 2px; }

.notif-item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #F1F5F9;
  align-items: start;
}
.notif-item.unread { background: linear-gradient(90deg, #F0FDFA, transparent); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.notif-rail { width: 4px; border-radius: 2px; min-height: 40px; background: #94A3B8; }
.notif-rail.critical { background: #DC2626; }
.notif-rail.warning { background: #D97706; }
.notif-rail.info { background: #0F766E; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}
.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
}

.chart-wrap { display: flex; flex-direction: column; gap: 16px; }
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding: 8px 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 100%;
  max-width: 28px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
}
.bar-col span { font-size: 0.65rem; color: var(--faint); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.check-row {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  margin-top: 18px;
}
.check-row input { width: auto; }

.settings-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ——— Responsive ——— */
@media (max-width: 1280px) {
  .stats-row.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .portal-cards { grid-template-columns: 1fr; }
  .alert-banner-row { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid, .split-grid.equal { grid-template-columns: 1fr; }
  .portal-detail-grid { grid-template-columns: 1fr; }
  .role-grid, .dept-grid { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .mobile-only { display: grid !important; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-brand .icon-btn {
    margin-left: auto;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: #E2E8F0;
  }
  .login-panel { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .topbar { padding: 14px 14px 4px; }
  .page-content { padding: 10px 14px 32px; }
  .topbar-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 56px 10px 1fr; }
  .hero-actions .btn { width: 100%; }
  .hero-actions { width: 100%; }
}

@media (max-width: 560px) {
  .stats-row, .stats-row.cols-6 { grid-template-columns: 1fr; }
  .search-wrap input { max-width: none; }
  .notif-item { grid-template-columns: 4px 1fr; }
  .notif-item .btn-tiny { grid-column: 2; justify-self: start; }
  .online-list li { grid-template-columns: auto 1fr; }
  .online-list .chip { grid-column: 2; justify-self: start; }
}
