/**
 * Datil · SUNAT Perú (SIRE RCE + UBL 2.1)
 * Typography: Self-hosted Geist (OpenType Tabular Figures `tnum`) + Geist Mono
 */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root,
body[data-theme="light"] {
  --bg-app: #F8F9FA;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F3F4F6;
  --bg-hover: #F1F5F9;
  --bg-selected: #EAF2FF;
  --bg-header: #0B0C0E;

  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --border-selected: #2563EB;

  --ink: #0B0C0E;
  --ink-secondary: #374151;
  --ink-muted: #6B7280;
  --ink-zero: #9CA3AF;

  --accent: #0B0C0E;
  --danger: #991B1B;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --ok-dot: #10B981;

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

body[data-theme="dark"] {
  --bg-app: #0A0B0D;
  --bg-surface: #111317;
  --bg-subtle: #171A20;
  --bg-hover: #1E222A;
  --bg-selected: #172542;
  --bg-header: #060708;

  --border: #232730;
  --border-strong: #323846;
  --border-selected: #3B82F6;

  --ink: #F3F4F6;
  --ink-secondary: #D1D5DB;
  --ink-muted: #8E96A4;
  --ink-zero: #4B5563;

  --accent: #F3F4F6;
  --danger: #F87171;
  --danger-bg: rgba(153, 27, 27, 0.2);
  --danger-border: rgba(248, 113, 113, 0.35);
}

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

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 0;
}

.code-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Thin, neutral scrollbars */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.45);
  border-radius: 3px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.7);
}

/* ============================================================================
   DATIL CARBON SIGN-IN GATE
   ============================================================================ */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0a0a0c;
  background-image: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.035) 0%, transparent 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font-sans);
}

.auth-gate.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: #111113;
  border: 1px solid #222326;
  border-radius: 8px;
  padding: 28px 28px 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.auth-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.auth-monogram {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #ededed;
  color: #0a0a0c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.auth-wordmark {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f3f4f6;
  margin: 0;
}

.auth-subtitle {
  font-size: 12.5px;
  color: #8a8f98;
  letter-spacing: -0.01em;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.auth-label {
  font-size: 12px;
  font-weight: 500;
  color: #c8ccd2;
  letter-spacing: -0.01em;
}

.auth-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: #0c0d0f;
  border: 1px solid #26272b;
  border-radius: 6px;
  color: #f3f4f6;
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-input::placeholder {
  color: #52565e;
}

.auth-input:focus {
  border-color: #525866;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.auth-submit-btn {
  width: 100%;
  height: 38px;
  padding: 0 16px;
  margin-top: 4px;
  background: #ededed;
  color: #0a0a0c;
  border: 1px solid #ededed;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, opacity 120ms ease;
}

.auth-submit-btn:hover {
  background: #ffffff;
  border-color: #ffffff;
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.auth-error {
  padding: 9px 11px;
  background: rgba(153, 27, 27, 0.22);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  font-size: 12px;
  border-radius: 6px;
  display: none;
}

/* ============================================================================
   AUTHENTICATED WORKSPACE SHELL (3 Rows: 40px Header, 48px Telemetry, 1fr View)
   ============================================================================ */
.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 40px 48px 1fr;
  overflow: hidden;
}

.app-shell.hidden {
  display: none !important;
}

/* ROW 1: 40px HEADER */
.foundry-header {
  height: 40px;
  background: var(--bg-header);
  color: #F9FAFB;
  border-bottom: 1px solid #22252A;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}

.fh-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fh-logo {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  padding-right: 10px;
  border-right: 1px solid #2E323B;
}

.fh-context {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fh-select {
  background: #16181D;
  color: #F3F4F6;
  border: 1px solid #2E323B;
  border-radius: 4px;
  height: 26px;
  padding: 0 22px 0 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239CA3AF' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.fh-select:hover {
  border-color: #4B5563;
}

.fh-tabs {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2px;
  flex: 1;
  justify-content: center;
  white-space: nowrap;
}

.fh-tab {
  height: 100%;
  padding: 0 12px;
  background: transparent;
  color: #9CA3AF;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 120ms ease;
}

.fh-tab:hover {
  color: #F3F4F6;
}

.fh-tab.active {
  color: #FFFFFF;
  border-bottom-color: #FFFFFF;
}

.fh-tab .cnt {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 3px;
  background: #1F232B;
  color: #D1D5DB;
}

.fh-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.fh-btn {
  height: 26px;
  padding: 0 9px;
  background: #16181D;
  color: #E5E7EB;
  border: 1px solid #2E323B;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease;
}

.fh-btn:hover {
  background: #22262E;
  border-color: #4B5563;
}

.fh-btn.primary {
  background: #F9FAFB;
  color: #0B0C0E;
  border-color: #F9FAFB;
  font-weight: 600;
}

.fh-btn.primary:hover {
  background: #E5E7EB;
}

.fh-user-pill {
  font-size: 11.5px;
  color: #9CA3AF;
  padding: 0 4px;
}

/* ROW 2: 48px TELEMETRY RIBBON */
.telemetry-ribbon {
  height: 48px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  user-select: none;
}

.tr-cell {
  padding: 6px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  cursor: pointer;
  transition: background 120ms ease;
}

.tr-cell:last-child {
  border-right: none;
}

.tr-cell:hover {
  background: var(--bg-subtle);
}

.tr-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tr-val-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.tr-val {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.tr-sub {
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ROW 3: WORKSPACE VIEWS */
.foundry-view {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.foundry-view.active {
  display: block;
}

.workbench-split {
  display: grid;
  grid-template-columns: 58% 42%;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* LEFT 58% PANE: MASTER LEDGER GRID */
.ledger-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-strong);
  overflow: hidden;
  min-width: 0;
}

.filter-bar {
  height: 40px;
  padding: 0 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 150px;
  max-width: 300px;
}

.search-box input,
#searchInput {
  width: 100%;
  height: 28px;
  padding: 0 24px 0 9px;
  background: var(--bg-subtle);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}

.search-box input:focus,
#searchInput:focus {
  background: var(--bg-surface);
  border-color: var(--ink);
}

.kbd-hint {
  position: absolute;
  right: 6px;
  top: 5px;
  font-size: 10px;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 0 4px;
  border-radius: 3px;
  pointer-events: none;
}

.seg-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
}

.seg-btn {
  height: 22px;
  padding: 0 7px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.active {
  background: var(--ink);
  color: var(--bg-surface);
}

.seg-cnt {
  opacity: 0.72;
  font-size: 10.5px;
}

/* ALL TABLES & COLUMN WIDTHS */
.grid-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-surface);
}

.foundry-table,
.items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Explicit Column Widths for Master Ledger Table (58% Left Pane) */
#ledgerTable th.col-fecha {
  width: 62px;
}
#ledgerTable th.col-tipo {
  width: 48px;
}
#ledgerTable th.col-serie {
  width: 102px;
}
#ledgerTable th.col-ruc {
  width: 98px;
}
#ledgerTable th.col-razon {
  width: auto;
}
#ledgerTable th.col-mon {
  width: 44px;
}
#ledgerTable th.col-igv {
  width: 82px;
}
#ledgerTable th.col-total {
  width: 96px;
}
#ledgerTable th.col-estado {
  width: 82px;
}

.foundry-table th,
.foundry-table td,
.items-table th,
.items-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundry-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 28px;
  padding: 0 7px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.foundry-table thead th:last-child {
  border-right: none;
}

.foundry-table tbody tr {
  height: 31px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 100ms ease;
}

.foundry-table tbody tr:hover {
  background: var(--bg-hover);
}

.foundry-table tbody tr.selected {
  background: var(--bg-selected);
  box-shadow: inset 2px 0 0 var(--border-selected);
}

.foundry-table td {
  height: 31px;
  padding: 0 7px;
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.foundry-table th.num,
.foundry-table td.num,
.items-table th.num,
.items-table td.num {
  text-align: right;
}

.foundry-table th.center,
.foundry-table td.center {
  text-align: center;
}

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

.zero-val {
  color: var(--ink-zero) !important;
}

.type-tag {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  line-height: 1.25;
}

.type-tag.type-07 {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.state-cell {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-secondary);
}

.s-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #9CA3AF;
}

.s-ok .s-dot {
  background: var(--ok-dot);
}

.s-ubl .s-dot {
  background: #3B82F6;
}

.s-sire .s-dot,
.s-dua .s-dot {
  background: #9CA3AF;
}

.grid-footer {
  height: 28px;
  padding: 0 12px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================================
   RIGHT 42% PANE: OBJECT INSPECTOR
   ============================================================================ */
.inspector-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  overflow: hidden;
  min-width: 0;
}

.obj-header {
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

.obj-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.obj-id-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.obj-id {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.obj-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

.obj-car-line {
  font-size: 11px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.obj-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-inspector {
  height: 23px;
  padding: 0 8px;
  background: var(--bg-surface);
  color: var(--ink-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}

.btn-inspector:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.obj-subtabs {
  height: 29px;
  padding: 0 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  white-space: nowrap;
}

.obj-subtab {
  height: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.obj-subtab:hover {
  color: var(--ink);
}

.obj-subtab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.obj-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
}

.prop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.prop-cell {
  padding: 6px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.prop-cell:nth-child(2n) {
  border-right: none;
}

.prop-cell.span-2 {
  grid-column: span 2;
  border-right: none;
  border-bottom: none;
}

.prop-k {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
}

.prop-v {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-bar {
  height: 26px;
  padding: 0 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.items-table thead th {
  height: 25px;
  padding: 0 8px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: left;
}

.items-table thead th:last-child {
  border-right: none;
}

.items-table tbody td {
  height: 27px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.totals-strip {
  padding: 10px 12px;
  background: var(--bg-subtle);
  display: grid;
  grid-template-columns: 1fr 195px;
  gap: 12px;
  align-items: start;
  flex-shrink: 0;
}

.totals-notes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 11px;
  color: var(--ink-secondary);
}

.totals-notes strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.totals-math {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.tm-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.tm-k {
  color: var(--ink-muted);
}

.tm-v {
  font-weight: 500;
  color: var(--ink);
}

.tm-row.grand {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 600;
}

.tm-row.grand .tm-k {
  color: var(--ink);
}

.raw-code-pane {
  flex: 1;
  overflow: auto;
  background: #0B0C0E;
  color: #E5E7EB;
  padding: 12px;
}

.raw-code-pane pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================================
   SECONDARY VIEWS: PROVEEDORES & CONEXIÓN SUNAT Y API
   ============================================================================ */
.secondary-view {
  height: 100%;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-app);
}

.secondary-grid-top {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
}

.api-split-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: start;
}

.secondary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.secondary-card-hdr {
  height: 34px;
  padding: 0 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.cron-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--ok-dot);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 7px;
  border-radius: 3px;
}

.spark-card-body {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spark-svg {
  width: 100%;
  height: 64px;
  display: block;
}

.spark-bar {
  fill: #9CA3AF;
  cursor: pointer;
  transition: fill 120ms ease;
}

.spark-bar:hover,
.spark-bar.active {
  fill: var(--ink);
}

.spark-caption-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-muted);
}

.config-form-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  background: var(--bg-surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
}

.form-input:focus {
  border-color: var(--ink);
}

.form-input:disabled {
  background: var(--bg-subtle);
  color: var(--ink-muted);
}

.curl-box {
  background: #0B0C0E;
  color: #E5E7EB;
  border-radius: 4px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */
@media (max-width: 1380px) {
  .tr-sub {
    display: none;
  }
}

@media (max-width: 1279px) {
  .col-opt-md,
  .seg-cnt {
    display: none !important;
  }
  .secondary-grid-top,
  .api-split-grid {
    grid-template-columns: 1fr;
  }
}

.cell-vendor {
  font-weight: 500;
}
