/* ============================================================
   TYRE.INFO TESTING PLATFORM — Design System
   Premium dark theme · Navy + Cyan · Data-focused
   ============================================================ */

/* --- Foundations --- */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Core palette */
  --bg-deep:        #05070d;
  --bg-base:        #0b1320;
  --bg-surface:     rgba(18, 32, 53, 0.7);
  --bg-surface-solid: #122035;
  --bg-raised:      #162440;
  --bg-hover:       #1a2d4d;
  --bg-input:       #0a1220;

  /* Borders */
  --border-subtle:  rgba(90, 214, 255, 0.08);
  --border-default: rgba(90, 214, 255, 0.18);
  --border-focus:   rgba(13, 177, 231, 0.5);

  /* Accent */
  --cyan:           #0db1e7;
  --cyan-dim:       rgba(13, 177, 231, 0.12);
  --cyan-glow:      rgba(13, 177, 231, 0.06);
  --cyan-hover:     #5ad6ff;
  --cyan-active:    #0a9ed0;
  --cyan-text:      #5ad6ff;

  /* Semantic */
  --green:          #34d399;
  --green-dim:      #34d39918;
  --amber:          #fbbf24;
  --amber-dim:      #fbbf2418;
  --red:            #f87171;
  --red-dim:        #f8717118;
  --blue:           #60a5fa;
  --blue-dim:       #60a5fa18;

  /* Text */
  --text-primary:   #f7fbff;
  --text-secondary: #b8c7da;
  --text-muted:     #5a7394;
  --text-inverse:   #05070d;

  /* Typography */
  --font-heading:   'Sora', system-ui, sans-serif;
  --font-body:      'Inter', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing scale */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-lg:    0 20px 60px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.25);
  --shadow-glow:  0 0 20px rgba(13, 177, 231, 0.15), 0 0 60px rgba(13, 177, 231, 0.05);
  --shadow-card:  inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.25);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --content-max:   1280px;

  /* Transitions */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration:  180ms;
}


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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background glow — moody atmospheric depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(13, 177, 231, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 70%, rgba(13, 177, 231, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

::selection {
  background: var(--cyan);
  color: var(--text-inverse);
}

a {
  color: var(--cyan-text);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

a:hover {
  color: var(--cyan);
}

img { max-width: 100%; display: block; }


/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-cyan     { color: var(--cyan-text); }
.text-mono     { font-family: var(--font-mono); font-size: 0.87em; }
.text-sm       { font-size: 0.87rem; }
.text-xs       { font-size: 0.8rem; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-title::before {
  content: '';
  width: 4px;
  height: 1.2em;
  background: var(--cyan);
  border-radius: 2px;
  flex-shrink: 0;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.93rem;
  margin-top: var(--space-xs);
}


/* ============================================================
   LAYOUT — Sidebar + Content
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-base);
  border-right: 1px solid rgba(90, 214, 255, 0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 300ms var(--ease-out);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-sm);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  height: 28px;
  width: auto;
}

.sidebar-brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-brand-text span {
  color: var(--cyan);
}

.sidebar-customer {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-customer-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.87rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-customer-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

.nav-section {
  margin-bottom: var(--space-md);
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-lg) var(--space-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px var(--space-lg);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 450;
  transition: all var(--duration) var(--ease-out);
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-surface-solid);
}

.nav-item.active {
  color: var(--cyan-text);
  background: var(--cyan-dim);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--cyan);
  border-radius: 0 3px 3px 0;
}

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

.nav-item.active svg,
.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--cyan-dim);
  color: var(--cyan-text);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--cyan-text);
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

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

.sidebar-user-role {
  font-size: 0.73rem;
  color: var(--text-muted);
}

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

.content-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  border-bottom: 1px solid rgba(90, 214, 255, 0.06);
  background: rgba(5, 7, 13, 0.85);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.content-body {
  flex: 1;
  padding: var(--space-xl);
  max-width: var(--content-max);
  width: 100%;
}

.content-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.content-footer a {
  color: var(--cyan-text);
  font-weight: 500;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-sm);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}


/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-card), 0 0 30px rgba(13, 177, 231, 0.06);
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.card-header h2,
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease, transform var(--duration) var(--ease-out), box-shadow 0.3s ease;
}

.stat-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), 0 0 30px rgba(13, 177, 231, 0.06);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cyan);
  opacity: 0;
  transition: opacity var(--duration) var(--ease-out);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card-label {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.stat-card-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-card-value.cyan { color: var(--cyan-text); }
.stat-card-value.green { color: var(--green); }

.stat-card-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.stat-card-icon {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--cyan-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-text);
}


/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  font-family: var(--font-heading);
  font-size: 0.87rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.15s, box-shadow 0.25s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

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

.btn-primary {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
}

.btn-primary:hover {
  background: var(--cyan-active);
  border-color: var(--cyan-active);
  color: #fff;
  box-shadow: 0 0 20px rgba(13, 177, 231, 0.25);
}

.btn-primary:active {
  background: var(--cyan-active);
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--cyan);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  color: var(--cyan-hover);
  border-color: var(--cyan);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red-dim);
}

.btn-danger:hover {
  background: var(--red-dim);
  border-color: var(--red);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
}

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

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-raised);
}

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

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-group {
  display: flex;
  gap: var(--space-sm);
}


/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--red);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-default);
}

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

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

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23556b8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
}

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

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

.form-input.is-error,
.form-select.is-error {
  border-color: var(--red);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}


/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

thead {
  background: rgba(22, 36, 64, 0.5);
}

th {
  padding: 11px var(--space-lg);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
}

td {
  padding: 12px var(--space-lg);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--duration) var(--ease-out);
}

tbody tr:hover {
  background: var(--bg-surface-solid);
}

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

td .cell-primary {
  font-weight: 500;
  color: var(--text-primary);
}

td .cell-secondary {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-empty {
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}

.table-empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}


/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 20px;
  line-height: 1.4;
}

.badge-active,
.badge-success {
  background: var(--green-dim);
  color: var(--green);
}

.badge-suspended,
.badge-warning {
  background: var(--amber-dim);
  color: var(--amber);
}

.badge-cancelled,
.badge-danger {
  background: var(--red-dim);
  color: var(--red);
}

.badge-info {
  background: var(--blue-dim);
  color: var(--blue);
}

.badge-neutral {
  background: var(--bg-raised);
  color: var(--text-secondary);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}


/* --- Alerts / Flash Messages --- */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 450;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  border: 1px solid;
  animation: alertSlideIn 300ms var(--ease-out);
}

@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-success {
  background: var(--green-dim);
  border-color: #34d39930;
  color: var(--green);
}

.alert-error {
  background: var(--red-dim);
  border-color: #f8717130;
  color: var(--red);
}

.alert-warning {
  background: var(--amber-dim);
  border-color: #fbbf2430;
  color: var(--amber);
}

.alert-info {
  background: var(--blue-dim);
  border-color: #60a5fa30;
  color: var(--blue);
}

.alert-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 4px;
  font-size: 1.1rem;
  line-height: 1;
}

.alert-dismiss:hover {
  opacity: 1;
}


/* --- Toggle Switch --- */
.toggle {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all var(--duration) var(--ease-snap);
}

.toggle input:checked + .toggle-slider {
  background: var(--cyan-dim);
  border-color: var(--cyan);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--cyan);
}


/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-lg);
  justify-content: center;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--duration) var(--ease-out);
}

.pagination a {
  color: var(--text-secondary);
}

.pagination a:hover {
  background: var(--bg-surface-solid);
  color: var(--text-primary);
}

.pagination .active {
  background: var(--cyan-dim);
  color: var(--cyan-text);
}


/* --- Empty States --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state h3 {
  margin-bottom: var(--space-sm);
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}


/* --- Dropdown --- */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 180px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px;
  z-index: 200;
  display: none;
  animation: dropdownFadeIn 150ms var(--ease-out);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  font-size: 0.87rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}

.dropdown-item:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}


/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-xl);
}

.tab {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--duration) var(--ease-out);
  cursor: pointer;
}

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

.tab.active {
  color: var(--cyan-text);
  border-bottom-color: var(--cyan);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-raised);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

.tab.active .tab-badge {
  color: var(--cyan-text);
  background: color-mix(in srgb, var(--cyan) 15%, transparent);
}


/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 15, 29, 0.8);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: modalOverlayIn 200ms var(--ease-out);
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: rgba(18, 32, 53, 0.85);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(13, 177, 231, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 250ms var(--ease-out);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}


/* ============================================================
   AUTH LAYOUT
   ============================================================ */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

/* Subtle background grid texture */
.auth-layout::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 600px 400px at 50% 40%, var(--cyan-glow), transparent),
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 100% 100%, 60px 60px, 60px 60px;
  opacity: 0.3;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

.auth-brand {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.auth-brand-logo {
  height: 36px;
  margin: 0 auto var(--space-md);
}

.auth-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-brand h1 span {
  color: var(--cyan);
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: var(--space-xs);
}

.auth-form {
  background: rgba(18, 32, 53, 0.7);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-form .btn-primary {
  margin-top: var(--space-sm);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-xl);
  font-size: 0.78rem;
  color: var(--text-muted);
}


/* ============================================================
   MASTER LAYOUT (same structure, blue accent)
   ============================================================ */
.master-layout .sidebar {
  border-right-color: #1a2a4580;
}

.master-layout .nav-item.active {
  color: var(--blue);
  background: var(--blue-dim);
}

.master-layout .nav-item.active::before {
  background: var(--blue);
}

.master-layout .stat-card::after {
  background: var(--blue);
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs        { gap: var(--space-xs); }
.gap-sm        { gap: var(--space-sm); }
.gap-md        { gap: var(--space-md); }
.gap-lg        { gap: var(--space-lg); }
.mt-sm         { margin-top: var(--space-sm); }
.mt-md         { margin-top: var(--space-md); }
.mt-lg         { margin-top: var(--space-lg); }
.mt-xl         { margin-top: var(--space-xl); }
.mb-sm         { margin-bottom: var(--space-sm); }
.mb-md         { margin-bottom: var(--space-md); }
.mb-lg         { margin-bottom: var(--space-lg); }
.mb-xl         { margin-bottom: var(--space-xl); }
.ml-auto       { margin-left: auto; }
.w-full        { width: 100%; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden        { display: none; }
.sr-only       { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .content-body {
    padding: var(--space-lg);
  }

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .sidebar-toggle {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .content-body {
    padding: var(--space-md);
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 10px var(--space-md);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  html { font-size: 14px; }

  .auth-form {
    padding: var(--space-lg);
  }

  .page-title {
    font-size: 1.25rem;
  }
}


/* ============================================================
   ERROR PAGES
   ============================================================ */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

.error-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 600px 400px at 50% 40%, var(--cyan-glow), transparent);
  opacity: 0.5;
  pointer-events: none;
}

.error-content {
  text-align: center;
  position: relative;
  z-index: 1;
}

.error-code {
  font-family: var(--font-heading);
  font-size: 8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(180deg, var(--cyan-text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-md);
}

.error-content h1 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.error-content p {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.error-detail {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
  overflow-x: auto;
}

.error-detail code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--red);
  white-space: pre-wrap;
  word-break: break-all;
}

.error-footer {
  position: absolute;
  bottom: var(--space-xl);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.error-footer a {
  color: var(--cyan-text);
  font-weight: 500;
}

@media (max-width: 480px) {
  .error-code {
    font-size: 5rem;
  }
}
