/* =============================================================================
   CrystalWorks Admin — PermissionWorks / OasisPro dashboard theme
   Maps existing markup (.sidebar, .navlink, .content, dashboard IDs) to tokens.
   ============================================================================= */

:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --ifs-blue: #4f46e5;
  --ifs-blue-hover: #4338ca;
  --ifs-blue-soft: #eef2ff;
  --oasis-purple: #6d28d9;
  --oasis-purple-soft: #f3edff;
  --success: #15803d;
  --success-soft: #e7f7ed;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --radius: 6px;
  --cw-sidebar-width: 285px;
  --cw-topbar-height: 48px;
  --cw-trial-bar-height: 36px;
}

* { box-sizing: border-box; }

html { font-size: 14px; }

body {
  margin: 0;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: var(--ifs-blue); }

.icon { width: 16px; height: 16px; stroke-width: 1.9; }
.icon-sm { width: 14px; height: 14px; stroke-width: 2; }

/* ---- Sticky chrome (trial banner + top bar) ---- */
.app-chrome {
  position: sticky;
  top: 0;
  z-index: 200;
}

.trial-top-bar {
  height: var(--cw-trial-bar-height);
  background: #0f172a;
  color: #e5e7eb;
  padding: 0 18px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trial-top-bar.expired {
  background: #991b1b;
}

.trial-top-bar .trial-label {
  font-weight: 600;
}

/* ---- Top bar ---- */
.topbar {
  height: var(--cw-topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: relative;
  z-index: 200;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

.topbar .brand .oasis,
.brand-accent {
  color: var(--oasis-purple);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #1f2937;
  font-size: 14px;
}

.topbar-signed-in {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.topbar-signed-in strong {
  color: var(--text);
  font-weight: 700;
}

.topbar-logout,
#logout-link {
  border: 1px solid var(--border-dark);
  background: var(--surface);
  color: #1f2937;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 5px 12px;
  line-height: 1.3;
}

.topbar-logout:hover,
#logout-link:hover {
  background: #f9fafb;
  border-color: var(--border-dark);
  color: var(--text);
}

.avatar {
  width: 32px;
  height: 32px;
  background: #07865f;
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ---- Layout shell (legacy selectors kept for JS) ---- */
.app-layout {
  display: grid;
  grid-template-columns: var(--cw-sidebar-width) 1fr;
  min-height: calc(100vh - var(--cw-topbar-height) - var(--cw-trial-bar-height));
}

.sidebar {
  width: auto;
  position: relative;
  top: auto;
  left: auto;
  bottom: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  color: #1f2937;
  overflow-y: auto;
  z-index: 100;
  min-height: calc(100vh - var(--cw-topbar-height) - var(--cw-trial-bar-height));
}

.sidebar .brand {
  display: none; /* brand lives in topbar */
}

.sidebar h6,
.nav-section {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 18px 0 8px;
}

.navlink {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1f2937;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 3px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.navlink .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.9;
  color: #6b7280;
}

.navlink:hover {
  background: #f3f4f6;
  color: var(--ifs-blue);
  text-decoration: none;
}

.navlink:hover .nav-icon {
  color: var(--ifs-blue);
}

.navlink.active {
  background: var(--ifs-blue);
  color: white;
  font-weight: 600;
}

.navlink.active .nav-icon {
  color: white;
}

.navlink.nav-disabled {
  opacity: .45;
  pointer-events: none;
  cursor: not-allowed;
}

.sidebar-footer,
.sidebar .mt-auto {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.content {
  margin-left: 0 !important; /* override inline JS margin; grid handles layout */
  padding: 22px 28px;
  min-width: 0;
  background: var(--bg);
}

body.login-mode .app-chrome,
body.login-mode .trial-top-bar,
body.login-mode .topbar,
body.login-mode .sidebar { display: none !important; }
body.login-mode .app-layout { grid-template-columns: 1fr; }
body.login-mode .content { margin-left: 0; padding: 0; }

/* ---- Bootstrap bridge ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.card h4, .card h5, .card h6 {
  color: var(--text);
  font-weight: 600;
}

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

code {
  background: var(--surface-soft);
  color: #374151;
  padding: 2px 6px;
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.form-label {
  font-weight: 700;
  font-size: 13px;
  color: #374151;
  margin-bottom: 7px;
}

.form-control,
.form-select {
  border-color: var(--border-dark);
  border-radius: var(--radius);
  color: var(--text);
  background: white;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ifs-blue);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.14);
}

.form-text { color: var(--muted); font-size: 13px; }

.btn {
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-primary {
  background-color: var(--ifs-blue);
  border-color: var(--ifs-blue);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--ifs-blue-hover);
  border-color: var(--ifs-blue-hover);
}

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

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--ifs-blue);
  border-color: var(--ifs-blue);
  color: white;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-dark);
  color: #1f2937;
}

.btn-secondary:hover {
  background: #f9fafb;
  color: var(--ifs-blue);
  border-color: var(--ifs-blue);
}

.btn-outline-secondary {
  color: #1f2937;
  border-color: var(--border-dark);
}

.btn-outline-secondary:hover {
  color: var(--ifs-blue);
  border-color: var(--ifs-blue);
  background: var(--ifs-blue-soft);
}

.btn-outline-light {
  color: #475569;
  border-color: var(--border-dark);
  background: white;
}

.btn-outline-light:hover,
.btn-outline-light.active {
  background: var(--ifs-blue-soft);
  border-color: var(--ifs-blue);
  color: var(--ifs-blue);
}

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

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

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius); }

.btn-xxs {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: var(--radius);
}

.alert-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: #991b1b;
}

.alert-success {
  background: var(--success-soft);
  border-color: #c9ecd6;
  color: var(--success);
}

.badge.bg-success {
  background: var(--success-soft) !important;
  color: var(--success) !important;
  border: 1px solid #c9ecd6;
  border-radius: 999px;
  font-weight: 700;
}

.badge.bg-secondary {
  background: #eef2f7 !important;
  color: #475569 !important;
  border-radius: 999px;
}

.badge.bg-danger {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
  border: 1px solid var(--danger-border);
  border-radius: 999px;
}

.badge.bg-warning {
  background: #fffbeb !important;
  color: #b45309 !important;
  border-radius: 999px;
}

.table { color: var(--text); }

.table-light th,
.table-light td {
  background: var(--surface-soft);
}

.table thead th {
  color: #374151;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.table-hover tbody tr:hover {
  background: #f9fafb;
}

.table-responsive {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pagination .page-link {
  color: var(--ifs-blue);
  border-color: var(--border);
  border-radius: var(--radius);
  margin: 0 2px;
  font-weight: 600;
}

.pagination .page-item.active .page-link {
  background: var(--ifs-blue);
  border-color: var(--ifs-blue);
}

.pagination .page-link:hover {
  background: var(--ifs-blue-soft);
  color: var(--ifs-blue-hover);
}

.list-group-item {
  border-color: var(--border);
  color: var(--text);
}

.list-group-item:hover,
.list-group-item-action:hover {
  background: var(--ifs-blue-soft);
  color: var(--ifs-blue);
}

.list-group-item.active,
.list-group-item-action.active {
  background: var(--ifs-blue) !important;
  border-color: var(--ifs-blue) !important;
  color: #fff !important;
  z-index: 1;
}

.list-group-item.active:hover,
.list-group-item-action.active:hover,
.list-group-item.active:focus,
.list-group-item-action.active:focus {
  background: var(--ifs-blue-hover) !important;
  border-color: var(--ifs-blue-hover) !important;
  color: #fff !important;
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
}

.modal-title {
  font-weight: 700;
  color: var(--text);
}

hr {
  border-color: var(--border);
  opacity: 1;
}

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

/* ---- Users page badges ---- */
.badge-role {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-role-admin {
  background: var(--ifs-blue-soft);
  color: var(--ifs-blue);
  border-color: #c7ddff;
}

.badge-role-standard {
  background: #eef2f7;
  color: #475569;
  border-color: var(--border);
}

.badge-role-super {
  background: var(--oasis-purple-soft);
  color: var(--oasis-purple);
  border-color: #ddd6fe;
}

/* Shared static data-table panels (fixed layout, sticky header, scroll) */
.data-table-wrap,
.failed-jobs-wrap {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 280px);
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table-wrap--compact {
  height: 320px;
  min-height: 240px;
}

.data-table,
.failed-jobs-table {
  table-layout: fixed !important;
  width: 100% !important;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th,
.failed-jobs-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft) !important;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 13px;
}

.data-table tbody td,
.failed-jobs-table tbody td {
  overflow: hidden;
  vertical-align: middle;
}

.data-table .cell-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table td.data-table-actions {
  overflow: visible;
  white-space: nowrap;
  vertical-align: middle;
}

.data-table code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.failed-jobs-table {
  min-width: 980px;
}

.failed-jobs-table tbody td {
  vertical-align: top;
  word-break: break-word;
}

.failed-jobs-table th:nth-child(1),
.failed-jobs-table td:nth-child(1) { width: 130px; }
.failed-jobs-table th:nth-child(2),
.failed-jobs-table td:nth-child(2) { width: 110px; }
.failed-jobs-table th:nth-child(3),
.failed-jobs-table td:nth-child(3) { width: 130px; }
.failed-jobs-table th:nth-child(4),
.failed-jobs-table td:nth-child(4) { width: 180px; }
.failed-jobs-table th:nth-child(5),
.failed-jobs-table td:nth-child(5) { width: 90px; }
.failed-jobs-table th:nth-child(6),
.failed-jobs-table td:nth-child(6) { width: 80px; }
.failed-jobs-table th:nth-child(7),
.failed-jobs-table td:nth-child(7) { width: auto; }
.failed-jobs-table th:nth-child(8),
.failed-jobs-table td:nth-child(8) { width: 110px; }

/* Print Jobs */
.print-jobs-table { min-width: 920px; }
.print-jobs-table th:nth-child(1),
.print-jobs-table td:nth-child(1) { width: 110px; }
.print-jobs-table th:nth-child(2),
.print-jobs-table td:nth-child(2) { width: 140px; }
.print-jobs-table th:nth-child(3),
.print-jobs-table td:nth-child(3) { width: auto; }
.print-jobs-table th:nth-child(4),
.print-jobs-table td:nth-child(4) { width: 150px; }
.print-jobs-table th:nth-child(5),
.print-jobs-table td:nth-child(5) { width: 120px; }
.print-jobs-table th:nth-child(6),
.print-jobs-table td:nth-child(6) { width: 110px; }

/* Quick Reports */
.quick-reports-table { min-width: 860px; }
.quick-reports-table th:nth-child(1),
.quick-reports-table td:nth-child(1) { width: 120px; }
.quick-reports-table th:nth-child(2),
.quick-reports-table td:nth-child(2) { width: 220px; }
.quick-reports-table th:nth-child(3),
.quick-reports-table td:nth-child(3) { width: auto; }
.quick-reports-table th:nth-child(4),
.quick-reports-table td:nth-child(4) { width: 200px; }

/* Users — balanced columns (avoid Username swallowing leftover width) */
.users-table-wrap {
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 280px);
}

.users-table {
  min-width: 720px;
  width: 100%;
}

.users-table thead th,
.users-table tbody td {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) { width: 18%; }   /* Username */
.users-table th:nth-child(2),
.users-table td:nth-child(2) { width: 12%; }   /* Role */
.users-table th:nth-child(3),
.users-table td:nth-child(3) { width: 12%; }   /* Super Admin */
.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 22%; }   /* Created */
.users-table th:nth-child(5),
.users-table td:nth-child(5) { width: 36%; }   /* Actions */

.users-table .data-table-actions .d-inline-flex {
  justify-content: flex-end;
  gap: 0.4rem;
}

/* Report layout details / backups */
.report-layouts-table { min-width: 520px; }
.report-layouts-table th:nth-child(1),
.report-layouts-table td:nth-child(1) { width: 45%; }
.report-layouts-table th:nth-child(2),
.report-layouts-table td:nth-child(2) { width: 55%; }

.report-backups-table { min-width: 640px; }
.report-backups-table th:nth-child(1),
.report-backups-table td:nth-child(1) { width: auto; }
.report-backups-table th:nth-child(2),
.report-backups-table td:nth-child(2) { width: 180px; }
.report-backups-table th:nth-child(3),
.report-backups-table td:nth-child(3) { width: 120px; }

/* Configure — Production Deliveries */
.cfg-builds-table { min-width: 720px; }
.cfg-builds-table th:nth-child(1),
.cfg-builds-table td:nth-child(1) { width: auto; }
.cfg-builds-table th:nth-child(2),
.cfg-builds-table td:nth-child(2) { width: 160px; }
.cfg-builds-table th:nth-child(3),
.cfg-builds-table td:nth-child(3) { width: 160px; }
.cfg-builds-table th:nth-child(4),
.cfg-builds-table td:nth-child(4) { width: 220px; }

/* Dashboard recent jobs */
.recent-jobs-table { min-width: 360px; }
.recent-jobs-table th:nth-child(1),
.recent-jobs-table td:nth-child(1) { width: 80px; }
.recent-jobs-table th:nth-child(2),
.recent-jobs-table td:nth-child(2) { width: 100px; }
.recent-jobs-table th:nth-child(3),
.recent-jobs-table td:nth-child(3) { width: auto; }

/* Smaller body text for Source, Stage, Report/Layout, Print Job, Build */
.failed-jobs-table td:nth-child(2),
.failed-jobs-table td:nth-child(3),
.failed-jobs-table td:nth-child(4),
.failed-jobs-table td:nth-child(5),
.failed-jobs-table td:nth-child(6) {
  font-size: 11px;
  line-height: 1.35;
  color: #4b5563;
}

.failed-msg-cell {
  max-width: 320px;
  overflow: hidden;
}

.failed-msg {
  max-width: 100%;
  width: 100%;
  overflow: hidden;
}

.failed-msg-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #374151;
  line-height: 1.4;
}

.failed-msg-full {
  margin: 0;
  max-height: 160px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.failed-msg-toggle {
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 4px;
  display: inline-block;
}

.failed-msg-toggle:hover {
  text-decoration: underline;
}

.failed-msg-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.failed-msg-copy {
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.failed-msg-copy:hover {
  text-decoration: underline;
}

.failed-msg-copy.copied {
  color: var(--success);
  text-decoration: none;
}

/* ---- Dashboard page ---- */
.header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.header-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.dashboard-grid-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-grid-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-trial-card {
  min-height: auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.dashboard-trial-card .metric {
  margin: 8px 0 0;
  font-size: 28px;
}

.dashboard-grid-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.dashboard-card {
  min-height: 140px;
  padding: 18px;
}

.dashboard-card .card-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.dashboard-card .metric {
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 16px 0 6px;
  color: var(--text);
}

.dashboard-card .subtext {
  color: var(--muted);
  font-size: 13px;
}

.card-header-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title-custom {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* Status / API flow (keep behavior, refresh look) */
.status-banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-weight: 600;
  min-height: 48px;
  margin-bottom: 14px;
}

.status-banner-ok {
  background: linear-gradient(90deg, #0f766e, #2563eb);
  color: #fff;
}

.status-banner-error {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
  color: #fff;
  animation: status-blink 1s infinite;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.api-flow-shell {
  margin-bottom: 16px;
  border-radius: 18px;
  overflow: hidden;
}

.api-flow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 20px;
  border-radius: 18px 18px 0 0;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.85rem;
}

.api-flow-title {
  font-weight: 600;
  color: #e5e7eb;
}

.api-flow-caption {
  font-size: 0.75rem;
  opacity: 0.8;
  color: #e5e7eb;
}

.api-pipeline {
  padding: 28px 40px 40px;
  border-radius: 0 0 18px 18px;
  background: radial-gradient(circle at top left, #0f172a, #020617);
  position: relative;
  min-height: 180px;
}

.api-line-main {
  position: relative;
  margin: 40px 80px 0;
  height: 3px;
  background: rgba(148, 163, 184, 0.4);
}

.api-line-active {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: #22c55e;
  transition: width 0.4s ease-out;
}

.api-node {
  position: absolute;
  top: -24px;
  width: 70px;
  height: 70px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.70rem;
  font-weight: 600;
  color: #e5e7eb;
  z-index: 1;
  box-shadow: none;
}

.api-node-label {
  position: absolute;
  top: auto;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 500;
  color: #9ca3af;
  white-space: nowrap;
}

.api-node.ifs {
  left: 0;
  border-color: rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
}

.api-node.crystal {
  right: 0;
  left: auto;
  transform: none;
  border-color: rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
}

.api-dot {
  position: absolute;
  top: -5px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #22c55e;
  background: #022c22;
  transform: translateX(-50%);
  opacity: 0;
  z-index: 1;
}

@keyframes api-move-roundtrip {
  0%   { left: 0%; opacity: 1; }
  45%  { left: 100%; opacity: 1; }
  100% { left: 0%; opacity: 1; }
}

.api-dot--roundtrip {
  animation: api-move-roundtrip 1.8s ease-out forwards;
}

.api-node.ifs.success-blink {
  border-color: #22c55e;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.9);
  animation: api-ifs-success-pulse 0.9s ease-out 2;
}

.api-node.ifs.fail-blink {
  border-color: #ef4444;
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.9);
  animation: api-ifs-fail-pulse 0.9s ease-out 3;
}

@keyframes api-ifs-success-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(34, 197, 94, 0);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 18px rgba(34, 197, 94, 1);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(34, 197, 94, 0);
  }
}

@keyframes api-ifs-fail-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(248, 113, 113, 0);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 18px rgba(248, 113, 113, 1);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(248, 113, 113, 0);
  }
}

.tile-warning-blink {
  background-color: #fffbeb !important;
  border-color: #fde68a !important;
  animation: status-blink 1s infinite;
}

.failed-tile-ok {
  border: 1px solid #c9ecd6;
}

.failed-tile-bad {
  border: 2px solid var(--danger);
  background-color: var(--danger-soft);
}

/* Live processing chart — light card, keep SVG dark for contrast */
.monitor-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  min-height: 165px;
}

.monitor-tile h6,
.monitor-tile .card-title-custom {
  color: var(--text);
  font-weight: 600;
}

.live-chart-wrapper {
  width: 100%;
  height: 220px;
}

.live-chart-svg {
  width: 100%;
  height: 100%;
  background: #0f172a;
  border-radius: var(--radius);
}

.live-chart-grid-line {
  stroke: rgba(55, 65, 81, 0.6);
  stroke-width: 1;
}

.live-chart-axis {
  stroke: rgba(148, 163, 184, 0.9);
  stroke-width: 1.4px;
}

.live-chart-path {
  fill: none;
  stroke: #818cf8;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.live-chart-point { fill: #818cf8; }

.live-chart-label {
  fill: #9ca3af;
  font-size: 10px;
}

/* Page cards in other views */
#view > .card > h4,
#view > .card > h4.mb-3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

#view > .card {
  padding: 18px 20px !important;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .dashboard-grid-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid-bottom,
  .dashboard-grid-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none !important;
  }

  .content {
    margin-left: 0 !important;
    padding: 18px;
  }

  .topbar {
    height: auto;
    min-height: 48px;
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-grid-metrics {
    grid-template-columns: 1fr;
  }
}
