:root {
  --text: #f4f7fc;
  --muted: #b8c4dc;
  --accent: #6b9bff;
  --accent-2: #8b7dff;
  --danger: #ff6b88;
  --ok: #4de0a8;
  --radius: 16px;
  --glass-bg: rgba(12, 18, 36, 0.42);
  --glass-bg-strong: rgba(10, 16, 32, 0.58);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --blur: blur(22px) saturate(165%);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: #060a14;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    url("assets/wallpaper/desktop.png") center / cover no-repeat,
    linear-gradient(160deg, #0a1020 0%, #121a30 45%, #060a14 100%);
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 75% 10%, rgba(107, 155, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 50% at 10% 90%, rgba(139, 125, 255, 0.12), transparent 50%),
    linear-gradient(180deg, rgba(6, 10, 20, 0.15), rgba(6, 10, 20, 0.72));
}

@media (max-width: 768px) {
  .bg-layer {
    background:
      url("assets/wallpaper/mobile.png") center / cover no-repeat,
      linear-gradient(160deg, #0a1020 0%, #121a30 45%, #060a14 100%);
  }
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-session {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.topbar-chip.muted { color: var(--muted); }

.mfa-send-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.mfa-cooldown-hint {
  margin: 0;
  font-size: 12px;
  text-align: center;
  color: #ffb347;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand img.brand-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.brand-text small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  margin-top: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 60px);
  align-items: stretch;
}

nav.side {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px);
  border-right: 1px solid var(--glass-border);
  padding: 14px 10px 16px;
  background: rgba(8, 12, 24, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.side-menu { flex: 0 0 auto; }

.side-spacer { flex: 1 1 auto; min-height: 16px; }

.side-footer {
  flex: 0 0 auto;
  margin-top: auto;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 14, 28, 0.55);
}

.side-footer-inner {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.side-footer-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  background: linear-gradient(145deg, rgba(107, 155, 255, 0.14), rgba(139, 125, 255, 0.08));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.side-footer-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.side-footer-hero-text { min-width: 0; flex: 1; }

.side-footer-legal {
  margin: 0;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
}

.side-footer-product {
  margin: 3px 0 0;
  font-size: 11px;
  color: #9ec0ff;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.side-footer-facts {
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-footer-facts li,
.side-footer-facts a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}

.side-footer-facts a {
  color: #9ec0ff;
  transition: color 0.15s ease;
}

.side-footer-facts a:hover { color: #c5d9ff; }

.side-footer-facts span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-footer-copy {
  margin: 0;
  padding: 8px 14px 12px;
  font-size: 10px;
  color: rgba(184, 196, 220, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  letter-spacing: 0.02em;
}

/* Material Symbols — 全域垂直對齊 */
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  line-height: 1;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
  vertical-align: middle;
}

.i .material-symbols-outlined { font-size: 1em; }

.i-sm { width: 18px; height: 18px; font-size: 18px; }
.i-md { width: 20px; height: 20px; font-size: 20px; }
.i-lg { width: 24px; height: 24px; font-size: 24px; }
.i-xl { width: 32px; height: 32px; font-size: 32px; }
.i-nav { width: 22px; height: 22px; font-size: 22px; opacity: 0.95; }

.nav-label {
  flex: 1;
  line-height: 1.3;
}

.h-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.h-with-icon.h-sm {
  font-size: 14px;
  font-weight: 600;
  gap: 6px;
}

.card-toolbar .h-with-icon { font-size: 16px; font-weight: 600; }

.pill-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
}

.btn > .i:first-child:last-child { margin: 0; }

.main-area { position: relative; }

nav.side button,
nav.side .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

nav.side button.active,
nav.side .nav-item.active,
nav.side button:hover,
nav.side .nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

main, .main-area { padding: 28px; }

/* Page loader */
.page-loader {
  position: fixed;
  inset: 60px 0 0 260px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(6, 10, 20, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.page-loader.loader-nonblocking {
  pointer-events: none;
  background: rgba(6, 10, 20, 0.28);
  justify-content: flex-start;
  padding-top: 22vh;
  overflow-y: visible;
}

.loader-logo {
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
  animation: loaderPulse 1.6s ease-in-out infinite;
}

.loader-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(107, 155, 255, 0.2);
  border-top-color: var(--accent);
  animation: loaderSpin 0.85s linear infinite;
}

.loader-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.06em;
}

@keyframes loaderSpin { to { transform: rotate(360deg); } }
@keyframes loaderPulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.card {
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 0;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input, select, textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select,
select.glass-select,
.field select {
  color-scheme: dark;
  background-color: rgba(12, 18, 36, 0.92);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9ec0ff 50%),
    linear-gradient(135deg, #9ec0ff 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 1px),
    calc(100% - 12px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

select option,
select optgroup {
  background-color: #121a30;
  color: var(--text);
  padding: 10px 12px;
}

input::placeholder { color: rgba(184, 196, 220, 0.65); }

textarea.glass-input {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(107, 155, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(107, 155, 255, 0.15);
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border: 1px solid transparent;
  transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:disabled,
button.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
button.btn:not(.btn-secondary):not(.btn-ghost):not(.danger) {
  background: linear-gradient(145deg, rgba(107, 155, 255, 0.95), rgba(139, 125, 255, 0.92));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 28px rgba(88, 120, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled),
button.btn:not(.btn-secondary):not(.btn-ghost):not(.danger):hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(88, 120, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: rgba(107, 155, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(107, 155, 255, 0.14);
  border-color: rgba(107, 155, 255, 0.65);
}

.btn-ghost,
button.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--glass-border);
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled),
button.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

button.btn.danger,
.btn-danger {
  background: linear-gradient(145deg, rgba(255, 107, 136, 0.95), rgba(255, 77, 109, 0.92));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 26px rgba(255, 107, 136, 0.28);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th { color: var(--muted); font-weight: 600; }

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
}

.pill.ok { color: var(--ok); border-color: rgba(77, 224, 168, 0.45); }
.pill.warn { color: var(--danger); border-color: rgba(255, 107, 136, 0.45); }

.login-shell,
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 16px;
  gap: 20px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px 26px 24px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.login-brand img {
  width: min(220px, 72vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.35));
}

.login-brand h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-width: 420px;
}

.site-footer p { margin: 0 0 4px; }

.site-footer a {
  color: #9ec0ff;
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

.site-footer .sep { margin: 0 6px; opacity: 0.5; }

.btn-block { width: 100%; }

.err { display: block; min-height: 1.2em; color: #ff8fa3; }

.login-step { animation: fadeIn 0.28s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin: 6px 0 4px;
}

.verify-panel {
  text-align: center;
  padding: 8px 4px 4px;
}

.login-mfa-row {
  text-align: left;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.login-mfa-row .field { margin-bottom: 10px; }

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-row input { accent-color: #6b9bff; }

.verify-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(145deg, rgba(107, 155, 255, 0.22), rgba(139, 125, 255, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.verify-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.verify-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.verify-desc strong {
  color: var(--text);
  font-weight: 600;
}

.otp-wrap {
  position: relative;
  margin: 0 auto 14px;
  max-width: 320px;
}

#otpInput {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.otp-cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.otp-cell {
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.otp-cell.filled {
  background: rgba(107, 155, 255, 0.12);
  border-color: rgba(107, 155, 255, 0.45);
}

.otp-cell.active {
  border-color: rgba(139, 125, 255, 0.75);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(88, 120, 255, 0.18);
}

#stepVerify.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.login-form input { width: 100%; }

#turnstileSlot { display: flex; justify-content: center; min-height: 65px; margin: 4px 0; }

.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 12px; line-height: 1.5; }
.link { color: #9ec0ff; text-decoration: none; }
.link:hover { text-decoration: underline; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 50;
}

.hidden { display: none !important; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* --- App shell / navigation --- */
nav.side .nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon { font-size: 15px; opacity: 0.9; }

.nav-group { margin-top: 8px; }

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.nav-group-toggle:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.nav-chevron {
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.2s ease;
}

.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-sub { display: none; }

.nav-sub { padding: 2px 0 4px 10px; }

.nav-sub-item {
  font-size: 13px !important;
  padding-left: 28px !important;
}

/* --- Page layout --- */
.page-header { margin-bottom: 22px; }

.page-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.page-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 720px;
  line-height: 1.55;
}

.breadcrumb { margin: -10px 0 16px; }

.page-loading { padding: 40px 8px; text-align: center; }

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1280px;
}

.page-stack-narrow { max-width: 720px; }
.page-stack-wide { max-width: 1400px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  min-height: 76px;
}

.kpi-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(107, 155, 255, 0.14);
  border: 1px solid rgba(107, 155, 255, 0.28);
  color: #b8d0ff;
}

.kpi-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.kpi-value.tone-ok { color: var(--ok); }
.kpi-value.tone-warn { color: var(--danger); }
.kpi-value.tone-info { color: #9ec0ff; }

.split-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

.detail-panel {
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 76px;
  min-height: 280px;
}

.detail-placeholder {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
}

.detail-placeholder-icon { font-size: 36px; margin-bottom: 10px; }

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.detail-head h2 {
  margin: 0;
  font-size: 17px;
}

.detail-meta {
  margin: 0 0 16px;
  display: grid;
  gap: 10px;
}

.detail-meta > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  font-size: 13px;
}

.detail-meta dt { color: var(--muted); margin: 0; }
.detail-meta dd { margin: 0; }

.detail-section {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
  margin-top: 14px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-toolbar h2 { margin: 0; }

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(107,155,255,0.18);
  color: #b8d0ff;
  margin-left: 6px;
}

.search-input {
  min-width: 220px;
  max-width: 100%;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select { width: 100%; }

.field-hint { font-size: 11px; color: var(--muted); }

.field-action { justify-content: flex-end; }

.form-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.form-section:last-of-type { border-bottom: 0; padding-bottom: 0; }

.form-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-actions { margin-top: 14px; }

.table-wrap { overflow-x: auto; }

.data-table tbody tr.row-clickable { cursor: pointer; }
.data-table tbody tr.selected { background: rgba(107,155,255,0.1); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.04); }

.cell-sub { margin-top: 3px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.wrap { word-break: break-all; }

.actions { white-space: nowrap; }

.btn-sm {
  padding: 7px 12px !important;
  font-size: 12px !important;
  border-radius: 9px !important;
}

.empty-cell,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 32px 16px !important;
  color: var(--muted);
  grid-column: 1 / -1;
}

.empty-state .i { color: rgba(184, 196, 220, 0.55); }

.empty-state p { margin: 0; }

.pill.info { color: #9ec0ff; border-color: rgba(158,192,255,0.45); }
.pill.accent { color: #b8d0ff; border-color: rgba(107,155,255,0.45); background: rgba(107,155,255,0.12); }

/* --- Billing plans --- */
.model-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.model-card {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.model-card input { position: absolute; opacity: 0; pointer-events: none; }

.model-card.selected,
.model-card:has(input:checked) {
  border-color: rgba(107,155,255,0.55);
  background: rgba(107,155,255,0.12);
}

.model-card-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.model-card-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.plan-card {
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.14s ease;
}

.plan-card:hover {
  border-color: rgba(107, 155, 255, 0.4);
  background: rgba(107, 155, 255, 0.08);
  transform: translateY(-1px);
}

.glass-inner { backdrop-filter: blur(10px); }

.plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.plan-card-head h3 { margin: 0; font-size: 16px; }
.plan-card-id { margin: 0 0 8px; color: var(--muted); }

.plan-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 12px 0;
  font-size: 13px;
}

.plan-metrics dt { color: var(--muted); margin: 0; }
.plan-metrics dd { margin: 0; font-weight: 600; }

/* --- MFA extension --- */
.mfa-status-card {
  text-align: center;
  padding: 28px 20px;
}

.mfa-status-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: #9ec0ff;
}

.mfa-badges-center {
  justify-content: center;
  margin-top: 12px;
}

.form-row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.form-row-inline input {
  flex: 0 1 160px;
  min-width: 120px;
  max-width: 200px;
}

.ext-dev-panel .card-toolbar { margin-bottom: 8px; }

.mfa-secret-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.08);
}

.copy-row {
  display: flex;
  gap: 8px;
}

.copy-row input { flex: 1; }

/* Overview */
.overview-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.overview-map {
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(107, 155, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 1;
  background: #0a1020;
}

.map-pin-wrap { background: transparent; border: 0; }

.map-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(107, 155, 255, 0.25);
  border: 2px solid rgba(158, 192, 255, 0.85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.map-pin-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ec0ff;
}

.map-pin-ok {
  background: rgba(77, 224, 168, 0.2);
  border-color: rgba(77, 224, 168, 0.85);
}

.map-pin-ok .map-pin-core { background: var(--ok); }

.map-popup strong { color: #f4f7fc; }
.map-popup .muted { color: #b8c4dc; font-size: 12px; }

.leaflet-container { font-family: inherit; background: #0a1020; }
.leaflet-popup-content-wrapper {
  background: rgba(12, 18, 36, 0.92);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
}
.leaflet-popup-tip { background: rgba(12, 18, 36, 0.92); }

.map-hint { margin: 10px 0 0; }
.status-stack { display: flex; flex-direction: column; gap: 14px; }
.status-dl { margin: 0; display: grid; gap: 10px; font-size: 13px; }
.status-dl > div { display: grid; grid-template-columns: 100px 1fr; gap: 8px; }
.status-dl dt { color: var(--muted); margin: 0; }
.status-dl dd { margin: 0; }

/* Companies */
.company-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  align-items: start;
}

.company-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.company-card {
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
}

.company-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.company-card-head h3 { margin: 0; font-size: 15px; }
.company-card-meta { margin: 0 0 12px; font-size: 12px; display: grid; gap: 6px; }
.company-card-meta > div { display: grid; grid-template-columns: 72px 1fr; gap: 6px; }
.company-card-meta dt { color: var(--muted); margin: 0; }
.company-card-meta dd { margin: 0; }
.company-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.field.span-2 { grid-column: span 2; }
.form-grid .span-2 { grid-column: span 2; }

/* Plans line items */
.plan-editor-layout { display: grid; gap: 16px; }
.line-items-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.line-items-list { display: flex; flex-direction: column; gap: 10px; }
.line-item-row {
  display: grid;
  grid-template-columns: minmax(100px, 1.2fr) minmax(120px, 1.3fr) repeat(3, minmax(90px, 1fr)) 32px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.08);
}

.line-item-row .span-2 { grid-column: span 2; }

.line-item-del {
  align-self: center;
  justify-self: center;
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 6px !important;
  flex-shrink: 0;
}
.line-items-preview { margin: 10px 0; padding: 0; list-style: none; font-size: 13px; }
.line-items-preview li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.card-toolbar.tight { margin-bottom: 10px; }
.card-toolbar.tight h3 { margin: 0; font-size: 14px; }

/* Extensions */
.ext-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ext-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.ext-row-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 125, 255, 0.12);
  border: 1px solid rgba(139, 125, 255, 0.28);
  color: #d8d2ff;
}

.ext-row-body { min-width: 0; }
.ext-row-body h3 { margin: 0 0 6px; font-size: 15px; }
.ext-row-body p { margin: 0 0 8px; }
.ext-row-action { flex-shrink: 0; align-self: center; }

.breadcrumb-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

/* Accounts */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.accounts-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.accounts-table-card { width: 100%; }

.profile-hero-card { padding: 0; overflow: hidden; }

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(107, 155, 255, 0.12), rgba(139, 125, 255, 0.06));
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: #9ec0ff;
  flex-shrink: 0;
}

.profile-hero-text { flex: 1; min-width: 200px; }
.profile-hero-text h2 { margin: 0 0 4px; font-size: 18px; }
.profile-hero-text p { margin: 0 0 8px; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.mfa-method-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.mfa-panel { margin-top: 4px; }
.mfa-panel-compact { padding-top: 4px; }

.input-suffix-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-suffix-wrap input { flex: 1; min-width: 0; }

.input-suffix {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.nowrap { white-space: nowrap; }

.log-table td { vertical-align: middle; }

.log-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-entry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
}

.log-entry.log-auth {
  border-color: rgba(107, 155, 255, 0.25);
  background: rgba(107, 155, 255, 0.06);
}

.log-entry-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: #9ec0ff;
}

.log-entry-body { flex: 1; min-width: 0; }

.log-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.log-entry-head strong { font-size: 14px; }

.log-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  font-size: 13px;
}

.log-actor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.plan-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.plan-card-meta { margin: 0 0 8px; }
.plan-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.assign-plan-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.store-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 70vh;
  overflow-y: auto;
}

.store-edit-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.store-edit-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.store-edit-item summary::-webkit-details-marker { display: none; }

.mfa-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1.15fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.mfa-editor-main {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}


.mfa-config-fields-box,
.mfa-secrets-box {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

#mfaConfigFieldsMount,
#mfaSecretsFields {
  min-width: 0;
  max-width: 100%;
}

#mfaConfigFieldsMount .field,
#mfaSecretsFields .field {
  min-width: 0;
}

#mfaConfigFieldsMount input,
#mfaSecretsFields input {
  max-width: 100%;
  box-sizing: border-box;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.guide-table th,
.guide-table td {
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 10px;
  text-align: left;
}

.guide-body blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(107, 155, 255, 0.08);
}

.guide-body h1 { font-size: 1.35rem; margin: 0 0 12px; }
.guide-body h2 { font-size: 1.15rem; margin: 18px 0 10px; color: var(--text); }
.guide-body h3 { font-size: 1rem; margin: 14px 0 8px; color: var(--text); }
.guide-body h4 { font-size: 0.95rem; margin: 12px 0 6px; }

.page-stack-wide {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.page-stack-wide .mfa-editor-layout {
  max-width: 100%;
}

.mfa-monaco-mount {
  height: 420px;
  margin: 14px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.mfa-code-fallback {
  width: 100%;
  height: 420px;
  margin: 0;
  padding: 12px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #e8ecf4;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  resize: vertical;
  box-sizing: border-box;
}

.mfa-test-panel {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.mfa-test-output {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.5;
  max-height: 160px;
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  box-sizing: border-box;
}

.mfa-guide-md {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  max-height: none;
  overflow-y: visible;
  padding: 4px 12px 24px 4px;
}

.mfa-editor-docs {
  position: sticky;
  top: 12px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.mfa-test-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
  max-width: 100%;
}

.mfa-test-step {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.mfa-test-step .field input {
  max-width: 100%;
  box-sizing: border-box;
}

.totp-qr-modal-inner {
  text-align: center;
  max-width: 340px;
  margin: 0 auto;
}

.totp-qr-modal-inner .modal-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.totp-qr-modal-inner .center {
  text-align: center;
}

.totp-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.totp-qr-wrap canvas {
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: 100%;
  height: auto;
}

.totp-qr-modal-inner .copy-row {
  margin-top: 12px;
}

.mfa-binding-card {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 12px;
}

.mfa-test-step h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.plan-offer-group {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-code-block {
  margin: 10px 0;
}

.mfa-guide-md h2, .mfa-guide-md h3, .mfa-guide-md h4 {
  color: var(--text);
  margin: 14px 0 8px;
}

.mfa-guide-md code, .mfa-guide-md pre {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 12px;
}

.mfa-guide-md pre {
  padding: 12px;
  overflow-x: auto;
}

.mfa-editor-meta { margin-bottom: 8px; }

@media (max-width: 1100px) {
  .mfa-editor-layout { grid-template-columns: 1fr; }
  .mfa-test-steps { grid-template-columns: 1fr; }
  .mfa-editor-docs { position: static; max-width: 100%; }
}
.step-up-box {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(107,155,255,0.08);
  border: 1px solid rgba(107,155,255,0.25);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.step-up-box h4 { margin: 0 0 6px; font-size: 14px; }

.step-up-grid {
  min-width: 0;
}

.step-up-grid .field input,
.step-up-grid .glass-select {
  max-width: 100%;
  box-sizing: border-box;
}

.step-up-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.step-up-status {
  flex: 1 1 100%;
  min-height: 1.2em;
}

.step-up-status:empty {
  display: none;
}

.step-up-step.hidden { display: none; }

.step-up-hint { margin: 0 0 10px; min-height: 1.2em; }

.mfa-bind-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.bind-step.hidden { display: none; }

.dunning-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.dunning-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.dunning-row input[type="checkbox"] { flex-shrink: 0; }

.dunning-row-body { display: flex; flex-direction: column; gap: 2px; }

.dunning-log-groups { display: flex; flex-direction: column; gap: 10px; }

.dunning-log-group summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.dunning-log-items {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.dunning-log-items li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.report-list {
  margin: 8px 0 16px;
  padding-left: 18px;
  font-size: 13px;
}

.warn-card {
  border-color: rgba(255, 179, 71, 0.35) !important;
}

.dunning-row-warn {
  border-color: rgba(255, 179, 71, 0.35);
  opacity: 0.92;
}

.side-session {
  margin: 8px 10px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.side-session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--muted);
}

.side-session-row strong { color: var(--text); }

.payment-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
  width: 100%;
}

.payment-editor-main,
.payment-editor-docs {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.payment-editor-docs {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.voucher-id-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
  word-break: break-all;
  font-size: 13px;
}

.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }

@media (max-width: 1100px) {
  .payment-editor-layout { grid-template-columns: 1fr; }
  .payment-editor-docs { position: static; max-height: none; }
}

.verify-realm-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  color: #b8d0ff;
  background: rgba(107, 155, 255, 0.12);
  border: 1px solid rgba(107, 155, 255, 0.28);
}

.login-mfa-row .glass-select,
.login-mfa-row input {
  width: 100%;
  box-sizing: border-box;
}
.mfa-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.danger-text { color: #ff8fa3 !important; }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 60; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius);
  padding: 20px;
}

.modal-card-wide {
  width: min(960px, 100%);
}

.plan-modal-body .line-items-section {
  max-height: min(50vh, 420px);
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h2 { margin: 0; font-size: 17px; }

.status-card h3 { margin: 0 0 12px; font-size: 15px; }

@media (max-width: 1100px) {
  .split-layout { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
  .kpi-grid,
  .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-picker { grid-template-columns: 1fr 1fr; }
  .company-layout { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .accounts-grid { grid-template-columns: 1fr; }
  .line-item-row { grid-template-columns: 1fr 1fr; }
  .page-loader { inset: 60px 0 0 0; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  nav.side {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--glass-border);
  }
  nav.side .side-menu { display: flex; gap: 6px; overflow-x: auto; flex: 1; }
  nav.side .side-spacer { display: none; }
  nav.side .side-footer { display: none; }
  nav.side .nav-item { width: auto; white-space: nowrap; }
  .ext-row { grid-template-columns: 1fr; }
  .ext-row-action { justify-self: start; }
  .grid2 { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .model-picker { grid-template-columns: 1fr; }
  .kpi-grid,
  .kpi-grid-4 { grid-template-columns: 1fr; }
  .line-item-row { grid-template-columns: 1fr; }
  .card-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-filters { width: 100%; }
  .search-input { min-width: 0; width: 100%; }
}
