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

:root {
  --sidebar-w: 224px;
  --sidebar-bg: #0f0f10;
  --sidebar-text: #a1a1aa;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active-bg: rgba(255,255,255,0.10);
  --sidebar-active: #ffffff;
  --bg: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e7e5;
  --text: #0f0f10;
  --muted: #6b6b6b;
  --accent: #2563eb;
  --accent-light: #eff4ff;
  --radius: 12px;
  --green: #16a34a; --green-bg: #f0fdf4; --green-border: #bbf7d0;
  --red: #dc2626;   --red-bg: #fef2f2;   --red-border: #fecaca;
  --yellow: #b45309;--yellow-bg: #fffbeb;--yellow-border: #fde68a;
  --purple: #7c3aed;--purple-bg: #f5f3ff;--purple-border: #ddd6fe;
  --orange: #c2410c;--orange-bg: #fff7ed;--orange-border: #fed7aa;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

button, a { font: inherit; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; }

/* ── SHELL ─────────────────────────────────────────────────────────── */

.admin-shell {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo img {
  height: 26px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.sidebar-logo-text {
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1.2px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
}

.s-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.s-user-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.s-user-role {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  padding: 14px 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.85);
}

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

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(220,38,38,0.2);
  color: #f87171;
  display: none;
}

.nav-badge:not(:empty) { display: inline-block; }

.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link, .sidebar-link--btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  transition: background .15s, color .15s;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.sidebar-link svg, .sidebar-link--btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.sidebar-link:hover, .sidebar-link--btn:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.7);
}

/* ── MAIN ──────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ────────────────────────────────────────────────────────── */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.data-notice-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.data-notice-inline.is-live {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

.notice-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.data-notice-inline.is-live .notice-dot {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(22,163,74,0.2);
}

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}

.topbar-btn:hover { opacity: 0.82; }
.topbar-btn:disabled { opacity: 0.5; cursor: wait; }

.topbar-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ── CONTENT ───────────────────────────────────────────────────────── */

.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 40px;
}

/* ── STAT CARDS ────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-icon-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-note {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* ── APPS GRID ─────────────────────────────────────────────────────── */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.app-card h3 {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.app-card p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.app-stats {
  display: flex;
  gap: 16px;
}

.app-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-stats strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.app-stats span {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.app-error {
  font-size: 11px;
  color: var(--red);
  padding: 6px 10px;
  background: var(--red-bg);
  border-radius: 6px;
}

.app-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── STATUS PILL ───────────────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.status-pill.offline {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

/* ── PANELS ────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.panel-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.panel-body {
  padding: 4px 0;
}

/* ── TWO COL ───────────────────────────────────────────────────────── */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── STATUS LIST ───────────────────────────────────────────────────── */

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #f5f5f4;
}

.status-item:last-child { border-bottom: none; }

.status-item strong {
  font-size: 13px;
  font-weight: 700;
  display: block;
}

.status-item small {
  font-size: 11px;
  color: var(--muted);
}

/* ── TABLE ─────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 10px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.tbl td {
  padding: 11px 18px;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f4;
  vertical-align: middle;
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafaf9; }

/* ── BADGES ────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border);  }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border);    }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-blue   { background: var(--accent-light); color: var(--accent); border: 1px solid #bfdbfe; }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
.badge-gray   { background: #f4f4f3; color: var(--muted); border: 1px solid var(--border); }

.severity.high   { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border);    padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.severity.medium { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.severity.low    { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border);  padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }

/* ── BUTTONS ───────────────────────────────────────────────────────── */

.text-button, .act-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background .15s;
}

.text-button:hover, .act-btn:hover { background: var(--bg); }

.primary-button, .act-btn.primary {
  background: var(--accent-light);
  color: var(--accent);
  border-color: #bfdbfe;
}

.danger-button, .act-btn.danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

.danger-button:hover, .act-btn.danger:hover { background: #fee2e2; }

.act-btn.success {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}

/* ── DETAIL / ADMIN FORMS ──────────────────────────────────────────── */

.detail-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.mini-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.mini-card strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
}

.mini-card span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
}

.admin-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

.admin-form-grid input:focus,
.admin-form-grid select:focus,
.admin-form-grid textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

.form-wide {
  padding: 0 16px 16px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.form-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.form-message {
  font-size: 13px;
  padding: 12px 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.form-message.is-success {
  color: var(--green);
  background: var(--green-bg);
}

.form-message.is-error {
  color: var(--red);
  background: var(--red-bg);
}

/* ── PERMISSION CHECKBOXES ─────────────────────────────────────────── */

.checkbox-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.checkbox-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 7px;
  transition: background .1s;
  text-transform: none;
  letter-spacing: 0;
}

.checkbox-panel label:hover { background: var(--bg); }

.checkbox-panel input[type="checkbox"] {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ── TABLE (detail) ────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
}

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

.table-wrap th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 10px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.table-wrap td {
  padding: 11px 18px;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f4;
  vertical-align: middle;
}

.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: #fafaf9; }

/* ── ACCESS SCREEN ─────────────────────────────────────────────────── */

.access-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.access-screen[hidden] { display: none; }

.access-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
  border-radius: 24px;
  padding: 40px 36px;
  background: #fff;
  box-shadow: 0 32px 80px rgba(0,0,0,0.2);
}

.access-card img {
  width: 56px;
  margin-bottom: 20px;
}

.access-card h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  margin-bottom: 10px;
}

.access-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.access-actions {
  display: flex;
  justify-content: center;
}

.primary-link {
  display: inline-block;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 12px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  transition: opacity .15s;
}

.primary-link:hover { opacity: 0.82; }

/* ── APP FILTER TABS ───────────────────────────────────────────────── */

.app-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.app-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}

.app-filter-btn:hover { background: var(--bg); }

.app-filter-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.filter-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
}

.app-filter-btn:not(.active) .filter-count {
  background: var(--bg);
  color: var(--muted);
}

/* ── ROLE PICKER ───────────────────────────────────────────────────── */

.role-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.role-pick-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}

.role-pick-item small {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}

.role-pick-item:hover {
  border-color: #a1a1aa;
  background: var(--bg);
}

.role-pick-item.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.role-pick-item.active small {
  color: var(--accent);
  opacity: 0.7;
}

.role-pick-item--none {
  color: var(--muted);
  border-style: dashed;
}

.role-pick-item--none.active {
  border-color: var(--border);
  background: var(--bg);
  color: var(--muted);
}

/* ── DETAIL FULL PAGE ──────────────────────────────────────────────── */

#overviewBlocks[hidden] { display: none; }
#detailPanel[hidden] { display: none; }

.detail-panel--full {
  margin-top: 0 !important;
  border-radius: var(--radius);
  min-height: calc(100vh - 58px - 44px);
}

.detail-panel--full .panel-body {
  padding: 0;
}

/* ── SCROLLBAR ─────────────────────────────────────────────────────── */

.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }


/* ── APP DETAIL TABS & ACTION BUTTONS ──────────────────────────────── */

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

.app-detail-stats {
  display: flex;
  gap: 20px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-stat strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.mini-stat span {
  font-size: 11px;
  color: var(--muted);
}

.app-detail-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.app-tab-btn {
  padding: 7px 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s;
}

.app-tab-btn:hover { color: var(--text); }

.app-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* action buttons inside table rows */
.act-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-act {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-act:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-act-green {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.btn-act-green:hover:not(:disabled) { background: #a7f3d0; }

.btn-act-red {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.btn-act-red:hover:not(:disabled) { background: #fecaca; }

.btn-act-blue {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

.btn-act-blue:hover:not(:disabled) { background: #bfdbfe; }

/* ── TAB FILTER BAR ─────────────────────────────────────────────────── */

.tab-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.tab-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
}

.tab-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.tab-search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}

.tab-search-input:focus { border-color: var(--accent); }

.tab-status-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.tab-refresh-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab-refresh-btn:hover { background: var(--bg); color: var(--text); }

.tab-refresh-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── PAGINATION ─────────────────────────────────────────────────────── */

.tab-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.page-btn:hover:not(:disabled) { background: var(--bg); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-info {
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}

/* ── USER AVATAR MINI ───────────────────────────────────────────────── */

.user-avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ── ADD BUTTON (tab level) ─────────────────────────────────────────── */

.tab-add-btn {
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.tab-add-btn:hover { opacity: 0.88; }

/* ── KEYWORD CHIP ───────────────────────────────────────────────────── */

.kw-chip {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── MODAL ──────────────────────────────────────────────────────────── */

.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.app-modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 480px;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity:0; transform: scale(0.94) translateY(-10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.app-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.app-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.app-modal-close:hover { background: var(--bg); color: var(--text); }

.app-modal-body {
  padding: 18px 20px 20px;
}

.modal-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.modal-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
  resize: vertical;
}

.modal-input:focus { border-color: var(--accent); }

/* orange action button */
.btn-act-orange {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fed7aa;
}

.btn-act-orange:hover:not(:disabled) { background: #fed7aa; }

/* ── SECURITY SECTION ───────────────────────────────────────────────── */

.sec-settings-wrap {
  padding: 8px 0;
}

.sec-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  gap: 20px;
}

.sec-setting-row:last-child { border-bottom: none; }

.sec-setting-info { flex: 1; }

.sec-setting-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sec-setting-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.sec-setting-control { flex-shrink: 0; }

.sec-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.sec-input:focus { border-color: var(--accent); }

/* Toggle switch */
.sec-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.sec-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.sec-toggle-track {
  display: block;
  width: 42px;
  height: 24px;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
  position: relative;
}

.sec-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.sec-toggle input:checked + .sec-toggle-track { background: var(--accent); }
.sec-toggle input:checked + .sec-toggle-track::after { transform: translateX(18px); }

/* Notifications */
.sec-notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.sec-notif-row:hover { background: var(--bg); }
.sec-notif-read { opacity: 0.55; }

.sec-notif-icon {
  font-size: 18px;
  flex-shrink: 0;
  padding-top: 2px;
}
