/* =====================================================
   GEOCEAN ERP · Styles
   SAP Business One-familiar layout, modernized
   ===================================================== */

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

:root {
  /* Surfaces */
  --bg:         #f4f6fa;
  --surface:    #ffffff;
  --surface-2:  #fafbfd;
  --border:     #e4e7ee;
  --border-2:   #eef0f5;

  /* Text */
  --text:       #1a2230;
  --text-muted: #6b7584;
  --text-subtle:#98a0ad;

  /* Brand — SAP-familiar blue + GEOCEAN cyan accent */
  --primary:     #0a6ed1;
  --primary-hover:#0854a6;
  --primary-light:#e7f1fb;
  --accent:      #00a8c7;
  --accent-light:#daf3f9;

  /* Status */
  --success: #16a34a;  --success-bg: #e8f7ef;
  --warning: #d97706;  --warning-bg: #fef3e2;
  --danger:  #dc2626;  --danger-bg:  #fdeaea;
  --neutral: #6b7584;  --neutral-bg: #eef0f5;
  --purple:  #7c3aed;  --purple-bg:  #f2ebff;
  --teal:    #0891b2;  --teal-bg:    #dff6f9;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow:    0 4px 10px rgba(16, 24, 40, 0.07), 0 2px 4px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.1), 0 4px 8px rgba(16, 24, 40, 0.04);

  /* Radii */
  --r-sm: 6px;
  --r:    8px;
  --r-lg: 12px;

  /* Fonts */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* =====================================================
   LOGIN SCREEN
   ===================================================== */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #041e33 0%, #0a2e4f 50%, #062d4a 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 2rem;
}
.login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 79px, rgba(0,229,255,0.03) 80px),
    repeating-linear-gradient(90deg, transparent, transparent 79px, rgba(0,229,255,0.03) 80px),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(0,229,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  z-index: 2;
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.login-logo span {
  font-family: 'Orbitron', var(--font);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 1.1rem;
  color: var(--text);
}
.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.75rem;
}
.login-field { margin-bottom: 1rem; }
.login-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}
.login-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--surface);
}
.login-btn {
  width: 100%;
  padding: 11px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 0.5rem;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--primary-hover); }
.login-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 1.25rem;
}

/* =====================================================
   APP SHELL
   ===================================================== */
.app-shell {
  display: grid;
  grid-template-rows: 52px 1fr 28px;
  height: 100vh;
  overflow: hidden;
}

/* -------- TOP BAR -------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1rem;
  gap: 1rem;
}
.topbar-hamburger {
  display: flex;
  background: none;
  border: none;
  width: 36px; height: 36px;
  border-radius: var(--r);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin-right: -0.25rem;
  transition: background 0.15s;
}
.topbar-hamburger:hover { background: var(--bg); }
.topbar-hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
body.sidenav-open .topbar-hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.sidenav-open .topbar-hamburger span:nth-child(2) { opacity: 0; }
body.sidenav-open .topbar-hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidenav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.2s;
}
body.sidenav-open .sidenav-backdrop { opacity: 1; }
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
  height: 52px;
}
.topbar-brand span {
  font-family: 'Orbitron', var(--font);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.85rem;
  color: var(--text);
}
.topbar-brand .suffix {
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 4px;
  padding: 2px 6px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 7px 14px 7px 34px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 100px;
  outline: none;
  font-size: 13px;
  transition: border 0.15s, background 0.15s;
}
.topbar-search input:focus {
  border-color: var(--primary);
  background: var(--surface);
}
.topbar-search .search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
}

.topbar-actions {
  display: flex; align-items: center; gap: 0.35rem;
  margin-left: auto;
}
.tb-btn {
  background: none;
  border: none;
  width: 34px; height: 34px;
  border-radius: var(--r);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.tb-btn:hover { background: var(--bg); color: var(--text); }
.tb-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px; height: 14px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.lang-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 3px;
  transition: border 0.15s;
}
.lang-btn:hover { border-color: var(--primary); }
.lang-btn .lo { padding: 0 2px; transition: color 0.15s; }
.lang-btn .lo.active { color: var(--primary); }
.lang-btn .ls { color: var(--text-subtle); }

.user-menu-wrap {
  position: relative;
  margin-left: 0.25rem;
}
.user-chip {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 4px 10px 4px 4px;
  border-radius: 100px;
  background: none;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.user-chip:hover { background: var(--bg); border-color: var(--border); }
.user-chip[aria-expanded="true"] { background: var(--bg); border-color: var(--border); }
.user-chip-text { text-align: left; }
.user-chip-caret {
  color: var(--text-subtle);
  margin-left: 2px;
  transition: transform 0.2s;
}
.user-chip[aria-expanded="true"] .user-chip-caret { transform: rotate(180deg); }

.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
.user-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.user-menu-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border-2);
  margin-bottom: 4px;
}
.user-menu-header .um-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-menu-header .um-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.user-menu-header .um-role { font-size: 10.5px; color: var(--primary); margin-top: 4px; font-weight: 500; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
}
.user-menu-item:hover { background: var(--bg); text-decoration: none; }
.user-menu-item svg { color: var(--text-muted); flex-shrink: 0; }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger svg { color: var(--danger); }
.user-menu-item.danger:hover { background: var(--danger-bg); }
.user-menu-divider {
  height: 1px;
  background: var(--border-2);
  margin: 4px 6px;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
}
.user-chip .u-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  line-height: 1;
}
.user-chip .u-role {
  font-size: 10px; color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}

/* -------- LAYOUT -------- */
.layout {
  display: grid;
  grid-template-columns: 0 1fr;
  overflow: hidden;
  transition: grid-template-columns 0.22s ease;
}
body.sidenav-open .layout {
  grid-template-columns: 240px 1fr;
}

/* -------- SIDE NAV (SAP main menu tree) -------- */
.sidenav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
}
body.sidenav-open .sidenav { overflow-y: auto; }
.sidenav .side-icon { display: none; }
.side-link { padding: 9px 14px; }
.sidenav::-webkit-scrollbar { width: 6px; }
.sidenav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.side-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  text-transform: uppercase;
  padding: 0.75rem 0.75rem 0.4rem;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.side-link:hover {
  background: var(--bg);
  text-decoration: none;
}
.side-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.side-link.active .side-icon { color: var(--primary); }
.side-icon {
  width: 18px; height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.side-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}
.side-divider {
  height: 1px;
  background: var(--border);
  margin: 0.6rem 0.25rem;
}

/* -------- MAIN AREA -------- */
.main {
  overflow-y: auto;
  background: var(--bg);
  padding: 1.25rem 1.75rem;
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.breadcrumb a {
  color: var(--text-muted);
  transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb .sep { color: var(--text-subtle); font-size: 10px; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* Page header */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.page-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 0.25rem;
}
.page-actions {
  display: flex; gap: 0.5rem;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); border-color: var(--text-subtle); text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: transparent; }

/* =====================================================
   CARDS / PANELS
   ===================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-2);
}
.card-head h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.card-head .card-sub {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-body { padding: 18px; }
.card-body.dense { padding: 12px; }
.card-body.flush { padding: 0; }

/* =====================================================
   DASHBOARD
   ===================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 90px; height: 90px;
  background: radial-gradient(circle at top right, var(--primary-light) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}
.kpi-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.kpi-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex; align-items: center; gap: 4px;
}
.kpi-delta {
  font-weight: 600;
}
.kpi-delta.up   { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dash-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* Charts */
.chart-wrap { padding: 8px 18px 18px; }
.chart-svg { width: 100%; height: 200px; display: block; }
.chart-legend {
  display: flex; gap: 1.25rem;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 0 6px;
}
.chart-legend-item { display: flex; align-items: center; gap: 5px; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 2px; }

/* Activity feed */
.feed-item {
  display: flex; gap: 0.75rem;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-2);
  align-items: flex-start;
}
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 28px; height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.feed-body { flex: 1; }
.feed-text { font-size: 12.5px; color: var(--text); line-height: 1.45; }
.feed-ts { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }

/* Vessel mini */
.vessel-mini {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #061a2b 0%, #0a2e4f 100%);
  border-radius: var(--r-lg);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}
.vessel-mini::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,229,255,0.03) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(0,229,255,0.03) 25px);
  pointer-events: none;
}
.vessel-mini > * { position: relative; z-index: 1; }
.vessel-icon {
  width: 46px; height: 46px;
  background: rgba(0, 229, 255, 0.18);
  border: 1px solid rgba(0,229,255,0.4);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: #00e5ff;
  flex-shrink: 0;
}
.vessel-info { flex: 1; min-width: 0; }
.vessel-name { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.vessel-status-text { font-size: 11px; color: #8bd9e8; margin-top: 1px; }
.vessel-loc { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.vessel-mini-kpis {
  display: flex; gap: 1rem;
  margin-left: auto;
}
.vessel-mini-kpi { text-align: center; }
.vessel-mini-kpi .v {
  font-family: var(--mono);
  font-size: 14px;
  color: #00e5ff;
  font-weight: 600;
}
.vessel-mini-kpi .l { font-size: 10px; color: rgba(255,255,255,0.55); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 1px; }

/* =====================================================
   TABLES
   ===================================================== */
.table-wrap { overflow-x: auto; }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody tr {
  border-bottom: 1px solid var(--border-2);
  transition: background 0.1s;
  cursor: pointer;
}
.tbl tbody tr:hover { background: var(--bg); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl td {
  padding: 11px 14px;
  color: var(--text);
  vertical-align: middle;
}
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.tbl td.muted { color: var(--text-muted); }
.tbl td.code { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.tbl td.name strong { color: var(--text); font-weight: 600; }

/* =====================================================
   STATUS PILLS / CHIPS
   ===================================================== */
.pill {
  display: inline-flex; align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill.success  { background: var(--success-bg); color: var(--success); }
.pill.warning  { background: var(--warning-bg); color: var(--warning); }
.pill.danger   { background: var(--danger-bg);  color: var(--danger); }
.pill.neutral  { background: var(--neutral-bg); color: var(--neutral); }
.pill.primary  { background: var(--primary-light); color: var(--primary); }
.pill.purple   { background: var(--purple-bg);  color: var(--purple); }
.pill.teal     { background: var(--teal-bg);    color: var(--teal); }
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* =====================================================
   FILTER BAR
   ===================================================== */
.filter-bar {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 1rem;
}
.filter-bar > .fb-spacer { flex: 1; }
.filter-bar .input, .filter-bar select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border 0.15s;
}
.filter-bar .input:focus, .filter-bar select:focus {
  border-color: var(--primary);
  background: var(--surface);
}
.filter-bar .input { min-width: 220px; }
.filter-chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.filter-chip:hover { color: var(--primary); border-color: var(--primary); }
.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* =====================================================
   PROJECT DETAIL
   ===================================================== */
.pd-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.pd-head-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.pd-code { font-family: var(--mono); font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; }
.pd-name { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-top: 3px; }
.pd-client { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pd-client strong { color: var(--text); font-weight: 600; }
.pd-meta-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-2);
}
.pd-meta-grid .lbl { font-size: 10px; color: var(--text-subtle); letter-spacing: 0.06em; text-transform: uppercase; }
.pd-meta-grid .val { font-weight: 600; color: var(--text); margin-top: 3px; font-size: 13px; }

/* Tabs */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  background: none;
  border-left: none; border-right: none; border-top: none;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Progress bar */
.progress {
  height: 6px;
  background: var(--border-2);
  border-radius: 3px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Milestone list */
.milestone {
  display: flex; gap: 0.75rem;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  margin-bottom: 6px;
  align-items: center;
}
.milestone-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--neutral);
  flex-shrink: 0;
}
.milestone-dot.done { background: var(--success); border-color: var(--success); }
.milestone-dot.in-progress { border-color: var(--warning); background: var(--warning); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 var(--warning-bg); } 50% { box-shadow: 0 0 0 4px var(--warning-bg); } }
.milestone-info { flex: 1; }
.milestone-name { font-size: 13px; font-weight: 500; color: var(--text); }
.milestone-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* =====================================================
   CRM KANBAN
   ===================================================== */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.8rem;
  min-height: 500px;
}
.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.kanban-col-head {
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.kanban-col-head h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kanban-col-head .count {
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: 100px;
}
.kanban-col-body {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.kanban-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kanban-card[data-stage="won"]         { border-left-color: var(--success); }
.kanban-card[data-stage="lost"]        { border-left-color: var(--danger); opacity: 0.65; }
.kanban-card[data-stage="lead"]        { border-left-color: var(--neutral); }
.kanban-card[data-stage="qualified"]   { border-left-color: var(--teal); }
.kanban-card[data-stage="proposal"]    { border-left-color: var(--primary); }
.kanban-card[data-stage="negotiation"] { border-left-color: var(--warning); }
.kc-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.kc-client { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.kc-row { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; }
.kc-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.kc-prob {
  font-size: 10px;
  color: var(--text-subtle);
  letter-spacing: 0.04em;
}

/* =====================================================
   FLEET
   ===================================================== */
.vessel-hero {
  background: linear-gradient(135deg, #041e33 0%, #072d4a 60%, #062135 100%);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}
.vessel-hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0,229,255,0.04) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0,229,255,0.04) 40px);
  pointer-events: none;
}
.vessel-hero > * { position: relative; z-index: 1; }
.vessel-hero h2 {
  font-family: 'Orbitron', var(--font);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}
.vessel-hero .tag-line {
  font-size: 12px;
  color: #8bd9e8;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.vessel-specs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0,229,255,0.15);
}
.vessel-spec .l { font-size: 10px; color: rgba(255,255,255,0.55); letter-spacing: 0.06em; text-transform: uppercase; }
.vessel-spec .v { font-weight: 600; font-size: 15px; color: #fff; margin-top: 3px; font-family: var(--mono); }

.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(22, 163, 74, 0.2);
  border: 1px solid rgba(22,163,74,0.4);
  color: #4ade80;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.live-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.6); }
  50%      { box-shadow: 0 0 0 4px rgba(74,222,128,0); }
}

/* =====================================================
   LIVE TRACKING MAP
   ===================================================== */
.live-map-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #041e33;
  margin-bottom: 1rem;
}
.live-map-head {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 500;
  background: rgba(4, 30, 51, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: var(--r);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.live-map-head h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
}
.live-map-head .src {
  font-size: 10px;
  color: #8bd9e8;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}
.live-map-telemetry {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 500;
  background: rgba(4, 30, 51, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: var(--r);
  padding: 10px 14px;
  color: #fff;
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
}
.live-map-telemetry .tm-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.live-map-telemetry .tm-l { font-size: 9px; color: rgba(255,255,255,0.5); letter-spacing: 0.06em; text-transform: uppercase; }
.live-map-telemetry .tm-v { font-size: 13px; font-weight: 600; color: #00e5ff; }
.live-map-telemetry .tm-v.ok { color: #4ade80; }
.live-map-legend-bar {
  position: absolute;
  bottom: 12px; left: 12px;
  z-index: 500;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(4, 30, 51, 0.7);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  letter-spacing: 0.04em;
}

#fleet-map {
  width: 100%;
  height: 380px;
  background: #041e33;
}
.leaflet-container {
  background: #041e33 !important;
  font-family: var(--font);
}
.leaflet-control-attribution {
  background: rgba(4,30,51,0.7) !important;
  color: rgba(255,255,255,0.4) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: #00a8c7 !important; }
.leaflet-control-zoom a {
  background: rgba(4,30,51,0.92) !important;
  color: #00e5ff !important;
  border: 1px solid rgba(0,229,255,0.25) !important;
}
.leaflet-control-zoom a:hover { background: #0a6ed1 !important; color: #fff !important; }

/* Vessel marker */
.vessel-marker {
  width: 28px; height: 28px;
  position: relative;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.vessel-marker-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #00e5ff;
  opacity: 0;
  animation: vesselPing 2.2s ease-out infinite;
}
.vessel-marker-body {
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  background: #00e5ff;
  border: 2px solid #041e33;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.8);
}
.vessel-marker-heading {
  position: absolute;
  top: 50%; left: 50%;
  width: 2px; height: 16px;
  background: #00e5ff;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(var(--heading, 0deg));
  box-shadow: 0 0 4px rgba(0, 229, 255, 0.6);
}
@keyframes vesselPing {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* =====================================================
   STATUS BAR
   ===================================================== */
.statusbar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1rem;
  font-size: 11px;
  color: var(--text-muted);
  gap: 1rem;
}
.statusbar .sb-item { display: flex; align-items: center; gap: 5px; }
.statusbar .sb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(22,163,74,0.4);
}
.statusbar .sb-right { margin-left: auto; display: flex; gap: 1rem; }

/* =====================================================
   STUB VIEWS
   ===================================================== */
.stub {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 3rem;
  text-align: center;
}
.stub-icon {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  border-radius: var(--r-lg);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.stub h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.stub p {
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto;
  font-size: 13px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .pd-meta-grid { grid-template-columns: repeat(3, 1fr); }
  .vessel-specs { grid-template-columns: repeat(3, 1fr); }
  .kanban { grid-template-columns: repeat(3, 1fr); }
  .kanban-col:nth-child(n+4) { display: none; }
}
@media (max-width: 960px) {
  .topbar-search { max-width: 220px; }
  .user-chip > div:not(.avatar) { display: none; }
  .user-chip { padding: 4px; }
}
@media (max-width: 768px) {
  /* Sidenav becomes an overlay drawer (doesn't push content) */
  .sidenav-backdrop { display: block; pointer-events: none; }
  body.sidenav-open .sidenav-backdrop { pointer-events: all; }

  .app-shell { grid-template-rows: 52px 1fr; }
  .statusbar { display: none; }

  .layout, body.sidenav-open .layout { grid-template-columns: 1fr; }
  .sidenav {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  body.sidenav-open .sidenav { transform: translateX(0); }

  .topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .topbar-brand {
    min-width: 0;
    border-right: none;
    padding-right: 0;
    gap: 6px;
  }
  .topbar-brand .suffix { display: none; }
  .topbar-search { display: none; }

  /* Touch targets */
  .tb-btn { width: 40px; height: 40px; }
  .side-link { padding: 12px 14px; font-size: 14px; }
  .btn, .btn-primary, .btn-ghost {
    min-height: 38px;
  }

  /* Content density */
  .main { padding: 0.85rem !important; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem !important; }
  .pd-meta-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .vessel-specs { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .kanban-col:nth-child(n+2) { display: none; }
  .role-grid { grid-template-columns: 1fr !important; }

  /* Page header stack */
  .page-header { flex-direction: column; align-items: stretch; gap: 0.65rem; }
  .page-actions { flex-wrap: wrap; }

  /* Process flow scrolls horizontally */
  .process-flow { overflow-x: auto; padding-bottom: 0.5rem; }
  .process-stage { min-width: 180px; flex-shrink: 0; }

  /* Tables already have overflow-x via .table-wrap */
  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { padding: 8px 10px; }

  /* Entity switcher compact */
  .entity-name { max-width: 110px; }
  .entity-trigger { padding: 6px 8px; font-size: 12px; }
}

@media (max-width: 480px) {
  .topbar-brand span:not(.suffix) { display: none; }
  .lang-btn { padding: 4px 8px; }
  .topbar-actions { gap: 0.15rem; }
  .topbar-actions .tb-btn[title="Ayuda"] { display: none; }
  .user-chip-caret { display: none; }
  .user-chip { padding: 2px; }

  .kpi-grid { grid-template-columns: 1fr !important; }
  .fx-grid { grid-template-columns: 1fr !important; }
  .fx-converter { grid-template-columns: 1fr; }
  .fx-conv-arrow { display: none; }

  .page-title { font-size: 1.05rem; }
  .breadcrumb { font-size: 11px; }

  .card-body { padding: 0.85rem !important; }
}

/* =====================================================
   ENTITY SWITCHER (topbar)
   ===================================================== */
.entity-switcher {
  position: relative;
  margin-right: 0.5rem;
}
.entity-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  transition: border 0.15s, background 0.15s;
  height: 30px;
}
.entity-trigger:hover { border-color: var(--primary); background: var(--surface-2); }
.entity-name { font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}
.entity-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
.entity-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.entity-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--r-sm);
  transition: background 0.1s;
}
.entity-option:hover { background: var(--bg); }
.entity-option.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* =====================================================
   FX RATES
   ===================================================== */
.fx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.fx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  transition: box-shadow 0.15s, transform 0.15s, border 0.15s;
}
.fx-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--primary-light); }
.fx-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 0.85rem; }
.fx-flag { font-size: 1.5rem; line-height: 1; }
.fx-code { font-family: var(--font); font-weight: 700; font-size: 14px; letter-spacing: 0.04em; color: var(--text); }
.fx-name { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.fx-rate-row { display: flex; gap: 1.5rem; }
.fx-rate-block { flex: 1; }
.fx-rate-lbl { font-size: 10px; color: var(--text-subtle); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 3px; }
.fx-rate-val { font-family: var(--mono); font-size: 1.1rem; font-weight: 600; color: var(--primary); line-height: 1.1; }

.fx-converter {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto 1fr 1.4fr;
  gap: 0.75rem;
  align-items: end;
}
.fx-conv-input { display: flex; flex-direction: column; gap: 4px; }
.fx-conv-input label {
  font-size: 11px; color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.fx-conv-input input, .fx-conv-input select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r);
  font-size: 14px;
  outline: none;
}
.fx-conv-input input:focus, .fx-conv-input select:focus { border-color: var(--primary); }
.fx-conv-arrow { font-size: 1.2rem; color: var(--text-subtle); padding: 0 4px; align-self: center; }
.fx-conv-result {
  background: var(--primary-light);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--r);
  text-align: right;
  letter-spacing: -0.01em;
}

/* =====================================================
   CxP TABLE TWEAKS
   ===================================================== */
.tbl.tbl-dense thead th { padding: 8px 10px; font-size: 10px; }
.tbl.tbl-dense td { padding: 7px 10px; font-size: 12px; }
.tbl.tbl-dense td.code { font-size: 11px; }
.tbl.tbl-dense td.num { font-size: 11.5px; }
/* OC form styles */
.oc-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.oc-form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
}
.oc-section-title {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-2);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; }
.form-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-field label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.form-field input, .form-field select, .form-field textarea, .oc-form-section > textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
.oc-form-section > textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-field textarea, .oc-form-section > textarea {
  resize: vertical;
  font-family: var(--font);
}
.form-field.featured input { border-color: rgba(10,110,209,0.4); background: #f5f9fd; }
.form-field.featured label { color: var(--primary); }
.form-field.featured input:focus { background: var(--surface); }

/* Read-only state: visually muted to indicate "click Editar to change" */
.form-field input[readonly],
.form-field textarea[readonly],
.form-field select[disabled] {
  background: transparent;
  border-color: transparent;
  color: var(--text);
  cursor: default;
  padding-left: 2px;
}
.form-field input[readonly]:focus,
.form-field textarea[readonly]:focus,
.form-field select[disabled]:focus {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}
.dash-grid.readonly .form-field label { color: var(--text-subtle); }
.form-hint {
  font-size: 10px;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* Line items table */
.oc-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.oc-items-table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.oc-items-table tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-2);
}
.oc-items-table tbody td:first-child { padding-left: 8px; }
.oc-items-table input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 13px;
  outline: none;
}
.oc-items-table input:hover { border-color: var(--border); }
.oc-items-table input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 2px var(--primary-light); }
.oc-items-table tfoot td { padding: 8px; }
.oc-line-total { padding-right: 10px !important; text-align: right; }
.oc-remove-line {
  width: 24px; height: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.oc-remove-line:hover:not([disabled]) {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

@media (max-width: 1100px) {
  .form-grid-3, .form-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
}

/* FX edit affordances */
.fx-card-edited { border-color: rgba(217,119,6,0.3); background: rgba(254,243,226,0.4); }
.fx-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.fx-edit-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.fx-rate-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
}
.fx-rate-input:focus { box-shadow: 0 0 0 3px var(--primary-light); }
.fx-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-2);
}
.hidden { display: none !important; }

/* Import OC view */
.import-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}
.import-dropzone:hover, .import-dropzone:focus {
  border-color: var(--primary);
  background: var(--primary-light);
  outline: none;
}
.import-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.005);
  border-style: solid;
}
.import-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 1rem;
}
.import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  transition: border 0.15s;
}
.import-card:hover { border-color: rgba(10,110,209,0.3); }
.import-card-blocked { opacity: 0.65; background: rgba(220,38,38,0.02); }
.import-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.import-card-head input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}
.import-card-title { flex: 1; min-width: 0; }
.import-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 16px;
  font-size: 12.5px;
  padding-left: 30px;
}
.import-card-grid .il { color: var(--text-muted); margin-right: 4px; }
.import-card-issues {
  margin-top: 10px;
  padding-top: 10px;
  padding-left: 30px;
  border-top: 1px solid var(--border-2);
  display: flex; flex-direction: column; gap: 4px;
}
.import-issue { font-size: 12px; }
.import-issue.err  { color: var(--danger); }
.import-issue.warn { color: var(--warning); }

@media (max-width: 800px) {
  .import-card-grid { grid-template-columns: 1fr 1fr; }
}

/* =====================================================
   OC WORKFLOW VISUALIZER
   ===================================================== */
.oc-workflow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1rem;
}
.oc-workflow-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.oc-workflow-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text);
}
.oc-workflow-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.oc-workflow-progress-track {
  flex: 1;
  height: 6px;
  background: var(--border-2);
  border-radius: 3px;
  overflow: hidden;
  max-width: 320px;
}
.oc-workflow-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.oc-workflow-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.oc-workflow-step {
  flex: 1 1 90px;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.oc-workflow-step:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.oc-workflow-step.done {
  background: var(--success-bg);
  border-color: rgba(22, 163, 74, 0.4);
}
.oc-workflow-step.done .oc-step-num {
  background: var(--success);
  color: #fff;
}
.oc-workflow-step.manual::after {
  content: '';
  position: absolute;
}
.oc-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s;
}
.oc-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.oc-workflow-step.done .oc-step-label {
  color: var(--success);
}
.oc-step-meta {
  font-size: 9px;
  color: var(--text-subtle);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.oc-workflow-connector {
  flex: 0 0 14px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  align-self: center;
  margin-top: -22px;
}
.oc-workflow-connector.done {
  background: var(--success);
}

@media (max-width: 900px) {
  .oc-workflow-steps { gap: 4px; }
  .oc-workflow-step { flex-basis: 70px; min-width: 70px; padding: 10px 4px; }
  .oc-step-label { font-size: 10px; }
  .oc-workflow-connector { display: none; }
}

/* =====================================================
   DASHBOARD: Procure-to-Pay flow viz
   ===================================================== */
.p2p-flow {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 0;
  min-height: 140px;
}
.p2p-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.p2p-stage-bar {
  width: 100%;
  max-width: 80px;
  border-radius: 8px 8px 4px 4px;
  transition: height 0.4s ease, opacity 0.3s ease;
  min-height: 12px;
}
.p2p-stage-num {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text);
  line-height: 1;
  margin-top: 6px;
}
.p2p-stage-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  font-weight: 500;
}
.p2p-arrow {
  align-self: flex-end;
  color: var(--text-subtle);
  font-size: 1.2rem;
  padding-bottom: 38px;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .p2p-flow { gap: 4px; }
  .p2p-stage-num { font-size: 1.1rem; }
  .p2p-stage-label { font-size: 9px; }
  .p2p-arrow { font-size: 1rem; padding-bottom: 32px; }
}

/* =====================================================
   PROCESO — Procurement-to-Pay flowchart
   ===================================================== */
.process-flow {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1rem;
}
.process-stage {
  flex: 1 1 130px;
  min-width: 130px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
  cursor: pointer;
}
.process-stage:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.process-stage-num {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.process-stage-body { flex: 1; min-width: 0; }
.process-stage-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.process-stage-doc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}
.process-stage-who { margin-bottom: 8px; }
.process-stage-person {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.2;
  word-break: break-word;
}
.process-stage-count {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
}
.process-stage-count-lbl {
  font-family: var(--font);
  font-weight: 500;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 4px;
}
.process-arrow {
  align-self: center;
  color: var(--text-subtle);
  font-size: 1.4rem;
  flex-shrink: 0;
}

@media (max-width: 1300px) {
  .process-flow { flex-direction: column; }
  .process-stage { flex: 1 1 100%; }
  .process-arrow { align-self: center; transform: rotate(90deg); margin: 4px 0; font-size: 1.2rem; }
}

/* =====================================================
   ROLE LEGEND
   ===================================================== */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.role-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
}
.role-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.role-head strong { font-size: 13px; color: var(--text); }
.role-body {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 8px;
}
.role-steps {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-subtle);
  letter-spacing: 0.04em;
  padding-top: 6px;
  border-top: 1px solid var(--border-2);
}

/* =====================================================
   DOC LIST
   ===================================================== */
.doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.doc-item-num {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
  min-width: 22px;
  text-align: center;
}
.doc-item-label {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
}

/* =====================================================
   COMITÉ DE PAGOS — workspace
   ===================================================== */
.comite-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 16px;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.comite-prio-pills {
  display: inline-flex;
  gap: 3px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 2px;
}
.comite-prio {
  width: 24px;
  height: 22px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
}
.comite-prio:hover { background: var(--surface); border-color: var(--border); }
.comite-prio.active.prio-1 { background: var(--danger);  color: #fff; }
.comite-prio.active.prio-2 { background: var(--warning); color: #fff; }
.comite-prio.active.prio-3 { background: var(--neutral); color: #fff; }

.comite-row-actions {
  display: inline-flex;
  gap: 3px;
}
.comite-act {
  width: 26px;
  height: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--text-muted);
}
.comite-act:hover { transform: translateY(-1px); }
.comite-act.approve:hover { background: var(--success); color: #fff; border-color: var(--success); }
.comite-act.reject:hover  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.comite-act.defer:hover   { background: var(--warning); color: #fff; border-color: var(--warning); }
.comite-act.pending:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.comite-note {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 11.5px;
  border-radius: var(--r-sm);
  color: var(--text);
}
.comite-note:hover { border-color: var(--border); background: var(--surface-2); }
.comite-note:focus { border-color: var(--primary); background: var(--surface); outline: none; }

.tbl tr.is-selected td {
  background: rgba(10, 110, 209, 0.05);
}

/* =====================================================
   ASIENTO PREVIEW PANEL on OC detail
   ===================================================== */
.asiento-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  position: relative;
}
.asiento-panel.is-preview {
  background: linear-gradient(180deg, #fafbfd 0%, #f4f6fa 100%);
  border-style: dashed;
  border-color: var(--border);
}
.asiento-panel.is-generated {
  border-color: rgba(22,163,74,0.4);
  box-shadow: 0 0 0 1px rgba(22,163,74,0.2);
}
.asiento-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-2);
  gap: 1rem;
}
.asiento-panel-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.asiento-panel-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.asiento-panel-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
}
.asiento-panel-body { padding: 14px 18px; }
.asiento-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.asiento-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.asiento-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}
.asiento-table tfoot td {
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: var(--surface-2);
  font-size: 12px;
}
.asiento-code {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-block;
  min-width: 50px;
  text-align: center;
}
.asiento-amt {
  font-family: var(--mono);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.asiento-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-2);
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.asiento-meta strong { color: var(--text); font-weight: 600; }

/* =====================================================
   ESTADOS FINANCIEROS REPORT
   ===================================================== */
.tbl.ef-report {
  font-size: 13px;
}
.tbl.ef-report tr.ef-section td {
  background: var(--surface-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 12px 6px;
  border-top: 1px solid var(--border);
}
.tbl.ef-report tr.ef-root td {
  background: rgba(10, 110, 209, 0.03);
}
.tbl.ef-report tr.ef-subtotal td {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--primary);
  border-top: 1px solid var(--primary-light);
  padding-top: 6px;
  padding-bottom: 6px;
}
.tbl.ef-report tr.ef-total td {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 14px;
  border-top: 2px solid var(--primary);
  padding: 10px 12px;
}

/* =====================================================
   GUÍA DE USO — YOSELIN
   ===================================================== */
.guia-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.4rem;
  margin-top: 1rem;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.guia-intro p { margin-bottom: 0.5rem; }
.guia-intro p:last-child { margin-bottom: 0; }
.guia-intro strong { color: var(--primary); }

.guia-toc {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 0.9rem 1.2rem;
  margin: 1.25rem 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.85;
}
.guia-toc strong { color: var(--text); margin-right: 6px; }
.guia-toc a { color: var(--primary); text-decoration: none; padding: 0 4px; }
.guia-toc a:hover { text-decoration: underline; }

.guia-section-h {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 0.85rem;
  padding-top: 0.5rem;
  border-top: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.guia-step {
  display: flex;
  gap: 16px;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.guia-step-num {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(10,110,209,0.25);
}
.guia-step-body { flex: 1; min-width: 0; }
.guia-step-body h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  margin-top: 4px;
}
.guia-step-body p {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 0.7rem;
}
.guia-step-body p:last-child { margin-bottom: 0; }
.guia-step-body ul, .guia-step-body ol {
  padding-left: 1.4rem;
  margin: 0.5rem 0 0.9rem;
  font-size: 13.5px;
  line-height: 1.65;
}
.guia-step-body li { margin-bottom: 4px; }
.guia-step-body code {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--primary);
}
.guia-step-body a { color: var(--primary); text-decoration: none; }
.guia-step-body a:hover { text-decoration: underline; }

.guia-checklist {
  list-style: none !important;
  padding-left: 0 !important;
}
.guia-checklist li {
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 4px;
  margin-bottom: 3px !important;
}

/* Screenshot frame */
.guia-shot {
  margin: 1rem 0 0.25rem;
  padding: 0;
}
.guia-shot-frame {
  position: relative;
  background: linear-gradient(135deg, #f5f7fa, #eef2f7);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  min-height: 180px;
  box-shadow: var(--shadow-sm);
}
.guia-shot-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.guia-shot-placeholder {
  display: flex;        /* shown by JS when img fails to load (default flex when img missing) */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 12px,
    rgba(10,110,209,0.04) 12px,
    rgba(10,110,209,0.04) 24px
  );
}
/* When image loads successfully, the JS handler sets img.style.display='' (default block);
   we keep placeholder hidden by default UNLESS img onerror reveals it */
.guia-shot-frame img + .guia-shot-placeholder {
  display: none;
}
.guia-shot-frame img[src=""] + .guia-shot-placeholder,
.guia-shot-frame img:not([src]) + .guia-shot-placeholder {
  display: flex;
}
.guia-shot-placeholder-icon {
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}
.guia-shot-placeholder-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 480px;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}
.guia-shot-placeholder-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-subtle);
  background: rgba(255,255,255,0.7);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px dashed var(--border);
}
.guia-shot figcaption {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Comparison table */
.guia-comparison {
  margin: 1rem 0 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  overflow: hidden;
}
.guia-comparison .tbl { width: 100%; }
.guia-comparison .tbl th {
  background: var(--surface-2);
  font-size: 12px;
}
.guia-comparison .tbl td:first-child {
  font-weight: 600;
  color: var(--text);
}
.guia-comparison .tbl td:nth-child(2) { color: var(--text-muted); }
.guia-comparison .tbl td:nth-child(3) { color: var(--success); font-weight: 500; }

/* Print styles for the guide */
@media print {
  .topbar, .sidenav, .statusbar, .breadcrumb, .page-actions { display: none !important; }
  .layout { grid-template-columns: 1fr !important; }
  .guia-step { break-inside: avoid; box-shadow: none; }
  .guia-shot { break-inside: avoid; }
  .guia-shot-frame { background: white; }
}

@media (max-width: 768px) {
  .guia-step { flex-direction: column; padding: 1rem; }
  .guia-step-num { width: 32px; height: 32px; font-size: 14px; }
  .guia-comparison { overflow-x: auto; }
}

/* =====================================================
   HELP TICKET MODAL
   ===================================================== */
.help-ticket-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-ticket-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.help-ticket-card {
  position: relative;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.help-ticket-card > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.help-ticket-card > header h3 { margin: 0; font-size: 15px; }
.help-ticket-close {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}
.help-ticket-close:hover { background: var(--surface-2); color: var(--text); }
.help-ticket-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.help-ticket-card > footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.help-ticket-context summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}

/* =====================================================
   COLUMN RESIZE — draggable column borders for .tbl
   ===================================================== */
.tbl-resizable thead th {
  /* Allow handle absolute-positioning; prevent text from extending past width */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
  background: transparent;
  transition: background 0.12s;
}
.col-resize-handle:hover,
.col-resize-handle.is-dragging {
  background: var(--primary);
  opacity: 0.4;
}
body.col-resizing,
body.col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast-host {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
  white-space: pre-line;
}
.toast.toast-in { opacity: 1; transform: translateX(0); }
.toast-info    { border-left-color: var(--primary); }
.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error   { border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

@media (max-width: 768px) {
  .toast-host { right: 12px; left: 12px; max-width: none; }
}

/* =====================================================
   GEO AGENTE — slide-out AI chat panel
   ===================================================== */
.geo-agente-tab {
  position: fixed;
  /* Lower quadrant — sits ~30% above bottom edge, away from status bar */
  bottom: 120px;
  right: 0;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px 11px 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  /* Tucked away by default — only the icon (~44px) peeks out */
  transform: translateX(calc(100% - 48px));
  transition: transform 0.32s cubic-bezier(.34, 1.56, .64, 1),
              box-shadow 0.25s, padding 0.2s;
  box-shadow:
    -2px 4px 14px rgba(10, 110, 209, 0.35),
    0 0 18px rgba(10, 110, 209, 0.55);
  /* Entrance: pop in + flash bright, then continuous glow pulse */
  animation: ga-tab-entrance 1.6s ease-out 0.4s backwards,
             ga-tab-pulse-glow 2.6s ease-in-out 2s infinite;
}
.geo-agente-tab:hover {
  transform: translateX(0);
  box-shadow:
    -4px 8px 22px rgba(10, 110, 209, 0.5),
    0 0 32px rgba(10, 110, 209, 0.85);
  animation: ga-tab-pulse-glow 2.6s ease-in-out infinite;
}
.geo-agente-tab .ga-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.geo-agente-tab .ga-tab-icon svg {
  display: block;
  filter: drop-shadow(0 0 4px rgba(155, 233, 244, 0.6));
}
.geo-agente-tab .ga-tab-label {
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s 0.05s, transform 0.2s 0.05s;
}
.geo-agente-tab:hover .ga-tab-label {
  opacity: 1;
  transform: translateX(0);
}

@keyframes ga-tab-entrance {
  0%   { opacity: 0; filter: brightness(1)   saturate(1)   blur(2px); }
  25%  { opacity: 1; filter: brightness(1.6) saturate(1.6) blur(0);   }
  60%  {            filter: brightness(1.25) saturate(1.2) blur(0);   }
  100% { opacity: 1; filter: brightness(1)   saturate(1)   blur(0);   }
}
@keyframes ga-tab-pulse-glow {
  0%, 100% { box-shadow: -2px 4px 14px rgba(10, 110, 209, 0.35), 0 0 18px rgba(10, 110, 209, 0.55); }
  50%      { box-shadow: -2px 4px 18px rgba(10, 110, 209, 0.55), 0 0 34px rgba(10, 110, 209, 0.9);  }
}

body.geo-agente-open .geo-agente-tab {
  transform: translateX(100%);
  pointer-events: none;
  opacity: 0;
  animation: none;
}

.geo-agente-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.25);
  z-index: 994;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
body.geo-agente-open .geo-agente-backdrop {
  opacity: 1;
  pointer-events: all;
}

.geo-agente-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 50%;
  min-width: 380px;
  max-width: 720px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(16, 24, 40, 0.12);
  z-index: 995;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
body.geo-agente-open .geo-agente-panel {
  transform: translateX(0);
}

.ga-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ga-panel-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}
.ga-panel-actions { display: flex; gap: 6px; }

.ga-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.ga-welcome {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.ga-welcome-icon { display: flex; justify-content: center; margin-bottom: 0.5rem; filter: drop-shadow(0 0 10px rgba(10, 110, 209, 0.4)); }
.ga-welcome h3 { color: var(--text); font-size: 1.1rem; margin-bottom: 0.4rem; }
.ga-welcome p { font-size: 13px; max-width: 420px; margin: 0 auto; line-height: 1.55; }
.ga-suggestions {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 1.25rem;
  align-items: stretch;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}
.ga-suggestion {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: left;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: var(--font);
}
.ga-suggestion:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.ga-msg {
  display: flex;
}
.ga-msg.ga-user { justify-content: flex-end; }
.ga-msg.ga-assistant { justify-content: flex-start; }
.ga-bubble {
  max-width: 90%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ga-msg.ga-user .ga-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ga-msg.ga-assistant .ga-bubble {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.ga-bubble strong { font-weight: 700; }
.ga-bubble code {
  background: rgba(10,110,209,0.08);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 12px;
}
.ga-bubble ul { margin: 4px 0 4px 18px; padding: 0; }
.ga-bubble li { margin: 2px 0; }

.ga-typing {
  display: inline-flex; gap: 3px; align-items: center;
  vertical-align: middle;
}
.ga-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: gaPulse 1.2s infinite ease-in-out;
}
.ga-typing span:nth-child(2) { animation-delay: 0.2s; }
.ga-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes gaPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%           { opacity: 1;   transform: scale(1); }
}

.ga-panel-foot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 14px 12px;
}
.ga-panel-foot form {
  display: flex; gap: 8px; align-items: flex-end;
}
.ga-panel-foot textarea {
  flex: 1;
  min-height: 40px;
  resize: none;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.ga-panel-foot textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.ga-panel-foot .btn {
  flex-shrink: 0;
}
.ga-foot-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-subtle);
  text-align: center;
}

@media (max-width: 768px) {
  .geo-agente-tab { bottom: 90px; }
  .geo-agente-panel { width: 100%; max-width: none; min-width: 0; }
  .geo-agente-tab .ga-tab-label { display: none; }
}

/* =====================================================
   ASIENTO SECTION on OC detail (moved to bottom, May 7 feedback)
   ===================================================== */
.asiento-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}
.asiento-section-head {
  margin-bottom: 1rem;
}
.asiento-section-head h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.asiento-section-head p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 720px;
  margin: 0;
}
.asiento-section .asiento-panel {
  margin-top: 0;
  /* slightly larger inner padding so the table breathes */
}
.asiento-section .asiento-panel-title { font-size: 16px; }
.asiento-section .asiento-table { font-size: 14px; }
.asiento-section .asiento-table th { padding: 10px 12px; }
.asiento-section .asiento-table td { padding: 10px 12px; }

/* =====================================================
   SIDENAV — process-first reorganization (May 12)
   ===================================================== */
.side-label-accent {
  color: var(--primary) !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  font-size: 10px !important;
}
.side-label-construction {
  color: var(--warning) !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  font-size: 10px !important;
  opacity: 0.85;
}
.side-construction .side-link {
  opacity: 0.55;
  font-style: italic;
}
.side-construction .side-link:hover { opacity: 0.85; }
.side-construction .side-link.active { opacity: 1; font-style: normal; }
.side-flow-link {
  padding-left: 8px !important;
}
.side-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--primary-light);
}
.side-flow-link.active .side-step {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 168, 199, 0.25);
}
.side-flow-link:not(.active) .side-step {
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid var(--primary-light);
  box-shadow: none;
}

/* Collapsible "Otros módulos" section */
.side-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
}
.side-section-toggle:hover { color: var(--text); }
.side-section-caret {
  font-size: 14px;
  transition: transform 0.15s;
  display: inline-block;
  line-height: 1;
}
.side-section-toggle.open .side-section-caret {
  transform: rotate(180deg);
}
.side-section-body {
  margin-bottom: 4px;
}

/* =====================================================
   INLINE FX CONVERTER on OC create/edit form
   ===================================================== */
.oc-fx-inline {
  background: linear-gradient(135deg, var(--primary-light), #f5f9fd);
  border: 1px solid var(--primary-light);
  border-radius: var(--r);
  padding: 10px 14px;
  margin-top: 2px;
}
.oc-fx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.oc-fx-lhs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text);
}
.oc-fx-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.oc-fx-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--primary-light);
  flex-wrap: wrap;
}
.oc-fx-edit.hidden { display: none; }
.oc-fx-edit-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.oc-fx-edit-suffix {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}
#ocFxEditInput {
  width: 140px;
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  outline: none;
}
#ocFxEditInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
