/* ─────────────────────────────────────────────────────────────
   Project Sentinel — Dark Theme
   ───────────────────────────────────────────────────────────── */

/* ── Custom properties ──────────────────────────────────────── */
:root {
  --bg-base:        #0d1117;
  --bg-surface:     #161b22;
  --bg-elevated:    #1c2128;
  --bg-overlay:     #22272e;
  --bg-input:       #0d1117;

  --border-default: rgba(240, 246, 252, 0.1);
  --border-muted:   rgba(240, 246, 252, 0.06);
  --border-focus:   #2f81f7;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;
  --text-link:      #2f81f7;

  --accent-blue:    #2f81f7;
  --accent-blue-h:  #58a6ff;
  --accent-green:   #3fb950;
  --accent-red:     #f85149;
  --accent-orange:  #d29922;
  --accent-purple:  #a371f7;
  --accent-teal:    #2dd4bf;

  --sidebar-width:           260px;
  --sidebar-collapsed-width: 64px;
  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.6);

  --transition: 150ms ease;
}

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

html { height: 100%; font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  height: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

svg { display: block; flex-shrink: 0; }

/* ── Portal layout ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  z-index: 100;
  flex-shrink: 0;
  transition: width 0.18s ease;
}

/* ── Collapsed rail state ────────────────────────────────────── */
.sidebar-collapsed {
  width: var(--sidebar-collapsed-width);
}

/* ── Main content reflows when sidebar toggles ───────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.18s ease;
}

.sidebar-collapsed + .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* ── Sidebar brand ───────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-height: 60px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 8px 14px;
}

.sidebar-collapsed .brand-icon,
.sidebar-collapsed .brand-name {
  display: none;
}

/* ── Sidebar toggle button ───────────────────────────────────── */
.sidebar-toggle-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  line-height: 0;
  transition: color var(--transition), background var(--transition);
}

.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.sidebar-collapsed .sidebar-toggle-btn {
  margin-left: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
}

.brand-name { color: var(--text-primary); }

/* ── Nav text label (wraps bare text nodes for transition) ───── */
.nav-label {
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
  transition: max-width 0.18s ease, opacity 0.15s ease;
}

.sidebar-collapsed .nav-label {
  max-width: 0;
  opacity: 0;
}

/* ── Sidebar navigation ──────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-collapsed .sidebar-nav {
  padding-left: 4px;
  padding-right: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition),
              padding var(--transition);
  text-decoration: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: rgba(47, 129, 247, 0.15);
  color: var(--accent-blue-h);
}

/* ── Collapsed nav item: icon centered in rail ───────────────── */
.sidebar-collapsed .nav-item {
  padding: 9px 19px;
  gap: 0;
  justify-content: flex-start;
}

/* ── Collapsed tooltip via CSS ::after ───────────────────────── */
.sidebar-collapsed .nav-item::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-overlay);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 300;
  box-shadow: var(--shadow-md);
}

.sidebar-collapsed .nav-item:hover::after {
  opacity: 1;
}

/* ── Sidebar footer ──────────────────────────────────────────── */
.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-footer {
  padding: 14px 4px 16px;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-collapsed .user-info {
  justify-content: center;
}

.sidebar-collapsed .user-details {
  display: none;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-form { width: 100%; }

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  color: var(--accent-red);
  border-color: rgba(248, 81, 73, 0.3);
}

.sidebar-collapsed .logout-btn {
  width: auto;
  padding: 7px;
  gap: 0;
}

/* ── Role badges ─────────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-super-admin  { background: rgba(163,113,247,.18); color: #a371f7; border: 1px solid rgba(163,113,247,.35); }
.role-admin        { background: rgba(47,129,247,.18);  color: #58a6ff; border: 1px solid rgba(47,129,247,.35); }
.role-operator     { background: rgba(63,185,80,.18);   color: #3fb950; border: 1px solid rgba(63,185,80,.35); }
.role-viewer       { background: rgba(139,148,158,.15); color: #8b949e; border: 1px solid rgba(139,148,158,.3); }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px 0;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-body {
  padding: 24px 32px 40px;
}

/* ── Welcome strip ───────────────────────────────────────────── */
.welcome-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.welcome-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.welcome-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.welcome-last-login {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Dashboard card grid ─────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: rgba(240, 246, 252, 0.18);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg { width: 18px; height: 18px; }

.card-icon--green  { background: rgba(63,185,80,.15);   color: var(--accent-green); }
.card-icon--blue   { background: rgba(47,129,247,.15);  color: var(--accent-blue-h); }
.card-icon--purple { background: rgba(163,113,247,.15); color: var(--accent-purple); }
.card-icon--orange { background: rgba(210,153,34,.15);  color: var(--accent-orange); }

.card-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.placeholder-value {
  font-size: 1.2rem;
  color: var(--text-muted);
}

.card-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Status indicators ───────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--green  { background: var(--accent-green);  box-shadow: 0 0 6px rgba(63,185,80,.6); }
.status-dot--red    { background: var(--accent-red);    box-shadow: 0 0 6px rgba(248,81,73,.6); }
.status-dot--orange { background: var(--accent-orange); box-shadow: 0 0 6px rgba(210,153,34,.6); }
.status-dot--muted  { background: var(--text-muted); }

.status-dot-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Admin placeholder ───────────────────────────────────────── */
.admin-placeholder {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
}

.admin-placeholder-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  color: var(--accent-blue);
  opacity: 0.7;
}

.admin-placeholder-icon svg { width: 72px; height: 72px; }

.admin-placeholder-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.admin-placeholder-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
}

.admin-info-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.admin-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.admin-info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.admin-info-value {
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition),
              opacity var(--transition);
  text-decoration: none;
  border: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-blue-h);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.25);
  text-decoration: none;
}

.btn-block { width: 100%; }

/* ── Login page ──────────────────────────────────────────────── */
.login-body {
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.login-brand-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-blue);
}

.login-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.login-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 22px;
  text-align: center;
}

.login-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.2);
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 18px;
  line-height: 1.5;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #ff7b72;
}

/* ── Error / 403 page ────────────────────────────────────────── */
.error-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.error-container {
  text-align: center;
  max-width: 420px;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--border-default);
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -0.04em;
}

.error-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.error-message {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ── Confirmation modal ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.modal-backdrop.modal-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  max-width: 420px;
  width: calc(100% - 40px);
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(-10px);
  transition: transform 0.18s ease;
}

.modal-backdrop.modal-open .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent-red);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 24px;
}

.modal-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-node-name {
  display: inline-block;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  font-family: monospace;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin: 0 2px;
}

.modal-warning-note {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(248, 81, 73, 0.07);
  border-left: 3px solid var(--accent-red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Scrollbar styling (Webkit) ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(240, 246, 252, 0.2); }

/* ─────────────────────────────────────────────────────────────
   Milestone 2 — Admin styles
   ───────────────────────────────────────────────────────────── */

/* ── Admin nav section header ────────────────────────────────── */
.nav-section-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 4px;
  margin-top: 6px;
  overflow: hidden;
  transition: max-height 0.18s ease, opacity 0.15s ease,
              padding 0.18s ease, margin 0.18s ease;
  max-height: 60px;
}

/* Hide section header in rail mode */
.sidebar-collapsed .nav-section-header {
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
}

.nav-sub {
  padding-left: 28px;
  font-size: 0.86rem;
  transition: padding-left 0.18s ease;
}

/* Sub-items align with top-level icons in rail mode */
.sidebar-collapsed .nav-sub {
  padding-left: 19px;
}

.nav-sub svg {
  width: 16px;
  height: 16px;
}

/* ── Page header layout update ───────────────────────────────── */
.page-header {
  align-items: flex-start;
}

.page-header-left { flex: 1; }

.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 4px;
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ── Utility text classes ────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.82rem; }
.text-nowrap { white-space: nowrap; }

/* ── Status badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-success { background: rgba(63,185,80,.15);   color: #3fb950; border: 1px solid rgba(63,185,80,.3); }
.badge-danger  { background: rgba(248,81,73,.15);   color: #f85149; border: 1px solid rgba(248,81,73,.3); }
.badge-warning { background: rgba(210,153,34,.15);  color: #d29922; border: 1px solid rgba(210,153,34,.3); }
.badge-neutral { background: rgba(139,148,158,.12); color: #8b949e; border: 1px solid rgba(139,148,158,.25); }
.badge-info    { background: rgba(47,129,247,.15);  color: #58a6ff; border: 1px solid rgba(47,129,247,.3); }
.badge-teal    { background: rgba(45,212,191,.15);  color: #2dd4bf; border: 1px solid rgba(45,212,191,.3); }
.badge-purple  { background: rgba(163,113,247,.15); color: #a371f7; border: 1px solid rgba(163,113,247,.3); }
.badge-amber   { background: rgba(251,191,36,.15);  color: #fbbf24; border: 1px solid rgba(251,191,36,.3); }

/* ── Buttons — extended ──────────────────────────────────────── */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
  gap: 5px;
}

.btn-success { background: rgba(63,185,80,.15);  color: #3fb950; border: 1px solid rgba(63,185,80,.3); }
.btn-success:hover { background: rgba(63,185,80,.25); text-decoration: none; }

.btn-warning { background: rgba(210,153,34,.15); color: #d29922; border: 1px solid rgba(210,153,34,.3); }
.btn-warning:hover { background: rgba(210,153,34,.25); text-decoration: none; }

.btn-danger  { background: rgba(248,81,73,.12);  color: #f85149; border: 1px solid rgba(248,81,73,.25); }
.btn-danger:hover  { background: rgba(248,81,73,.22); text-decoration: none; }

/* ── Inline forms (for action buttons in tables) ─────────────── */
.inline-form { display: inline; }

.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ── Data tables ─────────────────────────────────────────────── */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.data-table thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
}

.data-table th {
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  font-size: 0.87rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.row-disabled td { opacity: 0.5; }

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 14px !important;
  font-size: 0.85rem;
}

/* ── User cell in table ──────────────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-initial {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Code-style inline text ──────────────────────────────────── */
.action-code, .ip-code {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: 0.78rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  color: var(--accent-teal);
}

/* ── Stat cards (admin dashboard) ────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: rgba(240,246,252,.18); }

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon--blue   { background: rgba(47,129,247,.15);  color: var(--accent-blue-h); }
.stat-icon--green  { background: rgba(63,185,80,.15);   color: var(--accent-green); }
.stat-icon--orange { background: rgba(210,153,34,.15);  color: var(--accent-orange); }
.stat-icon--red    { background: rgba(248,81,73,.15);   color: var(--accent-red); }
.stat-icon--teal   { background: rgba(45,212,191,.15);  color: var(--accent-teal); }
.stat-icon--purple { background: rgba(163,113,247,.15); color: var(--accent-purple); }

.stat-body {}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Section header inside page body ─────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Info banner ─────────────────────────────────────────────── */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(47,129,247,.08);
  border: 1px solid rgba(47,129,247,.2);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.info-banner--warning {
  background: rgba(210,153,34,.08);
  border-color: rgba(210,153,34,.25);
  color: var(--text-secondary);
}

/* ── Admin form container ────────────────────────────────────── */
.form-container {
  max-width: 560px;
}

.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.form-card--compact {
  padding: 18px 20px;
  margin-bottom: 20px;
}

.form-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

/* Inline form layout (access control add-rule bar) */
.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.form-group--grow { flex: 1; min-width: 160px; }
.form-group--action { flex-shrink: 0; }

/* ── Form inputs — extended ──────────────────────────────────── */
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
  cursor: pointer;
}

.form-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(47,129,247,.2); }
.form-select--sm { padding: 6px 10px; font-size: 0.85rem; }

.form-input--sm { padding: 6px 10px; font-size: 0.85rem; }

.form-input--error { border-color: var(--accent-red) !important; }

.form-input--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-elevated);
}

.form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition);
  outline: none;
}

.form-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(47,129,247,.2); }
.form-textarea--mono { font-family: "SF Mono", "Fira Code", Consolas, monospace; font-size: 0.82rem; }

.form-error {
  font-size: 0.78rem;
  color: var(--accent-red);
  margin-top: 5px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.5;
}

.form-hint-inline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.form-optional {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.form-info {
  padding: 10px 0;
  border-top: 1px solid var(--border-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border-muted);
  margin-top: 20px;
}

/* ── Checkbox ────────────────────────────────────────────────── */
.form-group--checkbox { padding: 4px 0; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.87rem;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Roles & Permissions page ────────────────────────────────── */
.role-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.role-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.role-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.role-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
}

.perm-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: background var(--transition);
  margin-top: 1px;
}

.perm-toggle--on  { background: rgba(63,185,80,.2); color: var(--accent-green); }
.perm-toggle--off { background: rgba(139,148,158,.12); color: var(--text-muted); }

.perm-toggle--on:hover:not(.perm-toggle--readonly)  { background: rgba(63,185,80,.35); }
.perm-toggle--off:hover:not(.perm-toggle--readonly) { background: rgba(139,148,158,.22); }

.perm-toggle--readonly { cursor: default; opacity: 0.7; }

.perm-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.perm-key {
  font-size: 0.82rem;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  color: var(--text-primary);
  font-weight: 500;
}

.perm-desc { font-size: 0.76rem; }

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-input { max-width: 320px; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 8px;
}

.pagination-info { min-width: 100px; text-align: center; }

/* ── Audit log details expand ────────────────────────────────── */
.details-summary {
  cursor: pointer;
  color: var(--text-link);
  font-size: 0.78rem;
  user-select: none;
}

.details-json {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 320px;
}

/* ── Alert — warning ─────────────────────────────────────────── */
.alert-warning {
  background: rgba(210,153,34,.1);
  border: 1px solid rgba(210,153,34,.3);
  color: #d29922;
}

/* ── Login page — additional ─────────────────────────────────── */
.login-page {
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.login-btn {
  width: 100%;
  padding: 10px 20px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}

.login-btn:hover { background: var(--accent-blue-h); }

/* ═══════════════════════════════════════════════════════════════
   MONITORING PAGE
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared button helpers ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn-sm  { padding: 5px 11px; font-size: 0.8rem; }
.btn-xs  { padding: 3px 7px;  font-size: 0.75rem; }
.btn-primary   { background: var(--accent-blue);  color: #fff; border-color: var(--accent-blue); }
.btn-primary:hover   { background: var(--accent-blue-h); text-decoration: none; }
.btn-secondary { background: var(--bg-overlay);   color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-elevated); text-decoration: none; }
.btn-danger    { background: rgba(248,81,73,.15);  color: var(--accent-red); border-color: rgba(248,81,73,.4); }
.btn-danger:hover    { background: rgba(248,81,73,.25); text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: var(--border-muted); }
.btn-ghost:hover     { background: var(--bg-elevated); color: var(--text-primary); text-decoration: none; }

/* ── Edit mode banner ───────────────────────────────────────────── */
/* ── Pending-changes save notice ────────────────────────────────── */
.monitoring-save-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(47, 129, 247, 0.08);
  border: 1px solid rgba(47, 129, 247, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.monitoring-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.4);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.edit-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-orange);
  font-weight: 600;
  font-size: 0.875rem;
}
.edit-banner-hint {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.edit-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Camera grid ────────────────────────────────────────────────── */
.monitoring-grid-wrapper { position: relative; }

.camera-grid {
  display: grid;
  gap: 12px;
  /* --grid-cols is set inline by the template and updated by JS on template switch */
  grid-template-columns: repeat(var(--grid-cols, 3), 1fr);
}
/* Fallback class-based overrides kept for compatibility */
.camera-grid--cols-1 { grid-template-columns: repeat(1, 1fr); }
.camera-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.camera-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.camera-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Camera tile ────────────────────────────────────────────────── */
.camera-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.camera-tile:hover { border-color: var(--accent-blue); }

/* Feed area: 16:9 aspect ratio, contains the video/placeholder and edit overlay */
.camera-tile-feed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  overflow: hidden;
}

/* Footer: always-visible bar with the camera select dropdown */
.camera-tile-footer {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-elevated);
}

/* Camera select dropdown inside the tile footer */
.slot-camera-select {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 3px 6px;
  height: 26px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.slot-camera-select:hover,
.slot-camera-select:focus { border-color: var(--accent-blue); color: var(--text-primary); }

/* Featured slot badge in footer */
.slot-featured-badge {
  font-size: 0.7rem;
  color: var(--accent-orange);
  flex-shrink: 0;
  font-weight: 700;
  line-height: 1;
}

/* Featured tile: spans 2 columns and 2 rows */
.camera-tile--featured {
  grid-column: span 2;
  grid-row: span 2;
}

/* Edit mode tile outline */
.camera-tile--editable {
  border-color: rgba(210, 153, 34, 0.5);
  cursor: grab;
}
.camera-tile--editable:active { cursor: grabbing; }
.camera-tile--dragging { opacity: 0.4; }

/* Add slot tile */
.add-slot-tile {
  background: transparent;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  aspect-ratio: 16 / 9;
  min-height: 60px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.add-slot-tile:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(47, 129, 247, 0.05);
}

/* ── Camera feed placeholder ────────────────────────────────────── */
.camera-tile-link {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  text-decoration: none;
}
.camera-tile-link:hover { text-decoration: none; }

.camera-feed-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--transition);
}
.camera-tile-link:hover .camera-feed-placeholder {
  background: var(--bg-overlay);
}
.camera-feed-placeholder--empty {
  background: var(--bg-elevated);
  cursor: default;
}
.camera-feed-placeholder--empty .camera-feed-label {
  opacity: 0.35;
}

.feed-icon {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.feed-placeholder-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.feed-camera-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-camera-node {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Status dot ─────────────────────────────────────────────────── */
.camera-status-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.5);
  z-index: 2;
}
.camera-status--active   { background: var(--accent-green); }
.camera-status--inactive { background: var(--text-muted); }

/* ── Featured badge ─────────────────────────────────────────────── */
.camera-featured-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(210,153,34,0.9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  z-index: 2;
  line-height: 1.4;
  pointer-events: none;
}

/* ── Edit mode tile overlay ─────────────────────────────────────── */
.tile-edit-controls {
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.88);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  z-index: 3;
}
.tile-edit-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  display: flex;
  align-items: center;
}
.tile-edit-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tile-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-overlay);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  font-family: inherit;
}
.tile-action-btn:hover { background: var(--bg-elevated); color: var(--text-primary); text-decoration: none; }
.tile-btn-star:hover  { background: rgba(210,153,34,0.2); color: var(--accent-orange); border-color: var(--accent-orange); }
.tile-btn-star--active { background: rgba(210,153,34,0.25); color: var(--accent-orange); border-color: var(--accent-orange); }
.tile-btn-remove:hover { background: rgba(248,81,73,0.15); color: var(--accent-red); border-color: var(--accent-red); }
.tile-edit-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Empty state ────────────────────────────────────────────────── */
.monitoring-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}
.monitoring-empty p { color: var(--text-secondary); font-size: 0.9rem; }

/* ═══════════════════════════════════════════════════════════════
   FOCUSED CAMERA VIEW
   ═══════════════════════════════════════════════════════════════ */

.camera-focused-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100vh - 120px);
}

/* ── Identity strip ─────────────────────────────────────────────── */
.camera-focused-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.camera-meta-left { display: flex; flex-direction: column; gap: 2px; }
.camera-meta-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.camera-meta-detail { font-size: 0.82rem; color: var(--text-secondary); }
.camera-meta-right { display: flex; align-items: center; gap: 8px; }

/* ── Status badge ───────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.status-badge--active   { background: rgba(63,185,80,.15); color: var(--accent-green); }
.status-badge--inactive { background: rgba(72,79,88,.2); color: var(--text-secondary); }

/* ── Content split ──────────────────────────────────────────────── */
.camera-focused-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* ── Large feed ─────────────────────────────────────────────────── */
.camera-focused-feed {
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 100%;
}
.camera-feed-placeholder--large {
  width: 100%;
  height: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.feed-icon--large { width: 80px; height: 80px; color: var(--text-muted); }
.feed-placeholder-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.feed-placeholder-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); }
.feed-placeholder-sub   { font-size: 0.82rem; }

/* ── Controls sidebar ───────────────────────────────────────────── */
.camera-focused-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

/* ── Controls card ──────────────────────────────────────────────── */
.controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px;
}
.controls-card-header { margin-bottom: 10px; }
.controls-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── PTZ placeholder notice ─────────────────────────────────────── */
.ptz-placeholder-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ── PTZ panel ──────────────────────────────────────────────────── */
.ptz-panel { display: flex; flex-direction: column; gap: 10px; }

.ptz-grid {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 4px;
  justify-content: center;
}
.ptz-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ptz-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.ptz-btn:not(:disabled) {
  cursor: pointer;
  color: var(--text-primary);
}
.ptz-btn:not(:disabled):hover {
  background: var(--bg-overlay);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.ptz-btn--home { background: var(--bg-overlay); }
.ptz-zoom-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.ptz-btn--zoom {
  width: auto;
  padding: 8px 14px;
  gap: 6px;
  font-size: 0.78rem;
  height: auto;
}

/* ── Node info rows ─────────────────────────────────────────────── */
.node-controls-section { display: flex; flex-direction: column; gap: 8px; }
.node-info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-muted);
}
.node-info-row:last-child { border-bottom: none; }
.node-info-label { color: var(--text-muted); flex-shrink: 0; }
.node-info-value { color: var(--text-primary); text-align: right; }

/* ── Utility ────────────────────────────────────────────────────── */
.text-sm   { font-size: 0.82rem; }
.text-xs   { font-size: 0.74rem; }
.text-muted { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════════
   MONITORING — Template picker
═══════════════════════════════════════════════════════════════════ */
.template-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.template-picker-label {
  font-size: 0.80rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.template-picker-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.template-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.2;
}
.template-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}
.template-tab--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Edit-mode toggle active state ──────────────────────────────── */
.btn--active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD — Quick links + card link
═══════════════════════════════════════════════════════════════════ */
.card--link {
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card--link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.card-link {
  color: var(--accent);
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.dashboard-quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.quick-link-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.15s, border-color 0.15s;
}
.quick-link-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════
   NODE DETAIL — Layout, cards, rows
═══════════════════════════════════════════════════════════════════ */
.node-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .node-detail-layout { grid-template-columns: 1fr; }
}
.node-detail-left,
.node-detail-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.detail-card--warning {
  border-color: var(--color-warning, #f59e0b);
}
.detail-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}
.detail-card-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}
.detail-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 8px;
}
.detail-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.detail-label {
  color: var(--text-muted);
  min-width: 160px;
  flex-shrink: 0;
  font-size: 0.82rem;
}
.detail-value {
  color: var(--text-primary);
  word-break: break-word;
}
.detail-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  flex-wrap: wrap;
}
.node-detail-placeholder-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-style: italic;
}
.detail-back-row {
  margin-top: 20px;
}

/* Config display pre block */
.config-display {
  background: var(--bg-input, #1a1d23);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
}

/* ── Form sections ───────────────────────────────────────────────── */
.form-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.form-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Table link style ────────────────────────────────────────────── */
.table-link {
  color: var(--text-primary);
  text-decoration: none;
}
.table-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Badge extras ────────────────────────────────────────────────── */
.badge-warning { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-danger  { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge-info    { background: rgba(47,129,247,.15);  color: #58a6ff; }

/* ── Notice / alert banners ──────────────────────────────────────── */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.notice code { font-size: 0.85em; background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 3px; }
.notice pre  { margin: 6px 0 0; background: rgba(0,0,0,0.3); padding: 8px 12px; border-radius: 4px; font-size: 0.8em; overflow-x: auto; }
.notice-info    { background: rgba(47,129,247,.10); border-color: rgba(47,129,247,.25); color: #b0c4de; }
.notice-success { background: rgba(63,185,80,.10);  border-color: rgba(63,185,80,.25);  color: #8fcf97; }
.notice-warning { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.25); color: #d4aa5a; }
.notice-danger  { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.25);  color: #f08080; }

/* ── Enrollment progress steps ───────────────────────────────────── */
.enrollment-progress { padding: 0 4px; overflow-x: auto; }
.progress-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: max-content;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.step-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.step-done .step-dot   { background: var(--accent-green); border-color: var(--accent-green); }
.step-current .step-dot { background: var(--accent-blue); border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(47,129,247,.3); }
.step-pending .step-dot { background: var(--bg-overlay); border-color: var(--border-muted); }
.step-label { font-size: 0.68rem; color: var(--text-muted); text-align: center; line-height: 1.3; }
.step-done .step-label    { color: var(--accent-green); }
.step-current .step-label { color: var(--accent-blue); font-weight: 600; }
.step-connector {
  height: 2px; width: 24px; min-width: 24px;
  background: var(--border-muted);
  margin-top: 6px;
  flex-shrink: 0;
}

/* ── Enrollment action steps ─────────────────────────────────────── */
.enrollment-action-step { padding-bottom: 1rem; border-bottom: 1px solid var(--border-muted); margin-bottom: 1rem; }
.enrollment-action-step:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.btn-block { width: 100%; justify-content: center; }

/* ── Form radio/checkbox groups ──────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option, .checkbox-option {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 0.875rem; color: var(--text-primary);
  padding: 8px 12px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.radio-option:hover, .checkbox-option:hover { border-color: var(--border-default); }
.radio-option input, .checkbox-option input { accent-color: var(--accent-blue); }

/* ── Mono textarea for keys ──────────────────────────────────────── */
.form-textarea--mono {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ── Bootstrap log ───────────────────────────────────────────────── */
.bootstrap-log {
  background: #0d1117;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #7ee787;
  max-height: 520px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Fingerprint display ─────────────────────────────────────────── */
.fingerprint-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.04);
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  word-break: break-all;
}

/* ── Step list (numbered instructions) ───────────────────────────── */
.step-list { padding-left: 1.25rem; }
.step-list li { margin-bottom: 0.75rem; font-size: 0.875rem; color: var(--text-primary); }
.step-list li strong { color: var(--text-primary); }

/* ── detail-card variants ────────────────────────────────────────── */
.detail-card--success { border-color: rgba(63,185,80,.3); }
.detail-card--success .detail-card-header { color: #7ee787; }

/* ── form-control short ──────────────────────────────────────────── */
.form-control--short { max-width: 120px; }

/* ── form-field inline (label + short input) ─────────────────────── */
.form-field--inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-field--inline .form-label { white-space: nowrap; margin-bottom: 0; }
