/**
 * Symbio Soft Neumorphism design system.
 * Clean, rounded, soft-shadow aesthetic inspired by modern SaaS dashboards.
 * Three color schemes: blue (default), red, green — selectable via theme setting.
 *
 * CSS variables cascade: :root defines blue, .theme-red / .theme-green on <html> override accents.
 * Dark variants (.theme-dark-blue, .theme-dark-red, .theme-dark-green) invert backgrounds
 * while keeping accent color identity. Selectable via settings theme dropdown.
 */

/* --- Base Theme: Blue (default) --- */
:root {
  --symbio-sidebar: #edf4f9;
  --symbio-sidebar-deep: #dde8f0;
  --symbio-sidebar-hover: #dce8f2;
  --symbio-primary: #5b8cb8;
  --symbio-primary-dark: #4576a0;
  --symbio-primary-light: #e8f0fe;
  --symbio-card-header: #dee9f2;
  --symbio-background: #ffffff;
  --symbio-panel: #ffffff;
  --symbio-border: #c8cdd3;
  --symbio-muted: #7b8a9e;
  --symbio-heading: #1a2332;
  --symbio-danger: #d14343;
  --symbio-danger-bg: #fef2f2;
  --symbio-danger-border: #fecaca;
  --symbio-success: #1a6b48;
  --symbio-radius: 14px;
  --symbio-radius-sm: 10px;
  --symbio-shadow-sm: 0 2px 6px rgba(0,0,0,.10);
  --symbio-shadow-lg: 0 4px 14px rgba(0,0,0,.12);
  --symbio-shadow-btn: 0 1px 3px rgba(0,0,0,.08);
  --symbio-shadow-inset: inset 0 1px 4px rgba(0,0,0,.08);
  --symbio-toggle-bg: #d8dde5;
  --symbio-table-header: #e8ecf2;
  --symbio-table-row-alt: #f8f9fb;
  --symbio-table-row-hover: #eef2f7;
  --symbio-card-footer-bg: #f7f9fa;
  --symbio-log-bg: #1a1e26;
  --symbio-log-border: #11141a;
  --symbio-log-text: #e7eef3;
  --symbio-code-bg: #f0f0f0;
  --symbio-ring-track: #d5dbe3;
  --symbio-line-num-bg: #f0f3f6;
  --symbio-proof-bg: #f5f7f9;
  --symbio-badge-success-bg: #d1f0e0;
  --symbio-badge-secondary-bg: #dfe4eb;
  --symbio-badge-warning-bg: #fcf0d6;
  --symbio-badge-info-bg: #d4e7f7;
  --symbio-warning-bg: #fff8e6;
  --symbio-wizard-step-bg: #dfe5ea;
  --symbio-file-editor-bg: #f4f6f9;
  --symbio-warning-border: #f0d78c;
  --symbio-text: #3d4a5c;
  --symbio-file-link: #1f3d52;
  --symbio-warning-text: #8a6d14;
  --symbio-btn-bg: #e0e5ec;
}

/* --- Red theme --- */
.theme-red {
  --symbio-primary: #c97d7d;
  --symbio-primary-dark: #b06060;
  --symbio-primary-light: #fde8e8;
  --symbio-sidebar: #f8efef;
  --symbio-sidebar-deep: #f0dddd;
  --symbio-sidebar-hover: #f3e2e2;
  --symbio-card-header: #efdbdb;
}

/* --- Green theme --- */
.theme-green {
  --symbio-primary: #6b9e7a;
  --symbio-primary-dark: #528562;
  --symbio-primary-light: #e8f5e9;
  --symbio-sidebar: #eef5f0;
  --symbio-sidebar-deep: #dceddd;
  --symbio-sidebar-hover: #e0ede4;
  --symbio-card-header: #dfede3;
}

/* --- Dark Blue theme (blue accents on dark background) --- */
.theme-dark-blue,
.theme-dark-red,
.theme-dark-green {
  --symbio-background: #0f1117;
  --symbio-panel: #1a1d27;
  --symbio-border: #2a2d3a;
  --symbio-muted: #c0c5d0;
  --symbio-heading: #f3f4f6;
  --symbio-danger: #e06060;
  --symbio-danger-bg: #2a1a1a;
  --symbio-danger-border: #4a2a2a;
  --symbio-success: #5a9a7a;
  --symbio-shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --symbio-shadow-lg: 0 4px 16px rgba(0,0,0,.45);
  --symbio-shadow-btn: 0 1px 3px rgba(0,0,0,.30);
  --symbio-shadow-inset: inset 0 1px 4px rgba(0,0,0,.30);
  --symbio-toggle-bg: #2d3045;
  --symbio-table-header: #22253d;
  --symbio-table-row-alt: #252a40;
  --symbio-table-row-hover: #2d3148;
  --symbio-card-footer-bg: #12141f;
  --symbio-code-bg: #1e2135;
  --symbio-ring-track: #2a2d45;
  --symbio-line-num-bg: #181a28;
  --symbio-proof-bg: #181a28;
  --symbio-badge-success-bg: #1a3a2a;
  --symbio-badge-secondary-bg: #2a2d40;
  --symbio-badge-warning-bg: #3a2a1a;
  --symbio-badge-info-bg: #1a2a3a;
  --symbio-warning-bg: #2a2518;
  --symbio-wizard-step-bg: #2a2d40;
  --symbio-file-editor-bg: #1a1d2d;
  --symbio-warning-border: #4a3a1a;
  --symbio-text: #e8eaed;
  --symbio-file-link: #7ab8d4;
  --symbio-warning-text: #c4a34a;
  --symbio-btn-bg: #2a2d45;
  --symbio-primary-light: #1a2235;
  --symbio-card-header: #151824;
  --symbio-sidebar: #11131c;
  --symbio-sidebar-deep: #0c0e15;
  --symbio-sidebar-hover: #1a1d2e;
  /* Bootstrap overrides for dark mode readability */
  --bs-body-bg: #0f1117;
  --bs-body-color: #e8eaed;
  --bs-body-color-rgb: 232, 234, 237;
  --bs-secondary-color: #c0c5d0;
  --bs-secondary-color-rgb: 192, 197, 208;
  --bs-tertiary-color: #a0a8b5;
  --bs-tertiary-color-rgb: 160, 168, 181;
  --bs-table-striped-bg: rgba(255,255,255,.07);
  --bs-table-hover-bg: rgba(255,255,255,.1);
  --bs-table-striped-color: #e8eaed;
  --bs-table-bg: transparent;
  --bs-secondary-bg: #22253d;
  --bs-tertiary-bg: #1a1d27;
  --bs-border-color: #2a2d3a;
  --bs-link-color: #5b8cb8;
  --bs-link-color-rgb: 91, 140, 184;
  --bs-link-hover-color: #4576a0;
  --bs-link-hover-color-rgb: 69, 118, 160;
  --bs-table-color: #e8eaed;
  --bs-emphasis-color: #e8eaed;
  --bs-emphasis-color-rgb: 232, 234, 237;
  /* Pagination */
  --bs-pagination-color: #c0c5d0;
  --bs-pagination-bg: #0f1117;
  --bs-pagination-border-color: #2a2d3a;
  --bs-pagination-hover-color: #e8eaed;
  --bs-pagination-hover-bg: #1a1d27;
  --bs-pagination-hover-border-color: #2a2d3a;
  --bs-pagination-focus-color: #e8eaed;
  --bs-pagination-focus-bg: #22253d;
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(91,140,184,.25);
  --bs-pagination-active-color: #fff;
  --bs-pagination-active-bg: #5b8cb8;
  --bs-pagination-active-border-color: #5b8cb8;
  --bs-pagination-disabled-color: #6b7280;
  --bs-pagination-disabled-bg: #0f1117;
  --bs-pagination-disabled-border-color: #2a2d3a;
  /* Form */
  --bs-form-control-disabled-bg: #22253d;
}
/* Dark mode: invert black provider SVGs to white */
.theme-dark-blue img[src*="/img/providers/"],
.theme-dark-red img[src*="/img/providers/"],
.theme-dark-green img[src*="/img/providers/"] {
  filter: brightness(0) invert(1);
}
/* Dark mode: clearer form control borders */
.theme-dark-blue .form-control,
.theme-dark-blue .form-select,
.theme-dark-red .form-control,
.theme-dark-red .form-select,
.theme-dark-green .form-control,
.theme-dark-green .form-select {
  border-color: #3d4357;
}
.theme-dark-blue .form-control:focus,
.theme-dark-blue .form-select:focus,
.theme-dark-red .form-control:focus,
.theme-dark-red .form-select:focus,
.theme-dark-green .form-control:focus,
.theme-dark-green .form-select:focus {
  border-color: var(--symbio-primary);
}
.theme-dark-red {
  --symbio-primary: #d49191;
  --symbio-primary-dark: #b06060;
  --symbio-primary-light: #2d1a1a;
  --symbio-sidebar: #1a1111;
  --symbio-sidebar-deep: #140b0b;
  --symbio-sidebar-hover: #2d1c1c;
  --symbio-card-header: #2e1a1a;
}
.theme-dark-green {
  --symbio-primary: #7ab88a;
  --symbio-primary-dark: #528562;
  --symbio-primary-light: #1a2d1e;
  --symbio-sidebar: #131a15;
  --symbio-sidebar-deep: #0d140f;
  --symbio-sidebar-hover: #1c2d22;
  --symbio-card-header: #1a2e20;
}

/* ==========================================================================
   BODY & GLOBAL
   ========================================================================== */
body {
  background: var(--symbio-background);
  color: var(--symbio-text);
  font-size: .875rem;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--symbio-primary); text-decoration: none; }
a:hover { color: var(--symbio-primary-dark); }

.app-shell {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  min-height: 100vh;
  contain: layout style;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  background: var(--symbio-sidebar);
  border-right: 2px solid var(--symbio-border);
  min-width: 0;
  padding: 0 0 1.5rem;
  contain: layout style;
}

.sidebar-header {
  background: var(--symbio-sidebar-deep);
  border-bottom: 1px solid var(--symbio-border);
  padding: 1rem 1.15rem .85rem;
}

.sidebar-brand {
  align-items: center;
  color: var(--symbio-primary);
  display: flex;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
}

.sidebar-brand:hover {
  color: var(--symbio-primary-dark);
  text-decoration: none;
}

.sidebar-caption {
  color: var(--symbio-muted);
  display: block;
  font-size: .7rem;
  letter-spacing: .06em;
  margin: .65rem 0 0 2.3rem;
  text-transform: uppercase;
}

.sidebar-toggle {
  background: var(--symbio-toggle-bg);
  border: 1px solid var(--symbio-border);
  border-radius: var(--symbio-radius-sm);
  color: var(--symbio-heading);
  display: none;
  font-size: .8rem;
  margin: .75rem 1rem 0;
  padding: .38rem .65rem;
}

.sidebar-nav { padding-top: .7rem; }

.nav-group {
  border-bottom: none;
  padding: .35rem 0 .6rem;
}

.nav-group + .nav-group { margin-top: .25rem; }

.nav-group-title {
  color: var(--symbio-primary);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  margin: 0;
  padding: .45rem 1.15rem;
  text-transform: uppercase;
}

.sidebar .nav-link {
  align-items: center;
  border-left: 4px solid transparent;
  border-radius: 0 10px 10px 0;
  color: var(--symbio-heading);
  display: flex;
  font-size: .82rem;
  gap: .5rem;
  margin: 2px 8px 2px 0;
  min-height: 2.35rem;
  padding: .5rem 1.15rem;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}

.sidebar .nav-link i {
  color: var(--symbio-primary);
  text-align: center;
  width: 1rem;
  font-size: .85rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  background: var(--symbio-sidebar-hover);
  border-radius: 8px 10px 10px 8px;
  margin-left: 6px;
}

.sidebar .nav-link.is-active {
  background: var(--symbio-primary);
  border-left-color: var(--symbio-primary-dark);
  border-radius: 8px 10px 10px 8px;
  color: #fff;
  font-weight: 700;
  margin-left: 6px;
}

.sidebar .nav-link.is-active i { color: rgba(255,255,255,.9); }

.sidebar .nav-submenu {
  font-size: .78rem;
  padding-left: 2.7rem;
}

/* ==========================================================================
   TOPBAR & MAIN
   ========================================================================== */
.main-column { min-width: 0; }

.topbar {
  align-items: center;
  background: var(--symbio-primary);
  border-bottom: 2px solid var(--symbio-primary-dark);
  display: flex;
  justify-content: space-between;
  min-height: 56px;
  padding: .5rem 1.5rem;
  color: #fff;
}

.topbar-context {
  align-items: center;
  color: rgba(255,255,255,.85);
  display: flex;
  gap: .5rem;
  font-size: .82rem;
}

.topbar-context > i { color: rgba(255,255,255,.9); font-size: 1rem; }

.topbar-context strong { color: #fff; font-size: .86rem; display: block; }
.topbar-context small { color: rgba(255,255,255,.7); font-size: .72rem; display: block; }

.user-controls {
  align-items: center;
  display: flex;
  gap: .8rem;
}

.user-name { color: rgba(255,255,255,.85); font-size: .82rem; }
.user-name i { color: rgba(255,255,255,.7); }
.user-name:hover { color: #fff; }

/* Topbar buttons use light variant on colored background */
.topbar .btn-outline-secondary {
  background: transparent;
  border-color: rgba(255,255,255,.5);
  color: rgba(255,255,255,.9);
}

.topbar .btn-outline-secondary:hover,
.topbar .btn-outline-secondary:focus {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.8);
  color: #fff;
}

/* AI Bar — global question input in the topbar */
.ai-bar {
  flex: 1;
  display: flex;
  align-items: center;
  max-width: 580px;
}
.ai-bar-input-group {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 28px;
  padding: .2rem .2rem .2rem 1rem;
  width: 100%;
  transition: background .2s, box-shadow .2s, border-color .2s;
}
.ai-bar-input-group:focus-within {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.4);
  box-shadow: 0 0 0 3px rgba(255,255,255,.12);
}
.ai-bar-icon {
  color: rgba(255,255,255,.65);
  font-size: .85rem;
  margin-right: .5rem;
  flex-shrink: 0;
}
.ai-bar-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: .82rem;
  padding: .4rem 0;
}
.ai-bar-input::placeholder { color: rgba(255,255,255,.45); }
.ai-bar-submit {
  background: rgba(255,255,255,.18);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}
.ai-bar-submit:hover { background: rgba(255,255,255,.35); -webkit-transform: scale(1.08); transform: scale(1.08); }
.ai-bar-submit:active { -webkit-transform: scale(.95); transform: scale(.95); }
.ai-bar-loading {
  display: none;
  align-items: center;
  gap: .55rem;
  color: rgba(255,255,255,.9);
  font-size: .82rem;
  white-space: nowrap;
}
.ai-bar-loading i { font-size: .9rem; }

.content { padding: 1.35rem 1.5rem 2.25rem; }
.admin-content { margin: 0 auto; max-width: 1620px; }

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
.h3, h1.h3 {
  color: var(--symbio-heading);
  font-size: 1.35rem;
  font-weight: 800;
}

.text-uppercase {
  font-size: .68rem !important;
  font-weight: 700;
  letter-spacing: .08em;
}

.text-secondary { color: var(--symbio-muted) !important; }
.text-success { color: var(--symbio-success) !important; }

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */
.breadcrumb {
  background: transparent;
  border-bottom: 1px solid var(--symbio-border);
  border-radius: 0;
  font-size: .78rem;
  margin-bottom: 1rem;
  padding: 0 0 .65rem;
}

.breadcrumb-item + .breadcrumb-item::before { color: var(--symbio-muted); }

/* ==========================================================================
   CARDS — Neumorphism embossed style
   ========================================================================== */
.card {
  background: var(--symbio-panel);
  border: 2px solid var(--symbio-border);
  border-radius: var(--symbio-radius);
  box-shadow: var(--symbio-shadow-sm);
  color: var(--symbio-text);
  contain: layout style;
}

.card-header {
  background: linear-gradient(180deg, var(--symbio-card-header), var(--symbio-panel));
  border-bottom: 1px solid var(--symbio-border);
  border-radius: var(--symbio-radius) var(--symbio-radius) 0 0;
  color: var(--symbio-heading);
  font-size: .85rem;
  font-weight: 700;
  padding: .75rem 1rem;
  min-height: 2.65rem;
}

/* Danger-tinted card headers keep white text readable */
.card-header.bg-danger {
  background: var(--symbio-danger) !important;
  border-bottom-color: var(--symbio-danger);
  border-radius: var(--symbio-radius) var(--symbio-radius) 0 0;
}

/* Success-tinted card headers (no alert state) */
.card-header.bg-success {
  background: var(--symbio-success) !important;
  border-bottom-color: var(--symbio-success);
  border-radius: var(--symbio-radius) var(--symbio-radius) 0 0;
}

.card-footer {
  background: var(--symbio-card-footer-bg);
  border-top: 1px solid var(--symbio-border);
  border-radius: 0 0 var(--symbio-radius) var(--symbio-radius);
  padding: .7rem 1rem;
}

.card-body { padding: 1rem; color: var(--symbio-text); }

/* ==========================================================================
   TABLES
   ========================================================================== */
.table { color: var(--symbio-text); }
.table > :not(caption) > * > * { padding: .6rem .85rem; }

.table thead th {
  background: var(--symbio-table-header);
  border-bottom: 2px solid var(--symbio-border);
  color: var(--symbio-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  vertical-align: middle;
}

.table thead th:first-child { border-radius: var(--symbio-radius-sm) 0 0 0; }
.table thead th:last-child { border-radius: 0 var(--symbio-radius-sm) 0 0; }

.table tbody tr:nth-child(even) > * { background-color: var(--symbio-table-row-alt); }
.table tbody tr:hover > * { background-color: var(--symbio-table-row-hover); }
.table tbody th { color: var(--symbio-heading); font-weight: 600; }
.table-responsive { border-radius: 0 0 var(--symbio-radius) var(--symbio-radius); }

/* Dashboard applications widget — scroll internally so the top alert + metric cards stay fixed */
.dashboard-app-scroll {
  max-height: 420px;
  overflow-y: auto;
}
.dashboard-app-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  border-radius: var(--symbio-radius-sm);
  font-size: .8rem;
  font-weight: 600;
  padding: .42rem .9rem;
  transition: background .15s, transform .15s, box-shadow .15s;
}

.btn-primary {
  background-color: var(--symbio-primary);
  border-color: var(--symbio-primary);
  box-shadow: var(--symbio-shadow-btn);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--symbio-primary-dark);
  border-color: var(--symbio-primary-dark);
  -webkit-transform: translateY(-1px);
  transform: translateY(-1px);
  box-shadow: 2px 4px 8px rgba(0,0,0,.15);
}

.btn-outline-primary {
  border-color: var(--symbio-primary);
  color: var(--symbio-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--symbio-primary);
  border-color: var(--symbio-primary);
  color: #fff;
}

.btn-outline-secondary {
  background: var(--symbio-panel);
  border-color: var(--symbio-border);
  color: var(--symbio-muted);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: var(--symbio-btn-bg);
  color: var(--symbio-heading);
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-control, .form-select {
  background: var(--symbio-panel);
  border-color: var(--symbio-border);
  border-radius: var(--symbio-radius-sm);
  color: var(--symbio-text);
}

.form-control:focus, .form-select:focus {
  border-color: var(--symbio-primary);
  box-shadow: 0 0 0 .18rem rgba(91, 140, 184, .2);
}

/* Override Bootstrap's white form-check background for dark themes */
.form-check-input {
  background-color: var(--symbio-btn-bg);
  border-color: var(--symbio-border);
}
.form-check-input:checked {
  background-color: var(--symbio-primary);
  border-color: var(--symbio-primary);
}

.form-label, legend {
  color: var(--symbio-heading);
  font-size: .84rem;
  font-weight: 700;
}

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

.alert { border-radius: var(--symbio-radius-sm); }

/* Danger / error alerts — keep Bootstrap's alert-danger working */
.alert-danger {
  background: var(--symbio-danger-bg);
  border-color: var(--symbio-danger-border);
  color: var(--symbio-danger);
}

/* Danger badges and buttons — complement Bootstrap classes */
.text-bg-danger,
.badge.text-bg-danger {
  background: var(--symbio-danger) !important;
  color: #fff !important;
}

.btn-danger {
  background-color: var(--symbio-danger) !important;
  border-color: var(--symbio-danger) !important;
}

.btn-outline-danger {
  border-color: var(--symbio-danger);
  color: var(--symbio-danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  background: var(--symbio-danger);
  color: #fff;
}

.text-danger { color: var(--symbio-danger) !important; }

/* ==========================================================================
   METRIC CARDS (Dashboard stats)
   ========================================================================== */
.metric-value {
  color: var(--symbio-primary);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.metric-card {
  align-items: flex-start;
  display: flex;
  gap: .85rem;
  justify-content: space-between;
}

.metric-capacity {
  color: var(--symbio-heading);
  display: block;
  font-size: .75rem;
  line-height: 1.25;
  margin-top: .3rem;
}

.metric-detail {
  color: var(--symbio-muted);
  display: block;
  font-size: .72rem;
  line-height: 1.25;
  margin-top: .25rem;
}

/* ==========================================================================
   CPU CORE GRID
   ========================================================================== */
.cpu-core-grid {
  display: grid;
  gap: .3rem .6rem;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  max-height: 5rem;
  overflow-y: auto;
}

.cpu-core {
  align-items: center;
  color: var(--symbio-muted);
  display: flex;
  font-size: .72rem;
  gap: .2rem;
  justify-content: space-between;
  white-space: nowrap;
}

.cpu-core i { color: var(--symbio-muted); font-size: .65rem; }
.cpu-core strong { color: var(--symbio-heading); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   PROGRESS RING (SVG doughnut for CPU/Memory/Disk)
   ========================================================================== */
.progress-ring {
  flex: 0 0 48px;
  height: 48px;
  -webkit-transform: rotate(-90deg);
  transform: rotate(-90deg);
  width: 48px;
}

.progress-ring-track, .progress-ring-value { fill: none; stroke-width: 5; }
.progress-ring-track { stroke: var(--symbio-ring-track); }
.progress-ring-value { stroke: var(--symbio-primary); stroke-linecap: round; }

/* ==========================================================================
   STATUS BADGES
   ========================================================================== */
.status-badge {
  font-size: .72rem;
  min-width: 6rem;
  text-transform: capitalize;
}

.badge {
  padding: 2px 9px;
  border-radius: 8px;
  font-size: .72rem;
  font-weight: 700;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.05);
}

.text-bg-success, .badge-success {
  background: var(--symbio-badge-success-bg);
  color: var(--symbio-success);
}

.text-bg-secondary, .badge-secondary {
  background: var(--symbio-badge-secondary-bg);
  color: var(--symbio-muted);
}

.text-bg-warning {
  background: var(--symbio-badge-warning-bg);
  color: var(--symbio-warning-text);
}

.text-bg-info {
  background: var(--symbio-badge-info-bg);
  color: var(--symbio-primary-dark);
}

/* ==========================================================================
   CHARTS (SVG server-rendered)
   ========================================================================== */
.symbio-chart {
  background: var(--symbio-panel);
  border: 2px solid var(--symbio-border);
  border-radius: var(--symbio-radius);
  box-shadow: var(--symbio-shadow-sm);
  margin: 0;
  padding: 1rem;
}

.symbio-chart figcaption {
  color: var(--symbio-heading);
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: .6rem;
}

/* SVG icon sprite sizing */
.icon { width: 1.2em; height: 1.2em; display: inline-block; vertical-align: middle; fill: currentColor; }

/* Rotating spinner animation for loading indicators */
.icon-spin { animation: iconSpin 1s linear infinite; transform-origin: center; }
@keyframes iconSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Dashboard metric rings and chart SVG overrides */
.symbio-chart svg { display: block; height: 220px; width: 100%; }

.chart-line { fill: none; stroke: var(--symbio-primary); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.chart-line-primary { stroke-width: 4; }
.chart-line-muted { opacity: .35; stroke: var(--symbio-muted); stroke-width: 1.5; }

.chart-axis { fill: none; stroke: #bcc5d0; stroke-width: 1; }
.chart-grid { stroke: #dfe4eb; stroke-width: 1; }
.chart-label { fill: var(--symbio-muted); font-size: 11px; font-weight: 700; }
.chart-legend-primary { color: var(--symbio-primary); font-weight: 700; margin-left: .5rem; }
.chart-legend-muted { color: var(--symbio-muted); font-weight: 600; margin-left: .5rem; }

/* Percentile reference lines on response time chart */
.chart-percentile { fill: none; stroke: var(--symbio-muted); stroke-width: 1.5; }
.chart-percentile-label { fill: var(--symbio-muted); font-size: 10px; font-weight: 600; }

/* Dashboard sparkline for app response trend */
.app-sparkline { display: inline-block; vertical-align: middle; color: var(--symbio-primary); opacity: 0.7; }

/* ==========================================================================
   SERVICE DISABLED
   ========================================================================== */
.service-disabled { color: var(--symbio-muted); text-decoration: line-through; }
.service-disabled .btn, .service-disabled .badge { text-decoration: none; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  border-top: 4px solid var(--symbio-primary);
  border-radius: var(--symbio-radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  max-width: 430px;
  width: 100%;
}

/* ==========================================================================
   WARNING BANNER
   ========================================================================== */
.warning-banner {
  background: var(--symbio-warning-bg);
  border-bottom: 1px solid var(--symbio-warning-border);
  color: var(--symbio-warning-text);
  font-size: .78rem;
  padding: .45rem 1rem;
  text-align: center;
}

/* ==========================================================================
   WIZARD
   ========================================================================== */
.wizard-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.wizard-card {
  border-top: 4px solid var(--symbio-primary);
  border-radius: var(--symbio-radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  max-width: 540px;
  width: 100%;
}

.wizard-card .h3 { font-size: 1.35rem; }

.wizard-steps {
  align-items: center;
  display: flex;
  gap: .5rem;
}

.wizard-step {
  align-items: center;
  background: var(--symbio-wizard-step-bg);
  border-radius: 50%;
  color: var(--symbio-muted);
  display: flex;
  font-size: .75rem;
  font-weight: 700;
  height: 1.75rem;
  justify-content: center;
  width: 1.75rem;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,.08);
}

.wizard-step.active {
  background: var(--symbio-primary);
  color: #fff;
  box-shadow: 2px 2px 4px rgba(0,0,0,.15);
}

.wizard-step.completed {
  background: var(--symbio-success);
  color: #fff;
  box-shadow: 2px 2px 4px rgba(0,0,0,.1);
}

.wizard-step-divider {
  background: var(--symbio-table-header);
  flex: 1;
  height: 2px;
  max-width: 3rem;
  border-radius: 1px;
}

/* ==========================================================================
   CODE & LOG OUTPUT
   ========================================================================== */
code { word-break: break-word; }

.log-output {
  background: var(--symbio-log-bg);
  border: 1px solid var(--symbio-log-border);
  border-radius: var(--symbio-radius-sm);
  color: var(--symbio-log-text);
  font: .78rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 34rem;
  min-height: 18rem;
  overflow: auto;
  padding: .85rem;
  white-space: pre-wrap;
  word-break: break-word;
  contain: layout style paint;
}

/* ==========================================================================
   FILE VIEWER
   ========================================================================== */
.file-viewer { display: flex; }

.file-lines {
  background: var(--symbio-line-num-bg);
  border-right: 1px solid var(--symbio-border);
  border-radius: var(--symbio-radius-sm) 0 0 var(--symbio-radius-sm);
  color: var(--symbio-muted);
  flex-shrink: 0;
  font: .82rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: .85rem .5rem .85rem .75rem;
  text-align: right;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.file-text {
  background: var(--symbio-panel);
  border-radius: 0 var(--symbio-radius-sm) var(--symbio-radius-sm) 0;
  flex: 1;
  font: .82rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
  min-height: 20rem;
  overflow-x: auto;
  padding: .85rem .85rem .85rem .65rem;
  -moz-tab-size: 2;
  tab-size: 2;
  white-space: pre;
}

/* ==========================================================================
   FILE MANAGER
   ========================================================================== */
.file-manager-toolbar { align-items: center; }

.file-tree { font-size: .84rem; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; contain: layout style; }

.file-tree-node { padding-left: .15rem; }

.file-tree-toggle {
  color: var(--symbio-muted);
  cursor: pointer;
  display: inline-block;
  font-size: .7rem;
  min-width: 1rem;
  text-align: center;
}

.file-tree-toggle:hover { color: var(--symbio-heading); }

.file-tree-icon { color: var(--symbio-warning-text); margin-right: .25rem; }

.file-tree-link { color: var(--symbio-heading); text-decoration: none; }
.file-tree-link:hover { color: var(--symbio-primary-dark); text-decoration: underline; }

.file-tree-children { padding-left: 1.3rem; }

.file-list .file-link { color: var(--symbio-file-link); text-decoration: none; cursor: pointer; }
.file-list .file-link:hover { text-decoration: underline; }
.file-list .file-row[data-type="directory"] .file-link { color: var(--symbio-file-link); }

.fm-tree-collapsed .file-tree { display: none; }

.file-list .file-row[data-type="file"] .file-link { color: var(--symbio-muted); cursor: default; }
.file-list .file-row[data-type="file"] .file-link:hover { text-decoration: none; }

/* ==========================================================================
   SERVER TOOLS (cPanel-style icon grid)
   ========================================================================== */
.server-tools-category { margin-bottom: 1.75rem; }
.server-tools-category:last-child { margin-bottom: 0; }

.server-tools-category-header {
  border-bottom: 1px solid var(--symbio-border);
  color: var(--symbio-heading);
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: .7rem;
  padding-bottom: .35rem;
  text-transform: uppercase;
}

.server-tools-items { display: flex; flex-wrap: wrap; gap: .5rem; }

.server-tool-item {
  align-items: center;
  background: var(--symbio-panel);
  border: 1px solid var(--symbio-border);
  border-radius: var(--symbio-radius-sm);
  box-shadow: var(--symbio-shadow-sm);
  color: var(--symbio-heading);
  display: flex;
  flex: 0 0 calc(50% - 0.5rem);
  flex-direction: column;
  font-size: .84rem;
  gap: .3rem;
  justify-content: center;
  min-height: 5rem;
  padding: .75rem .6rem;
  text-align: center;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}

.server-tool-item:hover {
  background: var(--symbio-panel);
  border-color: var(--symbio-primary);
  color: var(--symbio-primary-dark);
  -webkit-transform: translateY(-2px);
  transform: translateY(-2px);
  box-shadow: var(--symbio-shadow-lg);
  text-decoration: none;
}

.server-tool-item i { color: var(--symbio-primary); font-size: 1.4rem; }
.server-tool-label { font-weight: 700; }
.server-tool-hint { color: var(--symbio-muted); font-size: .72rem; font-weight: 400; }

@media (min-width: 768px) {
  .server-tool-item { flex: 0 0 calc(33.333% - 0.5rem); }
}

/* ==========================================================================
   BACKUP FORM — type selector cards & toggle
   ========================================================================== */

/* Hide the actual radio but keep it focusable for keyboard nav */
.type-radio {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.type-radio:focus-visible + .type-card {
  outline: 2px solid var(--symbio-primary); outline-offset: 2px;
}

/* Horizontal row of type cards */
.type-card-row { display: flex; gap: .5rem; margin-bottom: .75rem; }
.type-card-col { flex: 1; min-width: 0; }

/* Card-style label acting as a selectable card — horizontal layout */
.type-card {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem; border-radius: var(--symbio-radius);
  border: 1px solid var(--symbio-border);
  cursor: pointer; transition: .1s ease;
  background: var(--symbio-panel);
  user-select: none;
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
}
.type-card:hover { border-color: var(--symbio-primary); }
.type-radio:checked + .type-card {
  border-color: var(--symbio-primary);
  background: var(--symbio-primary-light);
}
.type-card .icon {
  font-size: 1.3rem; color: var(--symbio-primary);
  flex-shrink: 0; width: 1.5rem; text-align: center;
}
.type-card-text { display: flex; flex-direction: column; min-width: 0; }
.type-card-text strong { font-size: .82rem; line-height: 1.2; }
.type-card-text small {
  font-size: .68rem; color: var(--symbio-muted, #6c757d);
  line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* DB engine cards reuse type-card-row/col layout — just thinner */
.db-engine-card {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .65rem; border-radius: var(--symbio-radius);
  border: 1px solid var(--symbio-border);
  cursor: pointer; transition: .1s ease;
  background: var(--symbio-panel);
  user-select: none;
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
}
.db-engine-card:hover { border-color: var(--symbio-primary); }
.type-radio:checked + .db-engine-card {
  border-color: var(--symbio-primary);
  background: var(--symbio-primary-light);
}
.db-engine-card .icon { font-size: 1.1rem; flex-shrink: 0; color: var(--symbio-primary); }
.db-engine-card .type-card-text strong { font-size: .78rem; }
.db-engine-card .type-card-text small { font-size: .65rem; }

/* Indented app path checkboxes */
.app-group { margin-bottom: .4rem; }
.app-group .app-parent { font-weight: 600; }
.app-group .app-children { padding-left: 1.5rem; margin-top: .2rem; }
.app-group .app-children .form-check { margin-bottom: .1rem; }
.app-group .app-children .form-check-label { font-size: .85rem; }

/* Database tree checkboxes — expandable table lists per database (backup form) */
.db-group { margin-bottom: .5rem; }
.db-group .db-parent { font-weight: 600; }
.db-group .db-children { padding-left: 1.5rem; margin-top: .2rem; padding-top: .1rem; border-left: 2px solid var(--symbio-border, #dee2e6); }
.db-group .db-children .form-check { margin-bottom: .1rem; }
.db-group .db-children .form-check-label { font-size: .85rem; }
.db-group .db-children code { font-size: .8rem; background: var(--symbio-bg, #f8f9fa); padding: 1px 4px; border-radius: 3px; }

/* Service description muted text */
.service-desc {
  font-size: .75rem; color: var(--symbio-muted, #6c757d);
  margin-left: 1.55rem; line-height: 1.2;
}

@media (max-width: 576px) {
  .type-card-row { flex-direction: column; }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { border-right: 0; padding-bottom: .75rem; }
  .sidebar-header { align-items: center; display: flex; justify-content: space-between; }
  .sidebar-caption { margin: 0; }
  .sidebar-toggle { display: inline-block; margin: 0; }
  .sidebar-nav { display: none; padding-top: .45rem; }
  .js-enabled .sidebar:not(.is-collapsed) .sidebar-nav { display: block; }
  .sidebar .nav-link { padding-left: 1rem; }
  .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
  .topbar { min-height: 54px; }
  .user-name { display: none; }
}

@media (max-width: 480px) {
  .sidebar-caption { display: none; }
  .topbar-context small { display: none; }
  .content { padding-top: 1rem; }
  .h3, h1.h3 { font-size: 1.25rem; }
}

/* ==========================================================================
   DB HELP DETAILS
   ========================================================================== */
.db-help-details { display: inline-block; }
.db-help-details summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
}
.db-help-details summary::-webkit-details-marker { display: none; }

/* ==========================================================================
   AI CONTENT (Markdown rendering)
   ========================================================================== */
.ai-content h2 { font-size:1.2rem; margin:1.2rem 0 .5rem; font-weight:600; }
.ai-content h3 { font-size:1.05rem; margin:1rem 0 .4rem; font-weight:600; }
.ai-content p { margin-bottom:.75rem; }
.ai-content ul, .ai-content ol { padding-left:1.5rem; margin-bottom:.75rem; }
.ai-content li { margin-bottom:.25rem; }
.ai-content strong { font-weight:600; }
.ai-content code { font-size:.875em; background:var(--symbio-code-bg); padding:.1em .3em; border-radius:3px; }
.ai-content pre { background:var(--symbio-proof-bg); padding:.75rem; border-radius:4px; overflow-x:auto; margin-bottom:.75rem; }
.ai-content pre code { padding:0; background:none; font-size:.875em; }
.ai-content blockquote { border-left:3px solid var(--symbio-border); margin-left:0; padding:.25rem 1rem; color:var(--symbio-muted); }
.ai-content table { border-collapse:collapse; width:100%; margin-bottom:.75rem; }
.ai-content th, .ai-content td { border:1px solid var(--symbio-border); padding:.4rem .6rem; text-align:left; }
.ai-content th { background:var(--symbio-proof-bg); font-weight:600; }

/* ==========================================================================
   COMMAND CENTER
   ========================================================================== */
.btn-loading { position: relative; }
.btn-loading:disabled { pointer-events: none; }

/* ==========================================================================
   ACTION PROOF
   ========================================================================== */
.action-proof { font-size: .82rem; }
.action-proof summary { cursor: pointer; display: inline-block; }
.action-proof-body {
  background: var(--symbio-proof-bg);
  border: 1px solid var(--symbio-border);
  border-radius: var(--symbio-radius-sm);
  margin-top: .4rem;
  padding: .5rem .65rem;
}
.action-proof-pre {
  font: .78rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0 0 .3rem;
  overflow-x: auto;
  white-space: pre;
}

/* ==========================================================================
   NAV TABS (used on Settings page)
   ========================================================================== */
.nav-tabs {
  border-bottom: 2px solid var(--symbio-border);
  padding: 0;
}

.nav-tabs .nav-item { margin-bottom: -2px; }

.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--symbio-muted);
  font-size: .82rem;
  font-weight: 600;
  padding: .5rem 1rem;
  transition: color .15s, border-color .15s;
}

.nav-tabs .nav-link:hover {
  color: var(--symbio-heading);
  border-bottom-color: var(--symbio-border);
}

.nav-tabs .nav-link.active {
  color: var(--symbio-primary);
  border-bottom-color: var(--symbio-primary);
  background: transparent;
}

/* ==========================================================================
   THEME COLOR SWATCHES (Settings & Wizard)
   ========================================================================== */
.theme-option {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  vertical-align: middle;
  transition: border-color .15s, transform .15s;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,.1), 1px 1px 3px rgba(0,0,0,.08);
}

.theme-option:hover { -webkit-transform: scale(1.1); transform: scale(1.1); }

.theme-option-blue { background: #5b8cb8; }
.theme-option-red { background: #c97d7d; }
.theme-option-green { background: #6b9e7a; }

.theme-radio:checked + .theme-option {
  border-color: var(--symbio-heading);
  box-shadow: 0 0 0 3px var(--symbio-panel), 0 0 0 5px var(--symbio-primary);
}

/* Hide the actual radio but keep it accessible */
.theme-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* ── File Editor ── */

.file-editor-wrapper {
  display: flex;
  flex-direction: row;
  min-height: 200px;
  max-height: 75vh;
}
.file-editor-lines {
  font-family: "SF Mono", "Fira Code", "Consolas", "Liberation Mono", monospace !important;
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 1rem 0.5rem;
  text-align: right;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  white-space: pre;
  overflow: hidden;
  color: var(--symbio-muted);
  background: var(--symbio-badge-secondary-bg);
  border-right: 1px solid #d0d4da;
  min-width: 3rem;
  flex-shrink: 0;
}
.file-editor-textarea {
  flex: 1;
  padding: 1rem;
  font-family: "SF Mono", "Fira Code", "Consolas", "Liberation Mono", monospace !important;
  font-size: 0.82rem;
  line-height: 1.55;
  border: none;
  border-radius: 0;
  background: var(--symbio-file-editor-bg);
  color: var(--symbio-text);
  resize: vertical;
  -moz-tab-size: 2;
  tab-size: 2;
  outline: none;
}
.file-editor-textarea:focus {
  background: var(--symbio-table-row-hover);
  box-shadow: inset 0 0 0 2px var(--symbio-primary);
}

/* ── File Manager Actions ── */

.file-actions {
  opacity: 0.6;
  transition: opacity 0.15s;
}
.file-row:hover .file-actions { opacity: 1; }
.file-action-form {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.file-action-input {
  width: 5rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.35rem;
  height: 1.6rem;
}

/* ── File Viewer ── */

.file-viewer-pre {
  max-height: 600px;
  overflow: auto;
  font-family: "SF Mono", "Fira Code", "Consolas", "Liberation Mono", monospace !important;
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 1rem;
  background: var(--symbio-file-editor-bg);
  border-radius: 8px;
  border: 1px solid var(--symbio-border);
  contain: layout style paint;
}

/* ── content-visibility: auto for below-fold sections ── */
.log-output { content-visibility: auto; contain-intrinsic-size: 300px; }

/* ── Reduced box-shadows for lower GPU paint layer memory ── */
.sidebar-toggle { box-shadow: none; }
.badge { box-shadow: none; }
.wizard-step { box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.theme-option { box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.btn-primary { box-shadow: var(--symbio-shadow-btn); }
.btn-primary:hover,
.btn-primary:focus { box-shadow: 0 2px 6px rgba(0,0,0,.12); }
