/* =============================================================================
   HutEleven Customer Portal — Brand Stylesheet
   Design tokens match the NOC platform for brand consistency.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   --------------------------------------------------------------------------- */
:root {
  /* Brand colours */
  --cipher:     #5C0938;
  --echo:       #F3765A;
  --signal:     #EA5125;
  --midnight:   #2A1E2A;
  --intercept:  #7C1230;

  /* UI background & surface */
  --bg-page:    #F4F4F6;
  --bg-card:    #FFFFFF;
  --bg-sidebar: #2A1E2A;

  /* Borders */
  --border:     #E2DDE8;
  --border-mid: #D0C9D8;

  /* Text */
  --text-primary:   #1A1020;
  --text-secondary: #6B5F72;
  --text-dim:       #A899B0;
  --text-inverse:   #FFFFFF;

  /* Status */
  --status-online-text:    #1A8F5A;
  --status-online-bg:      #EBF8F2;
  --status-online-border:  #B8EACF;
  --status-degraded-text:  #D4620A;
  --status-degraded-bg:    #FEF3EC;
  --status-degraded-border:#F9D5B3;
  --status-offline-text:   #C93A0F;
  --status-offline-bg:     #FEECE8;
  --status-offline-border: #F7C4B8;

  /* Typography */
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'Fira Mono', monospace;

  /* Sizing */
  --radius:        8px;
  --radius-sm:     5px;
  --shadow:        0 1px 3px rgba(42,30,42,0.08), 0 1px 2px rgba(42,30,42,0.06);
  --shadow-md:     0 4px 12px rgba(42,30,42,0.10), 0 2px 4px rgba(42,30,42,0.08);
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

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

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

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

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

img, svg { display: block; }

button { font-family: inherit; cursor: pointer; }

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

/* ---------------------------------------------------------------------------
   Sidebar
   --------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--cipher);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.logo-tagline {
  font-size: 10.5px;
  color: rgba(255,255,255,0.45);
  line-height: 1.2;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  padding: 4px;
  border-radius: 4px;
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,0.08); }

.sidebar-nav {
  flex: 1;
  padding: 12px 12px 0;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
}

.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--cipher); color: #fff; }

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-link.active .nav-icon { opacity: 1; }

.nav-section { margin-top: 20px; }
.nav-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.nav-tag {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(243,118,90,0.18);
  color: var(--echo);
}

.nav-link--sub {
  padding-left: 14px;
  font-size: 13px;
  font-weight: 400;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--cipher);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-email {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link {
  color: rgba(255,255,255,0.4);
  padding: 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.logout-link:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); text-decoration: none; }

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

/* ---------------------------------------------------------------------------
   Topbar
   --------------------------------------------------------------------------- */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--bg-page); color: var(--text-primary); }

.topbar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-logout {
  font-size: 13px;
  color: var(--text-dim);
  display: none; /* Hidden on desktop — logout is in sidebar footer */
}
.topbar-logout:hover { color: var(--text-secondary); }

/* ---------------------------------------------------------------------------
   Content wrapper
   --------------------------------------------------------------------------- */
.content {
  padding: 28px 32px;
  flex: 1;
  max-width: 1100px;
  width: 100%;
}

/* ---------------------------------------------------------------------------
   Page header
   --------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 3px;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
}

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

.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--cipher); }
.breadcrumb-sep { opacity: 0.5; }

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ---------------------------------------------------------------------------
   Company dashboard cards
   --------------------------------------------------------------------------- */
.company-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.company-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 3px;
  margin-top: 4px;
}
.tag--school { background: #EEF4FF; color: #3553C1; }
.tag--business { background: #F5F0FF; color: #6B35C1; }

.company-stats {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value--good { color: var(--status-online-text); }
.stat-value--warn { color: var(--status-degraded-text); }
.stat-value--bad  { color: var(--status-offline-text); }

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.company-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.noc-unavailable {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 10px 0;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn--primary {
  background: var(--cipher);
  color: #fff;
}
.btn--primary:hover { background: var(--intercept); color: #fff; }

.btn--secondary {
  background: var(--bg-page);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn--secondary:hover { background: var(--border); }

.btn--full { width: 100%; justify-content: center; }

.btn--small {
  padding: 5px 12px;
  font-size: 12.5px;
}

/* ---------------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus {
  border-color: var(--cipher);
  box-shadow: 0 0 0 3px rgba(92,9,56,0.12);
}

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

.alert--error {
  background: var(--status-offline-bg);
  border: 1px solid var(--status-offline-border);
  color: var(--status-offline-text);
}

.alert--warning {
  background: var(--status-degraded-bg);
  border: 1px solid var(--status-degraded-border);
  color: var(--status-degraded-text);
}

.alert--success {
  background: var(--status-online-bg);
  border: 1px solid var(--status-online-border);
  color: var(--status-online-text);
}

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

/* ---------------------------------------------------------------------------
   Status badges
   --------------------------------------------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge--online {
  background: var(--status-online-bg);
  color: var(--status-online-text);
  border: 1px solid var(--status-online-border);
}
.status-badge--degraded {
  background: var(--status-degraded-bg);
  color: var(--status-degraded-text);
  border: 1px solid var(--status-degraded-border);
}
.status-badge--offline {
  background: var(--status-offline-bg);
  color: var(--status-offline-text);
  border: 1px solid var(--status-offline-border);
}
.status-badge--unknown {
  background: var(--bg-page);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ---------------------------------------------------------------------------
   Type badges
   --------------------------------------------------------------------------- */
.type-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}
.type-badge--broadband { background: #EEF4FF; color: #3553C1; }
.type-badge--voip      { background: #F5F0FF; color: #6B35C1; }
.type-badge--router    { background: #F0FFF8; color: #1A8F5A; }

/* ---------------------------------------------------------------------------
   Status summary row
   --------------------------------------------------------------------------- */
.status-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.status-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid;
}
.status-count--online   { background: var(--status-online-bg); color: var(--status-online-text); border-color: var(--status-online-border); }
.status-count--degraded { background: var(--status-degraded-bg); color: var(--status-degraded-text); border-color: var(--status-degraded-border); }
.status-count--offline  { background: var(--status-offline-bg); color: var(--status-offline-text); border-color: var(--status-offline-border); }

/* ---------------------------------------------------------------------------
   Data tables
   --------------------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th:first-child { padding-left: 0; }

.data-table td {
  padding: 12px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table td:first-child { padding-left: 0; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-page); }

.service-name { font-weight: 500; }
.report-month { font-weight: 500; }
.text-dim { color: var(--text-dim); }
.text-mono { font-family: var(--font-mono); font-size: 12.5px; }
.text-good { color: var(--status-online-text); font-weight: 500; }
.text-warn { color: var(--status-degraded-text); font-weight: 500; }
.text-bad  { color: var(--status-offline-text); font-weight: 500; }
.table-action { text-align: right; width: 1%; white-space: nowrap; }

/* ---------------------------------------------------------------------------
   Uptime statistics
   --------------------------------------------------------------------------- */
.uptime-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.uptime-stat-card {
  text-align: center;
  padding: 20px 16px 18px;
}

.uptime-stat-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.uptime-stat-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.uptime-stat--good { color: var(--status-online-text); }
.uptime-stat--warn { color: var(--status-degraded-text); }
.uptime-stat--bad  { color: var(--status-offline-text); }

.uptime-stat-unit { font-size: 18px; font-weight: 500; }

.uptime-stat-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------------
   Uptime chart
   --------------------------------------------------------------------------- */
.uptime-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  margin: 12px 0 10px;
  padding: 4px 0;
}

.uptime-bar {
  flex: 1;
  min-width: 4px;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  height: var(--bar-height, 100%);
  max-height: 100%;
  cursor: pointer;
  transition: opacity 0.1s;
  position: relative;
}
.uptime-bar:hover { opacity: 0.75; }

.uptime-bar--online   { background: var(--status-online-text); }
.uptime-bar--degraded { background: var(--status-degraded-text); }
.uptime-bar--offline  { background: var(--status-offline-text); }

.uptime-chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-item--online::before   { background: var(--status-online-text); }
.legend-item--degraded::before { background: var(--status-degraded-text); }
.legend-item--offline::before  { background: var(--status-offline-text); }

.uptime-tooltip {
  position: fixed;
  background: var(--midnight);
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Empty states
   --------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--text-secondary);
}

.empty-state svg {
  margin: 0 auto 16px;
  color: var(--border-mid);
}

.empty-state h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 380px;
  margin: 0 auto;
}

.empty-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 4px;
  font-size: 13.5px;
  color: var(--status-online-text);
}

/* ---------------------------------------------------------------------------
   Error page
   --------------------------------------------------------------------------- */
.error-page {
  text-align: center;
  padding: 80px 32px;
}

.error-icon {
  margin: 0 auto 24px;
  width: 80px;
  height: 80px;
  background: var(--status-offline-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--status-offline-text);
}

.error-page h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ---------------------------------------------------------------------------
   Help text
   --------------------------------------------------------------------------- */
.help-text {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ---------------------------------------------------------------------------
   Logo (sidebar image vs text fallback)
   --------------------------------------------------------------------------- */
.sidebar-logo-img {
  max-height: 36px;
  max-width: 160px;
  width: auto;
  object-fit: contain;
}

.sidebar-logo-fallback {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------------------------------------------------------------------------
   Admin section
   --------------------------------------------------------------------------- */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text-primary);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.admin-stat-card:hover:not(.admin-stat-card--plain) {
  border-color: var(--cipher);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.admin-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-stat-icon--users     { background: #EEF4FF; color: #3553C1; }
.admin-stat-icon--companies { background: var(--status-online-bg); color: var(--status-online-text); }
.admin-stat-icon--settings  { background: var(--status-degraded-bg); color: var(--status-degraded-text); }
.admin-stat-icon--audit     { background: #F5F0FF; color: #6B35C1; }

.admin-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.admin-stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.text-link {
  font-size: 13px;
  color: var(--cipher);
}

.audit-action {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Role badge */
.role-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: capitalize;
}
.role-badge--admin { background: #FEF3EC; color: var(--status-degraded-text); border: 1px solid var(--status-degraded-border); }
.role-badge--user  { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }

/* Form card layout */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 760px;
}

.form-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

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

.form-label-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 1px;
}

.form-select { appearance: auto; cursor: pointer; }

.form-mono { font-family: var(--font-mono); }

.form-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-mid);
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--cipher); }
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

.toggle-label { font-size: 13.5px; color: var(--text-primary); }

/* Company checkboxes */
.company-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.checkbox-card:hover { border-color: var(--cipher); background: #fdf8fc; }
.checkbox-card input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--cipher); cursor: pointer; }
.checkbox-card--checked { border-color: var(--cipher); background: #fdf8fc; }

.checkbox-card-content { display: flex; flex-direction: column; }
.checkbox-card-name { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
.checkbox-card-meta { font-size: 12px; color: var(--text-dim); }

/* Form actions */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
}

.btn--danger {
  background: var(--status-offline-bg);
  color: var(--status-offline-text);
  border: 1px solid var(--status-offline-border);
}
.btn--danger:hover { background: var(--status-offline-text); color: #fff; }

/* Settings table */
.settings-table td:first-child { width: 240px; }

/* Test actions */
.test-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.font-medium { font-weight: 500; }
.text-sm { font-size: 12.5px; }

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

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.24), 0 2px 8px rgba(0,0,0,0.16);
  overflow: hidden;
}

.login-brand {
  background: var(--midnight);
  padding: 28px 36px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-logo-mark {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--echo);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.login-tagline {
  font-size: 13px;
  color: rgba(255,255,255,0.45);
}

.login-form-area {
  padding: 28px 36px 32px;
}

.sent-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-page);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 16px;
  color: var(--cipher);
}

.login-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtext {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.55;
}

.login-form { display: flex; flex-direction: column; }

.login-logo-img {
  max-height: 72px;
  max-width: 260px;
  width: auto;
  object-fit: contain;
  margin-bottom: 4px;
}

.login-help {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 20px;
  text-align: center;
}

.sent-tips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.sent-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.sent-tip svg { flex-shrink: 0; margin-top: 2px; }

/* ---------------------------------------------------------------------------
   Sidebar overlay (mobile)
   --------------------------------------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
  backdrop-filter: blur(2px);
}

/* ---------------------------------------------------------------------------
   Responsive — mobile
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-close {
    display: flex;
  }
  .sidebar-overlay.is-visible {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .topbar-logout {
    display: block;
  }

  .content {
    padding: 20px 16px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .uptime-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .data-table { font-size: 12.5px; }

  .page-title { font-size: 18px; }

  .uptime-bar { min-width: 2px; gap: 2px; }
}

@media (max-width: 480px) {
  .uptime-stats { grid-template-columns: 1fr; }
  .company-stats { flex-wrap: wrap; }
  .stat { min-width: 33%; }
}
