/* admin.css — minimal, system fonts, no framework */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
  position: relative;
  min-height: 100vh;
}

/* ── Background image layer — rendered FIRST in the DOM, so it
   paints behind .login-screen/.dashboard via normal stacking order.
   Avoiding negative z-index on purpose — it's fragile across
   stacking contexts and was the likely cause of the image not
   showing on the login page. position:fixed keeps it covering the
   full viewport without scrolling. ── */

.page-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(248, 250, 252, 0.85), rgba(248, 250, 252, 0.85)),
    url("/static/ev_bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.hidden { display: none !important; }
.muted { color: #94a3b8; font-size: 12px; }
.error-text { color: #dc2626; font-size: 13px; margin-top: 8px; }

/* ── Login ──────────────────────────────────────── */

.login-screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px;
  width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.login-logo {
  display: block;
  width: 260px;
  height: 110px;
  object-fit: contain;
  object-position: center;
  margin: 0 auto 14px;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p { margin-bottom: 20px; }

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  outline: none;
}

.login-card input:focus { border-color: #16a34a; }

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 40px;
}

.login-card .eye-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card .eye-toggle:hover { background: none; color: #475569; }

.login-card button {
  width: 100%;
  padding: 11px;
  background: #16a34a;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
}

.login-card button:hover { background: #15803d; }

/* ── Dashboard ──────────────────────────────────── */

.dashboard {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

header h1 { font-size: 22px; font-weight: 800; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-logo {
  display: block;
  width: 170px;
  height: 72px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

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

.btn-secondary {
  padding: 8px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover { background: #f1f5f9; }

.button-loading {
  position: relative !important;
  color: transparent !important;
  pointer-events: none !important;
  cursor: wait !important;
}
.button-loading > * { visibility: hidden !important; }
.button-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(100, 116, 139, .3);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: button-spin .65s linear infinite;
}
.btn-primary.button-loading::after,
.gateway-save-button.button-loading::after,
.gateway-action-primary.button-loading::after,
.login-card button[type="submit"].button-loading::after {
  border-color: rgba(255,255,255,.38);
  border-top-color: #fff;
}
@keyframes button-spin { to { transform: rotate(360deg); } }

.btn-page {
  padding: 6px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
}

.btn-page:hover:not(:disabled) { background: #f1f5f9; }
.btn-page:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-page.active { background: #16a34a; color: white; border-color: #16a34a; }

/* ── Summary strip ──────────────────────────────── */

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
}

.summary-label { font-size: 12px; color: #94a3b8; margin-bottom: 6px; }
.summary-value { font-size: 26px; font-weight: 800; }

.ml-health-status {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: #f8fafc;
}

.ml-ready { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.ml-not-ready { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.ml-unavailable { color: #991b1b; background: #fef2f2; border-color: #fecaca; }

.ml-interpretation {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc, #fff);
}

.ml-interpretation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.ml-section-kicker {
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ml-interpretation h3 { font-size: 19px; }
.ml-interpretation h4 { margin-bottom: 8px; font-size: 13px; }
.ml-interpretation-summary { color: #334155; line-height: 1.55; }

.ml-risk-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 11px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ml-risk-low { background: #dcfce7; color: #166534; }
.ml-risk-medium { background: #fef3c7; color: #92400e; }
.ml-risk-high { background: #ffedd5; color: #9a3412; }
.ml-risk-critical { background: #fee2e2; color: #991b1b; }

.ml-interpretation-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.ml-interpretation-metric {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.ml-interpretation-metric span,
.ml-interpretation-metric small { display: block; color: #64748b; font-size: 11px; }
.ml-interpretation-metric strong { display: block; margin: 5px 0; font-size: 18px; }

.ml-interpretation-details {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}

.ml-interpretation-details > div {
  border-top: 1px solid #e2e8f0;
  padding-top: 13px;
}

.ml-interpretation-details ul { padding-left: 18px; color: #475569; line-height: 1.6; }
.ml-interpretation-details p { color: #475569; line-height: 1.55; }

.ml-model-caveat {
  margin-top: 14px;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  line-height: 1.5;
}

.ml-test-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.ml-test-grid label { display: block; font-weight: 700; margin: 0 0 6px; }
.ml-test-grid select { width: 100%; }

.ml-model-selector {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.ml-model-select-field { flex: 1; min-width: 0; }
.ml-sample-button { flex: 0 0 auto; white-space: nowrap; }

.ml-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.ml-editor-heading label { margin: 0; }

.ml-editor-actions { display: inline-flex; gap: 6px; }

.ml-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.ml-icon-button:hover { background: #f1f5f9; color: #0f172a; }
.ml-icon-button:disabled { opacity: 0.55; cursor: wait; }
.ml-icon-button.ml-action-success { color: #15803d; border-color: #86efac; }

.ml-json-editor,
.ml-json-response {
  width: 100%;
  height: 520px;
  min-height: 520px;
  max-height: 520px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: auto;
  white-space: pre-wrap;
}

.ml-json-editor { resize: none; margin-bottom: 10px; }

.ml-page-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

.ml-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
}

.ml-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #bbf7d0;
  border-top-color: #16a34a;
  border-radius: 999px;
  animation: ml-spin 0.75s linear infinite;
}

.ml-control-header { align-items: end; }
.ml-control-header select { min-width: 300px; }
.ml-control-message { margin: 14px 0; min-height: 20px; }
.ml-control-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
.ml-control-card { background: #f8fafc; border: 1px solid #dbe4ef; border-radius: 14px; padding: 18px; display: grid; gap: 8px; }
.ml-control-card span, .ml-control-card small { color: #64748b; }
.ml-control-card strong { font-size: 20px; color: #0f172a; }
.ml-control-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.ml-control-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.status-active { color: #15803d; font-weight: 700; }
.ml-control-note { border-left: 4px solid #0ea5e9; background: #eff6ff; border-radius: 8px; padding: 14px; color: #334155; line-height: 1.5; }
.ml-control-table-wrap { margin-top: 18px; }
.ml-control-table-wrap code { font-size: 11px; }
@media (max-width: 800px) { .ml-control-summary { grid-template-columns: 1fr; } .ml-control-header select { min-width: 0; width: 100%; } }

.ml-button-loading { position: relative; color: transparent !important; pointer-events: none; }
.ml-button-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: calc(50% - 8px);
  top: calc(50% - 8px);
  border: 2px solid rgba(100, 116, 139, 0.35);
  border-top-color: #16a34a;
  border-radius: 999px;
  animation: ml-spin 0.7s linear infinite;
}

@keyframes ml-spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
  .ml-test-grid { grid-template-columns: 1fr; }
  .ml-interpretation-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ml-interpretation-details { grid-template-columns: 1fr; }
  .ml-json-editor,
  .ml-json-response { height: 420px; min-height: 420px; max-height: 420px; }
}

/* ── Panels ─────────────────────────────────────── */

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-header h2 { font-size: 15px; font-weight: 700; }

.panel-header input {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  min-width: 220px;
}

.panel-header input:focus { border-color: #16a34a; }

.btn-primary {
  padding: 9px 16px;
  background: #16a34a;
  border: 1px solid #16a34a;
  border-radius: 10px;
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover { background: #15803d; border-color: #15803d; }

label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 12px 0 6px;
}

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

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.review-grid-wide {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.review-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
}

.review-card h3 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 8px;
}

.review-card input,
.review-card select,
.review-card textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  background: white;
  color: #0f172a;
}

.review-card textarea {
  resize: vertical;
  min-height: 76px;
}

.review-card input:focus,
.review-card select:focus,
.review-card textarea:focus {
  border-color: #16a34a;
}

.review-card .btn-primary,
.review-card .btn-secondary {
  margin-top: 12px;
  margin-right: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.inline-check input {
  width: auto;
}

.result-line {
  min-height: 18px;
  margin-top: 10px;
  font-weight: 700;
}

.review-help-text {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.review-selected-notice {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: white;
  font-weight: 700;
}

.review-selected-notice.active {
  border-style: solid;
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.review-link-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  word-break: break-all;
}

.review-engagement-box {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  color: #334155;
}

.review-feedback-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.review-feedback-item {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.mini-header {
  margin-bottom: 8px;
}

.mini-header h3 {
  margin-bottom: 0;
}

.vehicle-check-list {
  max-height: 330px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.vehicle-check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  padding: 10px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.vehicle-check-row input {
  width: auto;
  margin-top: 3px;
}

.vehicle-check-row .muted {
  display: block;
  margin-top: 3px;
}

.compact-table table {
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  padding: 10px 8px;
  vertical-align: top;
}

.workspace-actions {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.selected-row {
  background: #f0fdf4;
}

/* ── Tables ─────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead tr {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.03em;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Pagination ─────────────────────────────────── */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pager .pager-info {
  font-size: 12px;
  color: #94a3b8;
  margin-right: 8px;
}

/* ── Badges ─────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green { background: #f0fdf4; color: #16a34a; }
.badge-red   { background: #fef2f2; color: #dc2626; }
.badge-amber { background: #fffbeb; color: #d97706; }
.badge-blue  { background: #eff6ff; color: #2563eb; }
.badge-gray  { background: #f1f5f9; color: #64748b; }

/* ── MRR progress ───────────────────────────────── */

.mrr-progress { margin-bottom: 16px; }

.mrr-label { font-size: 13px; margin-bottom: 8px; }

.mrr-bar-bg {
  width: 100%;
  height: 10px;
  background: #f1f5f9;
  border-radius: 100px;
  overflow: hidden;
}

.mrr-bar-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 100px;
  transition: width 0.3s ease;
}

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 800px) {
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  header {
    align-items: flex-start;
    flex-direction: column;
  }
  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .header-logo {
    width: 118px;
    height: 50px;
  }
}

/* ── Support tickets — filter selects ────────────── */

.panel-header select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  background: white;
  color: #0f172a;
}

.panel-header select:focus { border-color: #16a34a; }

/* ── Priority badges ──────────────────────────────── */

.badge-priority-low      { background: #f1f5f9; color: #64748b; }
.badge-priority-medium   { background: #eff6ff; color: #2563eb; }
.badge-priority-high     { background: #fffbeb; color: #d97706; }
.badge-priority-critical { background: #fef2f2; color: #dc2626; }

/* ── Status badges ────────────────────────────────── */

.badge-status-open             { background: #eff6ff; color: #2563eb; }
.badge-status-in_progress      { background: #fffbeb; color: #d97706; }
.badge-status-waiting_customer { background: #f5f3ff; color: #7c3aed; }
.badge-status-resolved         { background: #f0fdf4; color: #16a34a; }
.badge-status-closed           { background: #f1f5f9; color: #64748b; }

.row-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}

.row-link:hover { text-decoration: underline; }
.danger-link { color: #dc2626; }

/* ── Ticket detail modal ──────────────────────────── */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 { font-size: 17px; font-weight: 700; margin-top: 2px; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.ticket-description {
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 18px;
  white-space: pre-wrap;
}

.modal-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.modal-controls label {
  display: block;
  font-size: 11px;
  margin-bottom: 4px;
}

.modal-controls select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
}

.ticket-attachments {
  margin: 0 0 18px;
}

.ticket-attachments h4,
.comments-section h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
  color: #475569;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.attachment-pill > span:first-child {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-actions {
  display: inline-flex;
  gap: 4px;
}

.attachment-actions button {
  border: none;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  cursor: pointer;
}

.comments-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.comment-timeline {
  position: relative;
  padding-left: 22px;
}

.comment-timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #e2e8f0;
}

.comment {
  position: relative;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.comment::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 14px;
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px #e2e8f0;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.comment-body {
  white-space: pre-wrap;
  color: #334155;
  font-weight: 600;
}

.comment-internal,
.comment-admin {
  border-left: 3px solid #2563eb;
  background: #eff6ff;
}

.comment-customer {
  border-left: 3px solid #16a34a;
  background: #f0fdf4;
}

.comment-admin::before { background: #2563eb; }
.comment-customer::before { background: #16a34a; }

.comment-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.comment-tag-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.comment-tag-customer {
  background: #dcfce7;
  color: #15803d;
}

.comment-attachments {
  margin-top: 10px;
}

.comment-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.comment-form { margin-top: 14px; }

.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.comment-form textarea:focus { border-color: #16a34a; }

.comment-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 10px;
  flex-wrap: wrap;
}

.char-count {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 800;
  margin-left: auto;
}

.visibility-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}
/* ── Gateway Operations ─────────────────────────── */
.gateway-admin-page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.gateway-page-header {
  margin: 0 0 20px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.gateway-page-header .header-logo { width: 142px; height: 56px; }
.gateway-page-header h1 { margin-top: 2px; font-size: 24px; line-height: 1.1; }
.gateway-page-header .brand-lockup p { margin-top: 5px; color: #64748b; font-size: 13px; }
.gateway-eyebrow,.gateway-panel-label {
  color: #059669;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.btn-icon-text,.btn-quiet-danger {
  padding: 8px 13px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-icon-text span { margin-right: 4px; font-size: 17px; vertical-align: -1px; }
.btn-icon-text:hover { background: #f1f5f9; }
.btn-quiet-danger { color: #be123c; border-color: #ffe4e6; background: #fff7f8; }
.btn-quiet-danger:hover { background: #ffe4e6; }

.gateway-alert {
  display: none;
  margin-bottom: 16px;
  padding: 12px 15px;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  background: #fff1f2;
  color: #be123c;
  font-size: 13px;
  font-weight: 700;
}
.gateway-alert.visible { display: block; }

.gateway-workspace-bar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 560px);
  align-items: center;
  gap: 24px;
  padding: 17px 20px;
  margin-bottom: 18px;
  background: rgba(240, 253, 247, 0.9);
  border: 1px solid #a7f3d0;
  border-radius: 16px;
}
.gateway-workspace-copy { display: flex; align-items: center; gap: 12px; }
.gateway-workspace-copy strong { display: block; font-size: 14px; }
.gateway-workspace-copy small { display: block; margin-top: 3px; color: #64748b; font-size: 12px; }
.gateway-section-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #d1fae5;
  color: #047857;
  font-size: 20px;
  flex: 0 0 auto;
}
.gateway-workspace-bar select,.gateway-form input,.gateway-form select,.gateway-form textarea,.gateway-filters input,.gateway-filters select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  outline: none;
}
.gateway-workspace-bar select:focus,.gateway-form input:focus,.gateway-form select:focus,.gateway-form textarea:focus,.gateway-filters input:focus,.gateway-filters select:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .11);
}

.gateway-package-bar {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(260px, .8fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 15px 18px;
  background: rgba(255,255,255,.96);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}
.gateway-package-summary { display:flex; align-items:center; gap:12px; min-width:0; }
.gateway-package-summary>div { display:grid; gap:4px; min-width:0; }
.gateway-package-summary strong { overflow:hidden; font-size:13px; text-overflow:ellipsis; white-space:nowrap; }
.gateway-package-summary small { color:#64748b; font-size:10px; text-transform:capitalize; }
.gateway-package-icon { display:grid; place-items:center; width:38px; height:38px; border-radius:11px; background:#eff6ff; color:#2563eb; font-size:23px; flex:0 0 auto; }
.gateway-package-checksum { display:grid; gap:4px; min-width:0; }
.gateway-package-checksum small { color:#94a3b8; font-size:9px; font-weight:900; letter-spacing:.06em; }
.gateway-package-checksum code { overflow:hidden; color:#475569; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.gateway-package-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.gateway-package-modal-card { max-width:900px; }
.gateway-package-modal-card .modal-header p { margin-top:5px; color:#64748b; font-size:11px; }
.gateway-modal-close { display:grid; place-items:center; width:34px; height:34px; border:1px solid #e2e8f0; border-radius:9px; background:#fff; color:#64748b; font-size:25px; cursor:pointer; }
.gateway-package-modal-body { display:grid; gap:22px; }
.gateway-package-upload { display:grid; grid-template-columns:1fr 1fr; gap:13px; padding:17px; border:1px solid #dbe3ef; border-radius:13px; background:#f8fafc; }
.gateway-package-upload label { display:grid; gap:6px; color:#475569; font-size:10px; font-weight:900; letter-spacing:.04em; text-transform:uppercase; }
.gateway-package-upload input,.gateway-package-upload select,.gateway-package-upload textarea { width:100%; padding:10px 12px; border:1px solid #dbe3ef; border-radius:9px; background:#fff; color:#0f172a; font:inherit; font-size:12px; letter-spacing:0; text-transform:none; }
.gateway-package-wide { grid-column:1/-1; }
.gateway-package-upload-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.gateway-package-upload-footer small { color:#64748b; font-size:10px; font-weight:600; line-height:1.45; letter-spacing:0; text-transform:none; }
.gateway-package-history-heading { display:flex; align-items:end; justify-content:space-between; gap:12px; }
.gateway-package-history-heading h3 { margin-top:4px; font-size:16px; }
.gateway-package-history { display:grid; gap:10px; }
.gateway-package-release { padding:14px; border:1px solid #e2e8f0; border-radius:12px; background:#fff; }
.gateway-package-release.active { border-color:#6ee7b7; background:#f0fdf7; }
.gateway-package-release-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.gateway-package-release-head>div { display:grid; gap:4px; min-width:0; }
.gateway-package-release-head strong { font-size:13px; }
.gateway-package-release-head small { color:#64748b; font-size:10px; }
.gateway-package-release-actions { display:flex; gap:7px; flex:0 0 auto; }
.gateway-package-manifest { margin-top:11px; }
.gateway-package-manifest summary { color:#047857; font-size:10px; font-weight:900; cursor:pointer; }
.gateway-package-manifest ul { display:grid; gap:4px; max-height:190px; margin:9px 0 0; padding:10px 10px 10px 27px; overflow:auto; border-radius:9px; background:#f8fafc; color:#475569; font:10px ui-monospace,SFMono-Regular,Menlo,monospace; }
.gateway-updated-by { display:block; margin-top:7px; color:#64748b; font-size:10px; font-weight:800; text-align:right; }

.gateway-layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}
.gateway-list-panel,.gateway-detail-panel {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.055);
}
.gateway-list-panel { padding: 18px; }
.gateway-detail-panel { min-height: 620px; padding: 24px; }
.section-heading,.gateway-detail-heading,.gateway-title-line,.gateway-subheading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.section-heading h2,.gateway-detail-heading h2 { margin-top: 5px; font-size: 20px; line-height: 1.2; }
.section-heading p { margin-top: 4px; color: #94a3b8; font-size: 12px; }
.gateway-register-button { white-space: nowrap; }
.gateway-register-button span { margin-right: 4px; font-size: 18px; font-weight: 400; }

.gateway-filters { display: grid; gap: 9px; margin: 16px 0; }
.gateway-list { display: grid; gap: 9px; }
.gateway-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 13px 14px;
  text-align: left;
  border: 1px solid #dbe3ef;
  border-radius: 13px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.gateway-row:hover { border-color: #6ee7b7; background: #f5fdf9; }
.gateway-row.selected { border-color: #10b981; background: #ecfdf5; box-shadow: 0 0 0 2px rgba(16,185,129,.08); }
.gateway-row-title,.gateway-row-side { display: grid; gap: 6px; min-width: 0; }
.gateway-row-title strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.gateway-row-title small { overflow: hidden; color: #64748b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.gateway-row-side { justify-items: end; }
.gateway-row-side small { color: #64748b; font-size: 10px; }
.gateway-badge { display: inline-flex; width: fit-content; border-radius: 999px; padding: 4px 9px; font-size: 9px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.gateway-badge.active { color:#087f5b; background:#dcfce7; }
.gateway-badge.pending { color:#9a6700; background:#fff7d6; }
.gateway-badge.suspended,.gateway-badge.revoked { color:#c1123f; background:#fff0f3; }
.gateway-list-empty { display: grid; place-items: center; gap: 6px; min-height: 230px; padding: 28px; text-align: center; border: 1px dashed #cbd5e1; border-radius: 14px; color: #64748b; }
.gateway-list-empty span { color: #cbd5e1; font-size: 34px; }
.gateway-list-empty strong { color: #334155; }
.gateway-list-empty small { line-height: 1.5; }
.gateway-pager { display:flex; justify-content:center; align-items:center; gap:10px; min-height: 38px; margin-top:16px; color:#64748b; font-size:11px; }
.gateway-page-button { display:grid; place-items:center; width:30px; height:30px; border:1px solid #e2e8f0; border-radius:8px; background:#fff; color:#334155; font-size:20px; cursor:pointer; }
.gateway-page-button:hover:not(:disabled) { background:#f1f5f9; }
.gateway-page-button:disabled { opacity:.35; cursor:not-allowed; }

.gateway-empty-state { display:grid; place-content:center; justify-items:center; gap:8px; min-height:570px; text-align:center; }
.gateway-empty-state span { display:grid; place-items:center; width:64px; height:64px; margin-bottom:4px; border-radius:18px; background:#ecfdf5; color:#059669; font-size:30px; }
.gateway-empty-state h2 { font-size:20px; }
.gateway-empty-state p { max-width:460px; color:#64748b; font-size:13px; line-height:1.55; }
.gateway-detail-heading { align-items:center; padding-bottom:18px; border-bottom:1px solid #eef2f7; }
.gateway-detail-heading p { margin-top:6px; color:#64748b; font-size:12px; }
.gateway-detail-heading p code { color:#475569; font-size:11px; }
.gateway-title-line { justify-content:flex-start; align-items:center; margin-top:5px; }
.gateway-detail-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.gateway-security-note { display:flex; gap:12px; margin:18px 0; padding:13px 15px; border:1px solid #fde68a; border-radius:12px; background:#fffbeb; color:#92400e; }
.gateway-security-note>span { font-size:21px; }
.gateway-security-note strong { font-size:12px; }
.gateway-security-note p { margin-top:3px; font-size:11px; line-height:1.5; }

.gateway-form { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.gateway-surface { margin-top:18px; padding:18px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:14px; }
.gateway-form label { display:grid; gap:6px; margin:0; color:#475569; font-size:10px; font-weight:900; }
.gateway-form label span { color:#94a3b8; font-weight:700; text-transform:none; }
.gateway-form textarea { min-height:122px; resize:vertical; line-height:1.5; }
.gateway-field-wide,.gateway-form-footer { grid-column:1/-1; }
.gateway-form label small { color:#94a3b8; font-size:10px; font-weight:600; letter-spacing:0; text-transform:none; }
.gateway-form select:disabled { color:#64748b; background:#f1f5f9; }
.gateway-form-footer { display:flex; justify-content:space-between; align-items:center; gap:16px; padding-top:3px; }
.gateway-form-footer>p { color:#64748b; font-size:11px; }
.gateway-form-footer>.btn-primary { min-width:210px; }
.gateway-edit-form { margin-top:14px; }
.gateway-save-button,.gateway-action-primary,.gateway-action-secondary,.gateway-action-danger {
  padding:9px 14px;
  border:1px solid #dbe3ef;
  border-radius:9px;
  background:#fff;
  color:#334155;
  font:inherit;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
}
.gateway-save-button,.gateway-action-primary { color:#fff; border-color:#059669; background:#059669; }
.gateway-save-button:hover,.gateway-action-primary:hover { background:#047857; }
.gateway-action-secondary:hover { background:#f1f5f9; }
.gateway-action-danger { color:#be123c; border-color:#fecdd3; background:#fff1f2; }
.gateway-action-danger:hover { background:#ffe4e6; }
.gateway-actions { display:flex; align-items:center; gap:8px; }

.gateway-meta { display:grid; grid-template-columns:1.4fr .8fr .8fr; gap:10px; margin:14px 0 0; }
.gateway-meta>div,.connection-grid>div { display:grid; align-content:start; gap:7px; min-width:0; padding:13px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:11px; }
.gateway-meta small,.connection-grid small { color:#94a3b8; font-size:9px; font-weight:900; letter-spacing:.06em; text-transform:uppercase; }
.gateway-meta strong { font-size:12px; }
.gateway-meta code,.connection-grid code { overflow-wrap:anywhere; color:#334155; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:10px; line-height:1.45; }
.gateway-connection-section { margin-top:22px; padding-top:20px; border-top:1px solid #e2e8f0; }
.gateway-subheading { align-items:end; }
.gateway-subheading h3 { margin-top:5px; font-size:17px; }
.gateway-subheading>p { max-width:520px; color:#64748b; font-size:11px; line-height:1.45; text-align:right; }
.connection-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }

.gateway-progress { margin-top:16px; padding:16px; border:1px solid #dbeafe; border-radius:14px; background:#f8fbff; }
.gateway-progress-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.gateway-progress-heading h3 { margin-top:5px; font-size:15px; }
.gateway-progress-track { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin-top:14px; }
.gateway-progress-step { display:flex; gap:8px; align-items:flex-start; min-width:0; padding:10px; border:1px solid #e2e8f0; border-radius:10px; background:#fff; }
.gateway-progress-step>span { display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:#f1f5f9; color:#94a3b8; font-size:9px; font-weight:900; flex:0 0 auto; }
.gateway-progress-step>div { display:grid; gap:3px; min-width:0; }
.gateway-progress-step strong { font-size:10px; line-height:1.25; }
.gateway-progress-step small { overflow:hidden; color:#94a3b8; font-size:8px; line-height:1.35; text-overflow:ellipsis; }
.gateway-progress-step.complete { border-color:#a7f3d0; background:#f0fdf7; }
.gateway-progress-step.complete>span { background:#10b981; color:#fff; }
.gateway-progress-step.complete small { color:#047857; }
.gateway-verification { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; padding:10px 12px; border-radius:9px; font-size:10px; }
.gateway-verification strong { font-size:11px; }
.gateway-verification.success { color:#047857; background:#d1fae5; }
.gateway-verification.warning { color:#92400e; background:#fef3c7; }
.gateway-guide { margin-top:14px; padding:15px 16px; border:1px solid #e2e8f0; border-radius:12px; background:#fff; }
.gateway-guide h4 { font-size:13px; }
.gateway-guide ol { display:grid; grid-template-columns:1fr 1fr; gap:8px 28px; margin:11px 0 0 18px; color:#475569; font-size:10px; line-height:1.45; }

.gateway-audit-section { margin-top:22px; padding-top:20px; border-top:1px solid #e2e8f0; }
.gateway-audit-list { display:grid; gap:0; margin-top:14px; border:1px solid #e2e8f0; border-radius:12px; background:#fff; overflow:hidden; }
.gateway-audit-event { position:relative; display:grid; grid-template-columns:12px minmax(0,1fr); gap:10px; padding:13px 15px; border-bottom:1px solid #eef2f7; }
.gateway-audit-event:last-child { border-bottom:0; }
.gateway-audit-dot { width:8px; height:8px; margin-top:5px; border-radius:50%; background:#10b981; box-shadow:0 0 0 4px #d1fae5; }
.gateway-audit-title { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.gateway-audit-title strong { color:#1e293b; font-size:11px; text-transform:capitalize; }
.gateway-audit-title time,.gateway-audit-event small { color:#94a3b8; font-size:9px; }
.gateway-audit-event details { margin-top:7px; }
.gateway-audit-event summary { width:fit-content; color:#64748b; font-size:9px; font-weight:800; cursor:pointer; }
.gateway-audit-event details code { display:block; max-height:190px; margin-top:7px; padding:9px; overflow:auto; border-radius:8px; background:#f8fafc; color:#475569; font-size:9px; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.gateway-audit-loading,.gateway-audit-error { padding:22px; color:#64748b; font-size:11px; text-align:center; }
.gateway-audit-error { color:#be123c; background:#fff1f2; }
.gateway-audit-pager { display:flex; justify-content:flex-end; align-items:center; gap:10px; min-height:36px; margin-top:9px; color:#64748b; font-size:10px; }

.gateway-support-context { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:18px; padding:14px 16px; border:1px solid #a7f3d0; border-radius:12px; background:#ecfdf5; }
.gateway-support-context>div { display:grid; gap:3px; }
.gateway-support-context strong { color:#064e3b; font-size:14px; }
.gateway-support-context small { color:#047857; font-size:10px; }

@media(max-width:1100px) {
  .gateway-page-header { align-items:flex-start; }
  .gateway-page-header .header-right { flex-wrap:wrap; justify-content:flex-end; }
  .gateway-layout { grid-template-columns:310px minmax(0,1fr); }
  .gateway-package-bar { grid-template-columns:1fr auto; }
  .gateway-package-checksum { grid-column:1/-1; grid-row:2; }
  .gateway-form,.gateway-meta,.connection-grid { grid-template-columns:1fr; }
  .gateway-meta-fingerprint,.gateway-field-wide,.gateway-form-footer { grid-column:1; }
  .gateway-form-footer { align-items:flex-start; flex-direction:column; }
  .gateway-subheading { align-items:flex-start; flex-direction:column; }
  .gateway-subheading>p { text-align:left; }
  .gateway-progress-track { grid-template-columns:1fr 1fr; }
}
@media(max-width:800px) {
  .gateway-admin-page { padding:16px; }
  .gateway-page-header { align-items:stretch; flex-direction:column; }
  .gateway-page-header .header-right { justify-content:flex-start; }
  .gateway-workspace-bar,.gateway-layout,.gateway-package-bar { grid-template-columns:1fr; }
  .gateway-package-checksum { grid-column:1; grid-row:auto; }
  .gateway-package-actions { align-items:stretch; flex-direction:column; }
  .gateway-package-actions button { width:100%; }
  .gateway-package-upload { grid-template-columns:1fr; }
  .gateway-package-wide { grid-column:1; }
  .gateway-package-upload-footer { align-items:flex-start; flex-direction:column; }
  .gateway-list-panel { position:static; }
  .gateway-detail-panel { min-height:480px; padding:18px; }
  .gateway-empty-state { min-height:420px; }
  .gateway-detail-heading { align-items:flex-start; flex-direction:column; }
  .gateway-detail-actions { justify-content:flex-start; }
  .gateway-progress-track,.gateway-guide ol { grid-template-columns:1fr; }
  .gateway-verification { align-items:flex-start; flex-direction:column; }
  .gateway-support-context { align-items:flex-start; flex-direction:column; }
  .gateway-audit-title { flex-direction:column; gap:3px; }
}
