/* ==========================================================================
   PRODWEB SUITE — UNIFIED OBSIDIAN DESIGN SYSTEM (DASHBOARD-PRO)
   Version: 1.10 Pro Impeccable (Craft Floor: 0 Anti-patterns, Apple Native Stack)
   Author: Dante Testa / ProdWeb Core Architecture
   ========================================================================== */

:root {
  /* Surfaces & Canvas */
  --bg-canvas: #090d13;
  --bg-sidebar: #0e141d;
  --bg-surface: #121924;
  --bg-surface-elevated: #16202e;
  --bg-surface-hover: #1c2738;
  --bg-input: #0b1118;

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(255, 122, 0, 0.50);

  /* ProdWeb Brand Accent */
  --accent-primary: #ff7a00;
  --accent-primary-hover: #ff8c1a;
  --accent-primary-active: #e66e00;
  --accent-surface: rgba(255, 122, 0, 0.10);
  --accent-border: rgba(255, 122, 0, 0.28);
  --accent-glow: rgba(255, 122, 0, 0.20);

  /* Semantic Status Colors */
  --status-active: #10b981;
  --status-active-surface: rgba(16, 185, 129, 0.10);
  --status-active-border: rgba(16, 185, 129, 0.28);
  --status-active-text: #6ee7b7;

  --status-warn: #f59e0b;
  --status-warn-surface: rgba(245, 158, 11, 0.10);
  --status-warn-border: rgba(245, 158, 11, 0.28);
  --status-warn-text: #fcd34d;

  --status-danger: #ef4444;
  --status-danger-surface: rgba(239, 68, 68, 0.10);
  --status-danger-border: rgba(239, 68, 68, 0.28);
  --status-danger-text: #fca5a5;

  --status-info: #38bdf8;
  --status-info-surface: rgba(56, 189, 248, 0.10);
  --status-info-border: rgba(56, 189, 248, 0.28);
  --status-info-text: #7dd3fc;

  /* Typography: Apple Pro Native Stack */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;

  /* Shadows & Depth */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.45), 0 4px 8px -2px rgba(0, 0, 0, 0.3);
  --shadow-accent: 0 0 24px -4px var(--accent-glow);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

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

html, body {
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   Shell Layout (Desktop Sidebar + Main Content)
   ========================================================================== */
.admin-layout,
.license-admin-layout,
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background-color: var(--bg-canvas);
}

/* Sidebar */
.license-sidebar,
.sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand-block,
.brand-lockup,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-box,
.logo-mark,
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary) 0%, #e65c00 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px var(--accent-glow);
  flex-shrink: 0;
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
}

.brand-icon-box svg {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title,
.brand strong,
.brand-lockup strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: block;
}

.brand-subtitle,
.brand span,
.brand-lockup span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
}

.sidebar-nav,
.side-nav,
nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
}

.sidebar-link,
.side-nav a,
nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.sidebar-link svg,
.side-nav a svg,
nav a svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.sidebar-link:hover,
.side-nav a:hover,
nav a:hover {
  color: var(--text-main);
  background-color: var(--bg-surface);
  border-color: var(--border-subtle);
}

.sidebar-link:hover svg,
.side-nav a:hover svg,
nav a:hover svg {
  color: var(--accent-primary);
}

.sidebar-link.active,
.side-nav a.active,
nav a.active {
  color: #ffffff;
  background-color: var(--accent-surface);
  border-color: var(--accent-border);
  font-weight: 600;
}

.sidebar-link.active svg,
.side-nav a.active svg,
nav a.active svg {
  color: var(--accent-primary);
}

.sidebar-footer-box,
.privacy-mini {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot-pulse,
.security-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-active);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sidebar-logout-link,
.ghost-logout {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.sidebar-logout-link:hover,
.ghost-logout:hover {
  color: var(--status-danger);
}

/* Main Area */
.admin-main,
.license-main,
.main-content {
  padding: 36px 44px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.admin-header,
.license-header,
.page-head,
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.admin-header-titles,
.license-header-titles,
.page-head > div,
.topbar > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-header-titles h1,
.license-header-titles h1,
.page-head h1,
.topbar h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-greeting,
.hello {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-primary);
  background: var(--accent-surface);
  border: 1px solid var(--accent-border);
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
}

.admin-header-titles p,
.license-header-titles p,
.page-subtitle,
.topbar p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.55;
}

.header-actions,
.header-actions-group,
.history-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.connection-chip,
.vault-security-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background-color: var(--status-active-surface);
  border: 1px solid var(--status-active-border);
  color: var(--status-active-text);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.connection-chip svg,
.vault-security-pill svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Notice / Alerts
   ========================================================================== */
.notice-box,
.update-alert,
.backup-alert,
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.notice-box.success,
.update-alert.success,
.backup-alert.success,
.alert.success {
  background-color: var(--status-active-surface);
  border: 1px solid var(--status-active-border);
  color: var(--status-active-text);
}

.notice-box.error,
.update-alert.error,
.backup-alert.error,
.alert.error {
  background-color: var(--status-danger-surface);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger-text);
}

.notice-box.warning,
.alert.warning {
  background-color: var(--status-warn-surface);
  border: 1px solid var(--status-warn-border);
  color: var(--status-warn-text);
}

.notice-box svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */
.btn-primary,
button.primary,
.button-link.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, var(--accent-primary) 0%, #e66e00 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary:hover,
button.primary:hover,
.button-link.primary:hover {
  background: linear-gradient(180deg, var(--accent-primary-hover) 0%, var(--accent-primary) 100%);
  box-shadow: 0 4px 14px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active,
button.primary:active {
  transform: translateY(0);
}

.btn-secondary,
.btn-ghost,
button.ghost,
a.button-link.ghost,
a.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-secondary:hover,
.btn-ghost:hover,
button.ghost:hover,
a.button-link.ghost:hover,
a.ghost:hover {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  color: #ffffff;
}

.btn-danger,
button.danger,
.btn-mini.danger,
button.mini.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background-color: var(--status-danger-surface);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover,
button.danger:hover,
button.mini.danger:hover {
  background-color: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.50);
}

button.mini,
.btn-mini {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all 0.15s ease;
}

button.mini:hover {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

/* Form Controls */
.text-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 9px 14px;
  font-size: 13.5px;
  transition: all 0.15s ease;
  width: 100%;
}

.text-input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-surface);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

label span {
  color: var(--text-muted);
}

/* ==========================================================================
   Executive Metrics Grid (Overview)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.15s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-default);
}

.metric-card.orange::before { background: var(--accent-primary); }
.metric-card.neutral::before { background: var(--text-dim); }
.metric-card.blue::before { background: var(--status-info); }
.metric-card.green::before { background: var(--status-active); }
.metric-card.red::before { background: var(--status-danger); }

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.metric-card.orange .metric-icon-wrap { color: var(--accent-primary); background: var(--accent-surface); border-color: var(--accent-border); }
.metric-card.blue .metric-icon-wrap { color: var(--status-info); background: var(--status-info-surface); border-color: var(--status-info-border); }
.metric-card.green .metric-icon-wrap { color: var(--status-active); background: var(--status-active-surface); border-color: var(--status-active-border); }
.metric-card.red .metric-icon-wrap { color: var(--status-danger); background: var(--status-danger-surface); border-color: var(--status-danger-border); }

.metric-icon-wrap svg {
  width: 16px;
  height: 16px;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.metric-card strong {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.metric-card small {
  font-size: 12px;
  color: var(--text-dim);
}

/* ==========================================================================
   Control Strip & Period Selector
   ========================================================================== */
.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 12px 18px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  gap: 16px;
  flex-wrap: wrap;
}

.control-strip > div:first-child {
  display: flex;
  align-items: center;
  gap: 14px;
}

.control-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.period-tabs {
  display: inline-flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.period-tabs a {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.period-tabs a:hover {
  color: var(--text-main);
}

.period-tabs a.active {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.context-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.context-note .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--status-active);
}

/* ==========================================================================
   Panels & Dashboard Grid
   ========================================================================== */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
}

.panel-head h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.panel-head p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.panel-head .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  margin-bottom: 28px;
}

/* ==========================================================================
   Activity Trend Chart
   ========================================================================== */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding-top: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.trend-col {
  flex: 1;
  min-width: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  position: relative;
  cursor: pointer;
}

.trend-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-primary);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.15s ease;
  position: absolute;
  top: -18px;
}

.trend-col:hover .trend-value {
  opacity: 1;
}

.trend-bar {
  width: 100%;
  max-width: 22px;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.trend-bar i {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, var(--accent-primary-hover) 0%, var(--accent-primary) 100%);
  border-radius: 4px;
}

.trend-col small {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Height utility classes for CSS bars */
.p1 { height: 1%; } .p2 { height: 2%; } .p3 { height: 3%; } .p4 { height: 4%; } .p5 { height: 5%; }
.p6 { height: 6%; } .p7 { height: 7%; } .p8 { height: 8%; } .p9 { height: 9%; } .p10 { height: 10%; }
.p15 { height: 15%; } .p20 { height: 20%; } .p25 { height: 25%; } .p30 { height: 30%; } .p35 { height: 35%; }
.p40 { height: 40%; } .p45 { height: 45%; } .p50 { height: 50%; } .p55 { height: 55%; } .p60 { height: 60%; }
.p65 { height: 65%; } .p70 { height: 70%; } .p75 { height: 75%; } .p80 { height: 80%; } .p85 { height: 85%; }
.p90 { height: 90%; } .p95 { height: 95%; } .p100 { height: 100%; }

/* ==========================================================================
   Devices List & Authorized Hardware
   ========================================================================== */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
  max-height: 380px;
  overflow-y: auto;
}

.device-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.15s ease;
}

.device-card:hover {
  border-color: var(--border-default);
}

.device-card.revoked {
  opacity: 0.55;
  background-color: rgba(255, 255, 255, 0.02);
}

.device-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  display: grid;
  place-items: center;
  color: var(--accent-primary);
  font-size: 16px;
}

.device-info strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

.device-info span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.device-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.device-status.online {
  background-color: var(--status-active-surface);
  border: 1px solid var(--status-active-border);
  color: var(--status-active-text);
}

.device-status.offline {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

.device-status.revoked {
  background-color: var(--status-danger-surface);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger-text);
}

.device-metrics {
  display: flex;
  gap: 16px;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 8px 12px;
  background-color: var(--bg-canvas);
  border-radius: var(--radius-md);
}

.device-metrics b {
  color: var(--text-main);
  font-weight: 600;
}

.device-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rename-device {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rename-device input {
  padding: 4px 8px;
  font-size: 11.5px;
  max-width: 140px;
}

.device-create {
  display: flex;
  gap: 8px;
}

.device-create input {
  flex: 1;
}

/* ==========================================================================
   Token Creation Banner
   ========================================================================== */
.token-banner {
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.12) 0%, rgba(255, 122, 0, 0.04) 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 4px 18px var(--accent-glow);
}

.token-banner strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.token-banner span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.token-banner code {
  font-family: var(--font-mono);
  font-size: 13px;
  background-color: var(--bg-input);
  border: 1px solid var(--accent-border);
  color: var(--accent-primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  user-select: all;
}

/* ==========================================================================
   Insights (Destinations & File Types)
   ========================================================================== */
.insights-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.insight-block {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.insight-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.insight-title strong {
  font-size: 14px;
  color: var(--text-main);
}

.insight-title span {
  font-size: 11px;
  color: var(--text-dim);
}

.bar-list,
.type-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row,
.type-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-meta,
.type-row > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.bar-meta strong,
.type-row strong {
  color: var(--text-main);
  font-weight: 600;
}

.bar-meta span,
.type-row span {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.bar-track,
.type-track {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  border-radius: 999px;
}

.type-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--status-info) 0%, #60a5fa 100%);
  border-radius: 999px;
}

/* ==========================================================================
   Activity History & Filter Drawer
   ========================================================================== */
.activity-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.activity-tabs a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

.activity-tabs a:hover {
  color: var(--text-main);
  border-color: var(--border-default);
}

.activity-tabs a.active {
  background-color: var(--accent-surface);
  border-color: var(--accent-border);
  color: var(--accent-primary);
  font-weight: 600;
}

.filter-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.filter-box summary {
  padding: 12px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.filter-box summary:hover {
  color: var(--text-main);
}

.filter-box[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}

.filters {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: flex-end;
}

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

/* Table */
.table-wrap,
.backup-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface-elevated);
  margin-bottom: 18px;
}

table,
.backup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

thead th {
  background-color: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

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

tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.file-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.pill.success {
  background-color: var(--status-active-surface);
  color: var(--status-active-text);
  border: 1px solid var(--status-active-border);
}

.pill.failed {
  background-color: var(--status-danger-surface);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
}

.pill.cancelled {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 8px;
}

/* ==========================================================================
   Updates Page
   ========================================================================== */
.update-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.update-status h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.update-status h2 small {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-primary);
}

.update-status p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.ok {
  background-color: var(--status-active);
}

.status-dot.bad {
  background-color: var(--status-danger);
}

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

.publish-form label.full {
  grid-column: span 2;
}

.publish-form label.check {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.publish-form label.check input {
  width: auto;
}

.publish-actions {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.publish-actions span {
  font-size: 12px;
  color: var(--text-dim);
}

.release-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.release-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  gap: 16px;
}

.release-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.release-row strong {
  font-size: 14px;
  color: var(--text-main);
}

.release-row span {
  font-size: 12px;
  color: var(--text-muted);
}

.release-row code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.current-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--status-active-surface);
  border: 1px solid var(--status-active-border);
  color: var(--status-active-text);
  font-size: 11px;
  font-weight: 700;
}

.security-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.security-points span {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* ==========================================================================
   Backups Page
   ========================================================================== */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.backup-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.backup-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.backup-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.backup-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.backup-card.danger-card {
  border-color: rgba(239, 68, 68, 0.20);
}

.backup-card.danger-card h2 {
  color: var(--status-danger-text);
}

.backup-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.confirm-small {
  padding: 4px 8px;
  font-size: 11px;
  max-width: 90px;
}

/* ==========================================================================
   Security Strip & Empty States
   ========================================================================== */
.security-strip {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.security-strip strong {
  font-size: 14px;
  color: var(--text-main);
  display: block;
}

.security-strip span {
  font-size: 12px;
  color: var(--text-muted);
}

.security-strip ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.security-strip li {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.empty-state {
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.empty-state.compact {
  padding: 16px;
  font-size: 12px;
}

/* ==========================================================================
   Authentication & Login Card
   ========================================================================== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(255, 122, 0, 0.08) 0%, transparent 60%), var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.auth-header .brand-icon-box {
  width: 48px;
  height: 48px;
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .insights-columns {
    grid-template-columns: 1fr;
  }
  .backup-grid {
    grid-template-columns: 1fr;
  }
  .update-status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .admin-layout,
  .license-admin-layout,
  .app-shell {
    grid-template-columns: 1fr;
  }
  .license-sidebar,
  .sidebar {
    height: auto;
    position: static;
  }
  .admin-main,
  .license-main,
  .main-content {
    padding: 24px 18px;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .admin-header,
  .license-header,
  .page-head {
    flex-direction: column;
  }
  .publish-form {
    grid-template-columns: 1fr;
  }
  .publish-form label.full {
    grid-column: span 1;
  }
  .publish-actions {
    grid-column: span 1;
  }
}
