:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #111318;
  --surface: #191c22;
  --surface-2: #20242b;
  --surface-3: #292e37;
  --border: #303640;
  --text: #f2f5f7;
  --muted: #99a3af;
  --brand: #16a085;
  --brand-strong: #1fbd9d;
  --brand-soft: rgba(31, 189, 157, 0.13);
  --danger: #ef6262;
  --danger-soft: rgba(239, 98, 98, 0.14);
  --amber: #f0b45b;
  --amber-soft: rgba(240, 180, 91, 0.14);
  --blue: #64a9ff;
  --blue-soft: rgba(100, 169, 255, 0.14);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
}

.login-background {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(31, 189, 157, 0.18), transparent 34%),
    radial-gradient(circle at 83% 84%, rgba(80, 104, 142, 0.2), transparent 30%),
    linear-gradient(145deg, #101217 0%, #171b22 58%, #111318 100%);
}

.login-background::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 500px);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(26, 30, 37, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand { display: grid; gap: 13px; }
.brand-logo { display: block; width: min(100%, 218px); height: auto; object-fit: contain; object-position: left center; }
.brand-copy { display: block; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; line-height: 1.35; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.brand-login { padding-bottom: 26px; border-bottom: 1px solid var(--border); }
.brand-login .brand-logo { width: min(100%, 278px); }
.brand-login strong { font-size: 15px; }

.login-heading { padding: 28px 0 18px; }
.login-heading h1 { margin: 5px 0 10px; font-size: 30px; letter-spacing: -0.035em; }
.login-heading p:last-child { margin: 0; color: var(--muted); line-height: 1.6; }
.login-version { margin: 22px 0 0; color: #68727e; font-size: 11px; text-align: center; }

.eyebrow {
  margin: 0;
  color: var(--brand-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.form-stack { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 7px;
  color: #c8d0d7;
  font-size: 12px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #15181e;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input, select { height: 43px; padding: 0 13px; }
textarea { min-height: 92px; padding: 11px 13px; resize: vertical; }

input::placeholder { color: #68727e; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: #181c22;
  box-shadow: 0 0 0 3px rgba(31, 189, 157, 0.12);
}

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button-wide { width: 100%; }
.button-primary { background: var(--brand); color: #051b17; }
.button-primary:hover:not(:disabled) { background: var(--brand-strong); }
.button-secondary { border-color: var(--border); background: var(--surface-2); color: #dce2e7; }
.button-secondary:hover:not(:disabled) { border-color: #434b57; background: var(--surface-3); }
.button-ghost { border-color: var(--border); background: transparent; color: var(--muted); }
.button-quiet { min-height: 32px; padding-inline: 10px; border-color: transparent; background: transparent; color: var(--brand-strong); }
.button-quiet:hover:not(:disabled) { border-color: rgba(31, 189, 157, 0.24); background: var(--brand-soft); }
.button-danger { background: var(--danger); color: #270606; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: 2px;
}

.form-error {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid rgba(239, 98, 98, 0.25);
  border-radius: 10px;
  background: var(--danger-soft);
  color: #ffaaaa;
  font-size: 12px;
  line-height: 1.5;
}

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 278px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: #15181d;
}

.sidebar .brand { padding: 0 6px 24px; }
.nav-list { display: grid; gap: 7px; margin-top: 16px; overflow-y: auto; }
.nav-item {
  display: flex;
  width: 100%;
  min-height: 45px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { border-color: rgba(31, 189, 157, 0.2); background: var(--brand-soft); color: var(--brand-strong); }
.nav-icon { display: inline-grid; width: 23px; height: 23px; place-items: center; font-size: 18px; }
.nav-source-picker {
  display: grid;
  gap: 8px;
  margin: 1px 0 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}
.nav-source-picker > span { display: flex; align-items: center; gap: 9px; }
.nav-source-picker select { height: 38px; font-size: 11px; }
.nav-source-picker.active { border-color: rgba(31, 189, 157, 0.32); background: var(--brand-soft); color: var(--brand-strong); }
.sidebar-footer { margin-top: auto; }
.sidebar-version { margin: 0 0 12px; color: #68727e; font-size: 9px; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }

.profile-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.profile-block strong, .profile-block small { display: block; }
.profile-block strong { font-size: 12px; }
.profile-block small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); font-weight: 900; }

.main-column { min-width: 0; }
.topbar {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 34px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 19, 24, 0.94);
  backdrop-filter: blur(12px);
}

.topbar h1 { margin: 5px 0 0; font-size: 23px; letter-spacing: -0.025em; }
.page-description { max-width: 720px; margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.connection-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-strong); box-shadow: 0 0 0 4px var(--brand-soft); }

.content { padding: 28px 34px 46px; }

.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.panel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

.filter-toolbar { border-top: 1px solid var(--border); background: #171a20; }
.filter-toolbar-heading { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 22px 4px; }
.filter-toolbar-heading strong, .filter-toolbar-heading span { display: block; }
.filter-toolbar-heading strong { color: #dde3e8; font-size: 11px; }
.filter-toolbar-heading span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 10px; padding: 10px 22px 13px; }
.filters label > span { color: #8f99a5; font-size: 9px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.filter-field-wide { grid-column: span 2; }
.search-field { position: relative; }
.search-field input { padding-left: 37px; }
.search-field::before { content: "⌕"; position: absolute; z-index: 1; top: 30px; left: 13px; color: var(--muted); font-size: 19px; font-weight: 400; }
.filter-feedback { min-height: 32px; padding: 5px 22px 11px; color: #7f8a96; font-size: 10px; }

.table-wrap { position: relative; min-height: 310px; max-height: min(68vh, 720px); overflow: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); transition: opacity 120ms ease; }
.table-wrap[aria-busy="true"] { cursor: progress; opacity: 0.68; }
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #292e36; text-align: left; white-space: nowrap; }
th { position: sticky; z-index: 2; top: 0; background: #1b1f25; color: #a2acb7; font-size: 10px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
tbody tr { transition: background 130ms ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr:nth-child(even) td { background-color: rgba(255, 255, 255, 0.012); }
td { color: #cdd4da; }
td strong { color: var(--text); }
td > span, td > strong { display: block; max-width: 290px; overflow: hidden; text-overflow: ellipsis; }
th:nth-child(1), td:nth-child(1) { position: sticky; left: 0; z-index: 3; width: 128px; min-width: 128px; max-width: 128px; background: #1b1f25; }
td:nth-child(1) { background: var(--surface); }
th:nth-child(2), td:nth-child(2) { position: sticky; left: 128px; z-index: 3; width: 132px; min-width: 132px; max-width: 132px; border-right: 1px solid var(--border); background: #1b1f25; }
td:nth-child(2) { background: var(--surface); }
tbody tr:nth-child(even) td:nth-child(1), tbody tr:nth-child(even) td:nth-child(2), tbody tr:nth-child(even) td.actions-sticky { background: #1b1e24; }
tbody tr:hover td:nth-child(1), tbody tr:hover td:nth-child(2) { background: #20242a; }
.actions-column { width: 224px; min-width: 224px; text-align: right; }
.actions-sticky { position: sticky; right: 0; z-index: 3; border-left: 1px solid var(--border); background: #1b1f25; }
td.actions-sticky { background: var(--surface); }
tbody tr:hover td.actions-sticky { background: #20242a; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.table-button { display: inline-flex; min-height: 32px; align-items: center; gap: 5px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: #b5bec7; cursor: pointer; font-size: 10px; font-weight: 800; }
.table-button:hover { border-color: #4a5360; color: var(--text); }
.table-button.primary { border-color: rgba(31, 189, 157, 0.24); background: var(--brand-soft); color: var(--brand-strong); }
.table-button.danger:hover { border-color: rgba(239, 98, 98, 0.5); background: var(--danger-soft); color: #ff9999; }

.inventory-table th { padding: 8px 12px; }
.inventory-table td { padding: 6px 12px; line-height: 1.25; }
.inventory-table .row-actions { gap: 4px; }
.inventory-table .table-button { min-height: 26px; padding: 0 7px; border-radius: 6px; font-size: 9px; }
.inventory-table .status, .inventory-table .source-badge, .inventory-table .value-badge { padding: 3px 6px; }
.inventory-table .actions-column { width: 194px; min-width: 194px; }

.source-badge, .value-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 820; }
.source-badge { border: 1px solid rgba(100, 169, 255, 0.2); background: var(--blue-soft); color: #aaceff; }
.value-badge { background: rgba(151, 160, 172, 0.12); color: #bac2ca; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-activo { background: var(--brand-soft); color: var(--brand-strong); }
.status-en_revision { background: var(--amber-soft); color: var(--amber); }
.status-desconectado, .status-offline_incendio_2024, .status-sustraido { background: var(--danger-soft); color: #ff9c9c; }
.status-regularizado { background: var(--blue-soft); color: #aaceff; }
.status-en_proyecto_pendiente_umed { background: var(--amber-soft); color: var(--amber); }
.status-retirado, .status-baja { background: rgba(151, 160, 172, 0.12); color: #a7b0ba; }

.empty-state { display: grid; min-height: 310px; place-items: center; align-content: center; padding: 32px; text-align: center; }
.empty-symbol { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 15px; background: var(--surface-3); color: var(--muted); font-size: 24px; }
.empty-state h3 { margin: 14px 0 7px; font-size: 15px; }
.empty-state p { margin: 0 0 17px; color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 13px; padding: 15px 22px; }
.pagination span { color: var(--muted); font-size: 11px; }

.dialog {
  width: min(calc(100% - 30px), 760px);
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: auto;
  border: 1px solid #39404b;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop { background: rgba(3, 5, 8, 0.74); backdrop-filter: blur(4px); }
.dialog form { padding: 0; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.dialog-heading h2 { margin: 5px 0 0; font-size: 20px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 21px; line-height: 1; }
.icon-button:hover { color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 22px 24px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.dialog .form-error { margin: 0 24px 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 17px 24px; border-top: 1px solid var(--border); background: #171a1f; }
.dialog-detail { width: min(calc(100% - 30px), 1080px); }
.dialog-wide { width: min(calc(100% - 30px), 1120px); }
.record-context { display: flex; gap: 11px; align-items: center; margin: 18px 24px 0; padding: 12px 14px; border: 1px solid rgba(31, 189, 157, 0.24); border-radius: 12px; background: var(--brand-soft); }
.record-context-icon { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: rgba(31, 189, 157, 0.15); color: var(--brand-strong); font-weight: 900; }
.record-context strong { display: block; color: #dce8e5; font-size: 11px; }
.record-context p { margin: 3px 0 0; color: #93aaa5; font-size: 10px; line-height: 1.45; }
.form-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.smart-form-section { display: flex; align-items: baseline; gap: 10px; margin: 5px 0 -4px; padding: 0 0 8px; border-bottom: 1px solid var(--border); }
.smart-form-section:first-child { margin-top: 0; }
.smart-form-section strong { color: #e5e9ec; font-size: 12px; }
.smart-form-section span { color: var(--muted); font-size: 10px; font-weight: 500; }
.smart-form-notice { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid rgba(77, 143, 180, 0.25); border-radius: 10px; background: rgba(77, 143, 180, 0.08); }
.smart-form-notice strong { color: #c9dce7; font-size: 10px; }
.smart-form-notice span { color: #8fa8b6; font-size: 9px; line-height: 1.5; }
.smart-form-notice.warning { border-color: rgba(240, 180, 91, 0.3); background: var(--amber-soft); }
.smart-form-notice.warning strong, .smart-form-notice.warning span { color: #f4c77f; }
.smart-field { min-width: 0; }
.smart-field > span:first-child, .camp-field > span:first-child { color: #c8d0d7; font-size: 12px; font-weight: 700; }
.field-help { display: block; color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.45; }
.control-with-action, .inline-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.compact-button { min-height: 43px; white-space: nowrap; }
input[readonly] { border-style: dashed; background: #111419; color: #aab4bc; }
.smart-field select:disabled { border-style: dashed; opacity: 1; background: #111419; color: #aab4bc; cursor: default; }
.camp-field { display: grid; gap: 8px; }
.tag-list { display: flex; min-height: 32px; flex-wrap: wrap; gap: 6px; }
.tag-list:empty { display: none; }
.tag-chip { display: inline-flex; min-height: 29px; align-items: center; gap: 7px; padding: 0 5px 0 10px; border: 1px solid rgba(31, 189, 157, 0.3); border-radius: 999px; background: var(--brand-soft); color: #b7e6dc; font-size: 10px; font-weight: 700; }
.tag-chip button { display: grid; width: 20px; height: 20px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.06); color: #9fc6be; cursor: pointer; }
.coordinate-alert { margin: 1px 0 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-size: 10px; font-weight: 550; line-height: 1.45; }
.coordinate-alert.warning { border-color: rgba(240, 180, 91, 0.3); background: var(--amber-soft); color: #f4c77f; }
.coordinate-alert.ok { border-color: rgba(31, 189, 157, 0.26); background: var(--brand-soft); color: #9ee0d3; }
.coordinate-alert.info { color: var(--muted); }
.model-rule { margin: -5px 0 0; padding: 9px 11px; border: 1px solid rgba(31, 189, 157, 0.22); border-radius: 9px; background: var(--brand-soft); color: #a8dcd2; font-size: 10px; line-height: 1.45; }
.signal-preview { display: flex; min-height: 43px; align-items: center; padding: 0 13px; border: 1px solid var(--border); border-radius: 10px; background: #15181e; }
.signal-badge { display: inline-flex; align-items: center; gap: 9px; color: #cbd3d9; font-size: 10px; font-weight: 650; }
.signal-bars { position: relative; display: inline-flex; height: 17px; align-items: flex-end; gap: 2px; }
.signal-bars i { display: block; width: 3px; border-radius: 2px 2px 0 0; background: #39414b; }
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 7px; }
.signal-bars i:nth-child(3) { height: 10px; }
.signal-bars i:nth-child(4) { height: 13px; }
.signal-bars i:nth-child(5) { height: 16px; }
.signal-bars i.active { background: var(--brand-strong); box-shadow: 0 0 5px rgba(31, 189, 157, 0.24); }
.signal-cross { position: absolute; z-index: 1; top: -8px; left: 50%; color: #ff3f4f; font-size: 25px; font-weight: 950; line-height: 1; text-shadow: 0 1px 3px rgba(64, 0, 5, 0.35); transform: translateX(-50%); }
.signal-unavailable .signal-bars i.active { background: #ef6262; box-shadow: none; }
.signal-unavailable { color: #d74c57; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 24px 0; }
.detail-meta:empty { display: none; }
.detail-meta-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: #b9c2ca; font-size: 10px; font-weight: 760; }
.detail-sections { display: grid; gap: 10px; padding: 12px 18px 18px; }
.detail-section { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: #171a20; }
.detail-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.detail-section-header h3 { margin: 0; color: #e3e8ec; font-size: 12px; }
.detail-section-header span { color: var(--muted); font-size: 10px; }
.detail-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); }
.detail-item { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(125px, 0.85fr) minmax(0, 1.15fr); align-items: center; gap: 12px; padding: 8px 12px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.detail-item.wide { grid-column: 1 / -1; grid-template-columns: minmax(160px, 0.7fr) minmax(0, 1.3fr); }
.detail-item > span { display: block; margin: 0; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: 0.02em; line-height: 1.3; }
.detail-item > strong { display: block; overflow-wrap: anywhere; color: #dfe5e9; font-size: 11px; font-weight: 400; line-height: 1.35; text-align: right; white-space: pre-wrap; }
.detail-item strong > .status, .detail-item strong > .source-badge, .detail-item strong > .value-badge { display: inline-flex; margin: 0; font-size: 10px; letter-spacing: normal; text-transform: none; }
.empty-fields { border: 1px dashed #39414c; border-radius: 12px; background: rgba(255, 255, 255, 0.012); }
.empty-fields summary { padding: 13px 15px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.empty-fields .detail-section-grid { border-top: 1px solid var(--border); }
.empty-fields .detail-item { min-height: 0; opacity: 0.74; }

.dialog-confirm { width: min(calc(100% - 30px), 430px); padding: 28px; text-align: center; }
.dialog-confirm .dialog-actions { margin: 24px -28px -28px; justify-content: center; }
.dialog-confirm h2 { margin: 14px 0 8px; font-size: 20px; }
.dialog-confirm p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.confirm-symbol { display: grid; width: 46px; height: 46px; margin: auto; place-items: center; border-radius: 50%; background: var(--danger-soft); color: var(--danger); font-size: 22px; font-weight: 900; }

.audit-list { border-top: 1px solid var(--border); }
.audit-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: center; padding: 15px 22px; border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: 0; }
.audit-action { color: var(--brand-strong); font-size: 11px; font-weight: 850; }
.audit-item strong { display: block; font-size: 12px; }
.audit-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.audit-date { color: var(--muted); font-size: 10px; text-align: right; }

.inline-controls { display: flex; align-items: end; gap: 10px; }
.map-filter-note { display: inline-flex; min-height: 32px; align-items: center; padding: 0 10px; border: 1px solid rgba(31, 189, 157, 0.22); border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font-size: 10px; font-weight: 700; }
.map-panel { margin-top: 20px; overflow: hidden; }
.map-heading { padding-bottom: 14px; }
.map-legend { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(250px, 1fr); gap: 12px 22px; padding: 0 22px 16px; color: var(--muted); font-size: 10px; }
.legend-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.legend-group > strong { width: 100%; color: #d7dde2; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-legend span b { color: #dce3e8; font-size: 10px; }
.legend-equipment, .legend-status { display: inline-grid; width: 21px; height: 21px; flex: 0 0 21px; place-items: center; border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 7px; color: #081512; font-size: 12px; font-style: normal; font-weight: 950; }
.legend-equipment.emcc { background: var(--brand-strong); }
.legend-equipment.emmc { background: #54d6df; }
.legend-equipment.ecrc { background: var(--blue); }
.legend-equipment.emm { background: var(--amber); }
.legend-equipment.review { background: #a9b2bd; }
.legend-status { width: 18px; height: 18px; flex-basis: 18px; border-width: 1px; border-radius: 50%; background: #1a1e24; color: #fff; font-size: 10px; }
.legend-status.active { border-color: #3bd8a9; color: #3bd8a9; }
.legend-status.pending { border-color: var(--amber); color: var(--amber); }
.legend-status.offline { border-color: var(--danger); color: var(--danger); }
.legend-status.retired { border-color: #8c96a2; color: #aeb6bf; }
.map-layer-hint { grid-column: 1 / -1; color: #77818d; line-height: 1.45; }
.inventory-map { width: 100%; height: min(70vh, 680px); min-height: 480px; border-top: 1px solid var(--border); background: #20242b; }
.leaflet-container { font-family: inherit; }
.leaflet-bar a { background: #f5f6f7; color: #1a1e24; }
.leaflet-control-layers { border: 1px solid rgba(255, 255, 255, 0.16) !important; border-radius: 9px !important; background: rgba(24, 28, 34, 0.92) !important; color: #e9eef1; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32) !important; backdrop-filter: blur(10px); }
.leaflet-control-layers-toggle { width: 34px !important; height: 34px !important; background-size: 19px 19px !important; filter: invert(1) grayscale(1); opacity: 0.8; }
.leaflet-control-layers-expanded { padding: 10px 12px !important; }
.leaflet-control-layers-expanded .leaflet-control-layers-toggle { display: none; }
.leaflet-control-layers label { color: #d7dde2; font-size: 11px; font-weight: 650; }
.leaflet-control-layers input { width: auto; height: auto; accent-color: var(--brand); }
.leaflet-control-attribution { max-width: min(72vw, 760px); background: rgba(16, 19, 24, 0.8) !important; color: #aeb6bf !important; font-size: 8px !important; }
.leaflet-control-attribution a { color: #b9d7ff !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1b1f25; color: var(--text); }
.leaflet-popup-content-wrapper { border: 1px solid var(--border); border-radius: 12px; }
.map-popup { display: grid; min-width: 230px; gap: 7px; }
.map-popup-source { color: var(--brand-strong); font-size: 9px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.map-popup strong { font-size: 13px; }
.map-popup small { color: var(--muted); line-height: 1.45; }
.map-popup .map-popup-alert { padding: 7px 8px; border: 1px solid rgba(240, 180, 91, 0.24); border-radius: 7px; background: var(--amber-soft); color: #f4c77f; }
.map-popup-button { justify-self: start; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 10px; font-weight: 800; }
.map-cluster-popup { max-height: 310px; overflow: auto; }

.equipment-marker-host { border: 0 !important; background: transparent !important; }
.equipment-marker { --equipment: #a9b2bd; --status: #8c96a2; position: relative; display: block; width: 34px; height: 40px; }
.equipment-marker.type-emcc { --equipment: var(--brand-strong); }
.equipment-marker.type-emmc { --equipment: #54d6df; }
.equipment-marker.type-ecrc { --equipment: var(--blue); }
.equipment-marker.type-emm { --equipment: var(--amber); }
.equipment-marker.status-activo { --status: #3bd8a9; }
.equipment-marker.status-pendiente { --status: var(--amber); }
.equipment-marker.status-fuera-servicio { --status: var(--danger); }
.equipment-marker.status-retirado { --status: #8c96a2; }
.equipment-marker.status-por-revisar { --status: #c99cff; }
.equipment-marker-core { display: grid; width: 32px; height: 32px; place-items: center; border: 3px solid var(--status); border-radius: 50% 50% 50% 8px; background: #11151a; color: var(--equipment); transform: rotate(-45deg); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.38), inset 0 0 0 2px rgba(255, 255, 255, 0.04); }
.equipment-marker-core svg { width: 18px; height: 18px; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; transform: rotate(45deg); }
.equipment-marker.type-emcc .equipment-marker-core svg { fill: currentColor; stroke: none; }
.equipment-marker-status { position: absolute; right: -1px; bottom: 2px; display: grid; width: 16px; height: 16px; place-items: center; border: 2px solid #11151a; border-radius: 50%; background: var(--status); color: #11151a; font-size: 9px; font-weight: 950; line-height: 1; }
.equipment-cluster-host { border: 0 !important; background: transparent !important; }
.equipment-cluster { display: grid; width: 100%; height: 100%; place-content: center; border: 3px solid rgba(255, 255, 255, 0.72); border-radius: 50%; background: #147d6a; color: #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.42); text-align: center; }
.equipment-cluster strong { font-size: 13px; line-height: 1; }
.equipment-cluster small { margin-top: 2px; font-size: 6px; font-weight: 800; letter-spacing: 0.03em; line-height: 1; text-transform: uppercase; }

.configuration-heading { align-items: end; }
.configuration-note { margin: 0 22px 18px; padding: 12px 14px; border: 1px solid rgba(100, 169, 255, 0.2); border-radius: 10px; background: var(--blue-soft); color: #b9d7ff; font-size: 11px; line-height: 1.5; }
.configuration-table-wrap { max-height: calc(100vh - 280px); overflow: auto; border-top: 1px solid var(--border); }
.configuration-table { width: 100%; min-width: 620px; }
.configuration-table th, .configuration-table td { position: static; width: auto; min-width: 0; max-width: none; background: transparent; text-align: center; }
.configuration-table th { position: sticky; z-index: 2; top: 0; background: #1b1f25; }
.configuration-table th:first-child, .configuration-table td:first-child { width: auto; text-align: left; }
.configuration-table td:first-child { background: var(--surface); }
.configuration-table tbody tr:hover td:first-child { background: #20242a; }
.configuration-table td strong, .configuration-table td small { display: block; }
.configuration-table td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.configuration-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }

.configuration-layout { display: grid; gap: 22px; }
.configuration-block, .catalog-manager { overflow: hidden; }
.section-kicker { margin: 0 0 6px !important; color: var(--brand) !important; font-size: 9px !important; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.catalog-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 9px; }
.catalog-toolbar label { min-width: min(280px, 100%); gap: 5px; }
.catalog-toolbar label > span { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.catalog-meta { margin: 0 22px 16px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 10px; line-height: 1.5; }
.catalog-items[aria-busy="true"] { min-height: 120px; cursor: progress; opacity: 0.58; }
.catalog-table-wrap { max-height: min(62vh, 580px); overflow: auto; border-top: 1px solid var(--border); }
.catalog-table { width: 100%; min-width: 760px; }
.catalog-table th, .catalog-table td { position: static; width: auto; min-width: 120px; max-width: 280px; padding: 10px 13px; background: transparent; }
.catalog-table th { position: sticky; z-index: 2; top: 0; background: var(--surface-2); }
.catalog-table td { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; }
.catalog-table th:last-child, .catalog-table td:last-child { width: 210px; min-width: 210px; text-align: right; }
.catalog-row-inactive { opacity: 0.62; }
.catalog-state { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 850; }
.catalog-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.catalog-state.active { background: var(--brand-soft); color: var(--brand); }
.catalog-state.inactive { background: rgba(117, 130, 139, 0.12); color: var(--muted); }
.catalog-row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.catalog-action { min-height: 31px; padding-inline: 10px; font-size: 10px; }
.button-quiet-danger { border-color: transparent; background: transparent; color: #ce5360; }
.button-quiet-danger:hover:not(:disabled) { border-color: rgba(206, 83, 96, 0.25); background: rgba(206, 83, 96, 0.08); }
.catalog-dialog { width: min(calc(100% - 30px), 680px); }
.catalog-dialog .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* El área de trabajo usa una paleta clara; la navegación lateral conserva su identidad oscura. */
.main-column {
  color-scheme: light;
  --surface: #ffffff;
  --surface-2: #f4f7f7;
  --surface-3: #e8efee;
  --border: #dbe5e4;
  --text: #17262c;
  --muted: #64757c;
  --brand: #087d6a;
  --brand-strong: #099f86;
  --brand-soft: rgba(9, 159, 134, 0.1);
  --danger-soft: rgba(211, 64, 76, 0.09);
  --amber-soft: rgba(211, 139, 39, 0.1);
  --blue-soft: rgba(40, 112, 181, 0.09);
  min-width: 0;
  background: #f1f5f4;
  color: var(--text);
}
.main-column .topbar { border-color: #dbe5e4; background: rgba(255, 255, 255, 0.94); box-shadow: 0 1px 0 rgba(29, 57, 62, 0.02); }
.main-column .topbar h1, .main-column .panel-heading h2, .main-column h3, .main-column h4 { color: #152a30; }
.main-column .content { min-height: calc(100vh - 92px); }
.main-column .panel { border-color: #dbe5e4; background: #fff; box-shadow: 0 13px 34px rgba(31, 59, 63, 0.07); }
.main-column .panel-heading { border-color: #e3eae9; }
.main-column .filter-toolbar { border-color: #e1e9e8; background: #f8faf9; }
.main-column .filter-toolbar-heading strong { color: #263b40; }
.main-column label, .main-column .smart-field > span:first-child, .main-column .camp-field > span:first-child { color: #344b51; }
.main-column input, .main-column select, .main-column textarea { border-color: #cedbd9; background: #fff; color: #1b3036; }
.main-column input::placeholder { color: #91a0a4; }
.main-column input:focus, .main-column select:focus, .main-column textarea:focus { border-color: #0a9b83; background: #fff; }
.main-column input[readonly], .main-column .smart-field select:disabled { background: #f4f7f7; color: #607279; }
.main-column .button-secondary { border-color: #d0dcda; background: #fff; color: #30474d; }
.main-column .button-secondary:hover:not(:disabled) { border-color: #aebfbc; background: #f3f7f6; }
.main-column .button-primary { background: #087d6a; color: #fff; }
.main-column .button-primary:hover:not(:disabled) { background: #099f86; }
.main-column .table-wrap { border-color: #dfe7e6; }
.main-column th { border-color: #dfe7e6; background: #edf3f2; color: #5b6e74; }
.main-column td { border-color: #e5eceb; color: #35494f; }
.main-column td strong { color: #17282e; }
.main-column td:nth-child(1), .main-column td:nth-child(2), .main-column td.actions-sticky { background: #fff; }
.main-column th:nth-child(1), .main-column th:nth-child(2), .main-column th.actions-sticky { background: #e8f0ef; }
.main-column tbody tr:nth-child(even) td { background-color: #fafcfc; }
.main-column tbody tr:nth-child(even) td:nth-child(1), .main-column tbody tr:nth-child(even) td:nth-child(2), .main-column tbody tr:nth-child(even) td.actions-sticky { background: #fafcfc; }
.main-column tbody tr:hover td, .main-column tbody tr:hover td:nth-child(1), .main-column tbody tr:hover td:nth-child(2), .main-column tbody tr:hover td.actions-sticky { background: #f0f7f5; }
.main-column .table-button { border-color: #d3dfdd; background: #f9fbfb; color: #40545a; }
.main-column .status-activo, .main-column .status-regularizado { background: var(--brand-soft); color: #087d6a; }
.main-column .status-desconectado, .main-column .status-offline_incendio_2024, .main-column .status-siniestrado, .main-column .status-sustraido { color: #c34552; }
.main-column .status-en_proyecto_pendiente_umed, .main-column .status-pendiente_instalar_umed, .main-column .status-pendiente_obras_red_rree { color: #a66b14; }
.main-column .value-badge { background: #edf2f2; color: #4a5e63; }
.main-column .source-badge { color: #28699d; }
.main-column .signal-preview { border-color: #cedbd9; background: #fff; }
.main-column .signal-badge { color: #455b61; }
.main-column .signal-bars i { background: #cbd6d5; }
.main-column .configuration-note { color: #2b699b; }
.main-column .configuration-table th { background: #edf3f2; }
.main-column .configuration-table td:first-child { background: #fff; }
.main-column .configuration-table tbody tr:hover td:first-child { background: #f0f7f5; }
.main-column .catalog-table th { background: #edf3f2; }
.main-column .ccc-current-grid { background: #f8faf9; }
.main-column .ccc-current-grid strong, .main-column .file-metadata strong { color: #1b3036; }
.main-column .upload-dropzone { border-color: #aebfbd; background: #f8faf9; color: #2f454b; }
.main-column .file-metadata > div, .main-column .validation-metric { background: #fff; }
.main-column .load-preview { background: #f8faf9; }
.main-column .compact-table-wrap th { background: #edf3f2; color: #596d72; }
.main-column .compact-table-wrap td { color: #344a50; }
.main-column .map-legend span b, .main-column .legend-group > strong { color: #33474d; }
.main-column .map-layer-hint { color: #738489; }

.dialog {
  color-scheme: light;
  --surface: #ffffff;
  --surface-2: #f4f7f7;
  --surface-3: #e8efee;
  --border: #d8e3e1;
  --text: #17262c;
  --muted: #64757c;
  --brand: #087d6a;
  --brand-strong: #099f86;
  --brand-soft: rgba(9, 159, 134, 0.1);
  --danger-soft: rgba(211, 64, 76, 0.09);
  --amber-soft: rgba(211, 139, 39, 0.1);
  --blue-soft: rgba(40, 112, 181, 0.09);
  border-color: #cad8d6;
  background: #fff;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(11, 35, 39, 0.25);
}
.dialog .dialog-heading { border-color: var(--border); background: #fff; }
.dialog .dialog-heading h2, .dialog .smart-form-section strong, .dialog .detail-section-header h3 { color: #172b31; }
.dialog .icon-button { border-color: #d2dddb; background: #f5f8f7; color: #596c72; }
.dialog label, .dialog .smart-field > span:first-child, .dialog .camp-field > span:first-child { color: #344b51; }
.dialog input, .dialog select, .dialog textarea { border-color: #cad8d6; background: #fff; color: #1b3036; }
.dialog input::placeholder { color: #91a0a4; }
.dialog input:focus, .dialog select:focus, .dialog textarea:focus { border-color: #0a9b83; background: #fff; }
.dialog input[readonly], .dialog .smart-field select:disabled { background: #f3f7f6; color: #617379; }
.dialog .button-secondary { border-color: #cedbd9; background: #fff; color: #31474d; }
.dialog .button-primary { background: #087d6a; color: #fff; }
.dialog .dialog-actions { border-color: var(--border); background: #f5f8f7; }
.dialog .record-context strong { color: #24473f; }
.dialog .record-context p { color: #5d7872; }
.dialog .smart-form-section { border-color: #dfe7e6; }
.dialog .smart-form-notice strong { color: #356170; }
.dialog .smart-form-notice span { color: #607b84; }
.dialog .model-rule { color: #347366; }
.dialog .signal-preview { border-color: #cad8d6; background: #fff; }
.dialog .signal-badge { color: #455b61; }
.dialog .signal-bars i { background: #cbd6d5; }
.dialog .detail-meta-chip { border-color: #d7e1e0; background: #f3f7f6; color: #506369; }
.dialog .detail-section { border-color: #dbe4e3; background: #fff; }
.dialog .detail-section-header { border-color: #dbe4e3; background: #f5f8f7; }
.dialog .detail-section-grid, .dialog .detail-item { border-color: #e0e8e7; background: #fff; }
.dialog .detail-item > strong { color: #24373d; }
.dialog .empty-fields { border-color: #ccd9d7; background: #f8faf9; }
.dialog .empty-fields .detail-section-grid { border-color: #dbe4e3; }
.dialog .status-regularizado, .dialog .status-activo { background: var(--brand-soft); color: #087d6a; }
.dialog .signal-unavailable { color: #d74c57; }

.loads-layout { display: grid; gap: 20px; }
.loads-heading { align-items: flex-start; }
.heading-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.heading-line h2 { margin: 0; }
.load-source-badge { display: inline-flex; padding: 4px 8px; border: 1px solid rgba(100, 169, 255, 0.24); border-radius: 999px; background: var(--blue-soft); color: #b9d7ff; font-size: 9px; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; }
.load-status { display: inline-flex; align-items: center; gap: 7px; width: max-content; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 850; white-space: nowrap; }
.load-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.load-status-ready { border-color: rgba(31, 189, 157, 0.26); background: var(--brand-soft); color: var(--brand-strong); }
.load-status-applied { border-color: rgba(100, 169, 255, 0.26); background: var(--blue-soft); color: #aaceff; }
.load-status-blocked { border-color: rgba(240, 180, 91, 0.28); background: var(--amber-soft); color: #f4c77f; }
.load-status-neutral { color: #8994a0; }
.ccc-current-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.012); }
.ccc-current-grid > div { min-width: 0; padding: 16px 20px; border-right: 1px solid var(--border); }
.ccc-current-grid > div:last-child { border-right: 0; }
.ccc-current-grid span, .file-metadata span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.ccc-current-grid strong { display: block; overflow: hidden; color: #e7ecef; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.ccc-current-grid > div:last-child strong { font-size: 15px; }
.load-workflow { display: grid; gap: 16px; padding: 22px; }
.upload-dropzone { display: flex; min-height: 112px; align-items: center; gap: 16px; padding: 19px; border: 1px dashed #46515e; border-radius: 14px; background: #161a20; color: #dce2e7; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.upload-dropzone:hover, .upload-dropzone.drag-active { border-color: var(--brand-strong); background: var(--brand-soft); }
.upload-dropzone.has-file { border-style: solid; border-color: rgba(31, 189, 157, 0.35); }
.upload-dropzone > span:nth-of-type(2) { min-width: 0; flex: 1; }
.upload-dropzone strong, .upload-dropzone small { display: block; }
.upload-dropzone strong { font-size: 13px; }
.upload-dropzone small { margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 550; }
.upload-symbol { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); font-size: 24px; font-weight: 900; }
.file-metadata { display: grid; grid-template-columns: 1.4fr 0.7fr 1fr 0.8fr; gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--border); }
.file-metadata > div { min-width: 0; padding: 13px 15px; background: var(--surface-2); }
.file-metadata strong { display: block; overflow: hidden; color: #e3e8ec; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.load-actions { display: flex; justify-content: flex-end; gap: 10px; }
.load-preview { border-top: 1px solid var(--border); padding: 22px; background: rgba(0, 0, 0, 0.08); }
.load-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.load-preview-heading h3 { margin: 5px 0 0; font-size: 15px; }
.validation-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.validation-metric { min-width: 0; padding: 13px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.validation-metric span { display: block; min-height: 25px; color: var(--muted); font-size: 9px; font-weight: 750; line-height: 1.35; text-transform: uppercase; }
.validation-metric strong { display: block; margin-top: 4px; font-size: 20px; }
.validation-metric.positive strong { color: var(--brand-strong); }
.validation-metric.accent strong { color: #aaceff; }
.validation-metric.warning strong { color: var(--amber); }
.validation-metric.danger strong { color: var(--danger); }
.load-observations { margin-top: 18px; }
.load-observations h4 { margin: 0 0 10px; font-size: 12px; }
.compact-table-wrap { position: relative; overflow: auto; border-top: 1px solid var(--border); }
.compact-table-wrap table { width: 100%; min-width: 640px; border-collapse: collapse; }
.compact-table-wrap th, .compact-table-wrap td { position: static; width: auto; min-width: 0; max-width: none; padding: 12px 15px; background: transparent; text-align: left; }
.compact-table-wrap th { background: #1b1f25; color: #9ea8b2; font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; }
.compact-table-wrap td { border-top: 1px solid var(--border); color: #dce2e7; font-size: 11px; }
.compact-table-wrap td strong, .compact-table-wrap td small { display: block; }
.compact-table-wrap td small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.load-history-wrap { min-height: 150px; max-height: 430px; border-bottom: 0; }
.compact-empty { min-height: 180px; }

.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 16px; border: 1px solid rgba(31, 189, 157, 0.28); border-radius: 11px; background: #17342e; color: #c8fff2; box-shadow: var(--shadow); font-size: 12px; }
.toast.error { border-color: rgba(239, 98, 98, 0.3); background: #3c2022; color: #ffc1c1; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .content, .topbar { padding-inline: 22px; }
  .brand-logo { width: min(100%, 190px); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { grid-template-columns: minmax(160px, 230px) 1fr; align-items: center; padding: 0; }
  .sidebar .brand-copy { display: none; }
  .nav-list { grid-template-columns: 1fr 1fr; margin-top: 14px; }
  .nav-source-picker { margin: 0; }
  .sidebar-footer { display: none; }
  .topbar { align-items: flex-start; padding: 18px 16px; }
  .topbar-actions { align-items: flex-end; flex-direction: column-reverse; }
  .connection-status { display: none; }
  .content { padding: 18px 16px 34px; }
  .filter-field-wide { grid-column: span 1; }
  .panel-heading { align-items: flex-start; }
  .form-grid, .form-grid-wide, .detail-section-grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .detail-item.wide { grid-column: span 1; }
  .smart-form-section { align-items: flex-start; flex-direction: column; gap: 3px; }
  .audit-item { grid-template-columns: 90px 1fr; }
  .audit-date { grid-column: 2; text-align: left; }
  .map-heading, .configuration-heading { align-items: stretch; flex-direction: column; }
  .catalog-toolbar { width: 100%; justify-content: stretch; }
  .catalog-toolbar label { min-width: 100%; flex: 1 0 100%; }
  .loads-heading, .load-preview-heading { align-items: flex-start; flex-direction: column; }
  .inline-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .map-legend { grid-template-columns: 1fr; }
  .map-layer-hint { grid-column: 1; }
  .inventory-map { min-height: 420px; }
  .ccc-current-grid, .validation-summary, .file-metadata { grid-template-columns: 1fr 1fr; }
  .ccc-current-grid > div:nth-child(2) { border-right: 0; }
  .ccc-current-grid > div { border-bottom: 1px solid var(--border); }
  .ccc-current-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 480px) {
  .login-view { padding: 14px; }
  .login-card { padding: 25px 21px; }
  .login-heading h1 { font-size: 26px; }
  .topbar { display: block; }
  .topbar-actions { margin-top: 15px; align-items: stretch; }
  .nav-item { padding-inline: 8px; font-size: 11px; }
  .nav-list { grid-template-columns: 1fr; }
  .ccc-current-grid, .validation-summary, .file-metadata { grid-template-columns: 1fr; }
  .ccc-current-grid > div { border-right: 0; border-bottom: 1px solid var(--border) !important; }
  .ccc-current-grid > div:last-child { border-bottom: 0 !important; }
  .upload-dropzone { align-items: flex-start; flex-wrap: wrap; }
  .upload-dropzone .button { width: 100%; }
  .load-actions { align-items: stretch; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .panel-actions { width: 100%; justify-content: stretch; }
  .panel-actions .button { flex: 1; }
  .dialog-heading, .form-grid, .dialog-actions { padding-inline: 17px; }
  .catalog-dialog .form-grid { grid-template-columns: 1fr; }
  .record-context { margin-inline: 17px; }
  .control-with-action, .inline-entry { grid-template-columns: 1fr; }
  .dialog .form-error { margin-inline: 17px; }
  .detail-item, .detail-item.wide { grid-template-columns: 1fr; gap: 4px; }
  .detail-item > strong { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
