:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #132235;
  --muted: #667789;
  --line: #dbe5ee;
  --soft-line: #e9eef4;
  --brand: #365268;
  --brand-2: #4e6678;
  --accent: #dce7ef;
  --danger: #8b1d13;
  --success: #0f5132;
  --warning: #73500b;
  --shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #ffffff;
  color: var(--ink);
  border-right: 2px solid var(--line);
  padding: 22px 16px;
}

.brand-block {
  padding: 0 8px 22px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 12px;
}

.brand-logo {
  width: 116px;
  height: 116px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
  mix-blend-mode: multiply;
}

.brand-name {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 10px 11px;
  text-align: left;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: center;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: var(--line);
  background: #f6fff0;
  color: var(--brand);
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #f0f7df;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 700;
}

.nav-button.is-active .nav-icon {
  background: var(--accent);
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 24px 26px 46px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 1.72rem;
  line-height: 1.18;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.18rem;
}

h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 820px;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.button:hover,
.icon-button:hover {
  border-color: var(--brand);
  background: #f6fff0;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--brand);
}

.button.warn {
  border-color: var(--accent);
  background: #fff4ed;
  color: #9c3d0c;
}

.button.danger {
  border-color: #f1b7b2;
  background: #fff1f0;
  color: var(--danger);
}

.button.mini {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel.flat {
  box-shadow: none;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.module-card,
.status-card {
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.module-card {
  min-height: 104px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.module-card:hover,
.status-card:hover,
.status-card.is-active {
  border-color: var(--line);
  background: #f6fff0;
}

.module-card strong {
  font-size: 0.96rem;
}

.module-card span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.status-card {
  min-height: 74px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-card strong {
  font-size: 1.55rem;
  color: var(--accent);
}

.stat {
  min-height: 112px;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-value {
  margin: 10px 0 0;
  font-size: 2rem;
  font-weight: 850;
  color: var(--brand);
}

.stat-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.toolbar .filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar .filters label {
  min-width: 150px;
}

label {
  display: grid;
  gap: 6px;
  color: #334250;
  font-weight: 760;
  font-size: 0.86rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b9b2a4;
  border-radius: 6px;
  background: #ffffff;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(132, 189, 36, 0.28);
  border-color: var(--brand);
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form > label {
  min-width: 180px;
  flex: 1 1 180px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.table-wrap.is-dense table {
  min-width: 1120px;
}

table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--soft-line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

.table-wrap.is-dense th,
.table-wrap.is-dense td {
  padding: 9px 10px;
}

th {
  color: var(--ink);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f1f8df;
  border-bottom: 2px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

tr[data-open-expediente] {
  cursor: pointer;
}

tr[data-open-expediente]:hover td {
  background: #fbfff3;
}

.table-select {
  min-height: 31px;
  margin-top: 7px;
  padding: 4px 7px;
  font-size: 0.8rem;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.cell-stack {
  display: grid;
  gap: 5px;
  align-content: start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.info {
  background: #eef9d7;
  color: #4a7f0d;
  border-color: #b7d975;
}

.badge.success {
  background: #e8f8e6;
  color: var(--success);
  border-color: #a7d89b;
}

.badge.warn {
  background: #fff4ed;
  color: var(--warning);
  border-color: #f0b48d;
}

.badge.danger {
  background: #fff1f0;
  color: var(--danger);
  border-color: #f0c2bd;
}

.badge.muted {
  background: #f4f1ea;
  color: #59554d;
  border-color: #d8d1c3;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
}

.tab-button {
  border: 0;
  background: transparent;
  border-bottom: 3px solid transparent;
  padding: 10px 10px 9px;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.tab-button.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.operation-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 0.6fr)) minmax(320px, 1.2fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.operation-metric {
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 72px;
  padding: 10px 12px;
}

.operation-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.operation-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.quick-status {
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.record-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.record-title h1 {
  font-size: 1.46rem;
}

.meta-line {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  margin-top: 8px;
}

.section-list {
  display: grid;
  gap: 14px;
}

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

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.field-grid .span-2 {
  grid-column: span 2;
}

.empty {
  border: 1px dashed #9d978d;
  border-radius: var(--radius);
  background: #fffdf7;
  padding: 18px;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 12px;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.small {
  color: var(--muted);
  font-size: 0.84rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row strong {
  font-size: 1.05rem;
}

.form-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.notice {
  border: 1px solid #c5d98a;
  border-left: 4px solid var(--brand);
  background: #f7ffe8;
  color: #334015;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.notice.warn {
  border-color: #f0b48d;
  border-left-color: var(--accent);
  background: #fff4ed;
  color: #80340c;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  border: 1px solid #c9c2b6;
  border-radius: 999px;
  padding: 5px 9px;
  background: #ffffff;
  color: #334250;
  font-size: 0.82rem;
  font-weight: 760;
}

.mini-ledger {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.mini-ledger div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.mini-ledger div:last-child {
  border-bottom: 0;
}

.section-tags {
  display: grid;
  gap: 7px;
}

.section-tags span {
  border: 1px solid #c9c2b6;
  border-radius: var(--radius);
  background: #fffdf7;
  color: #334250;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 760;
}

.master-summary {
  margin-bottom: 14px;
}

.footer-space {
  height: 34px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .grid.cols-4,
  .grid.cols-3,
  .module-grid,
  .status-board,
  .operation-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .detail-header,
  .operation-bar,
  .split {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .field-grid,
  .module-grid,
  .status-board,
  .quick-status {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 18px 14px 34px;
  }

  table {
    min-width: 720px;
  }
}

/* Tema app de gestion La Huerta de Raul */
:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #132235;
  --muted: #667789;
  --line: #dbe5ee;
  --soft-line: #e9eef4;
  --brand: #365268;
  --brand-2: #4e6678;
  --accent: #dce7ef;
  --danger: #8b1d13;
  --success: #0f5132;
  --warning: #73500b;
  --shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f6f8fb;
  color: var(--ink);
}

.layout {
  grid-template-columns: 64px minmax(0, 1fr);
  background: #e8edf3;
}

.sidebar {
  z-index: 70;
  width: 64px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid #d9dfe7;
  box-shadow: 10px 0 32px rgba(15, 23, 42, 0.05);
  transition: width 0.18s ease;
}

.sidebar:hover,
.sidebar:focus-within {
  width: 306px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  width: 306px;
  margin: 0 0 10px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand-logo {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin: 0;
  object-fit: cover;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
  mix-blend-mode: normal;
}

.brand-copy,
.nav-button span:not(.nav-icon) {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.sidebar:hover .brand-copy,
.sidebar:focus-within .brand-copy,
.sidebar:hover .nav-button span:not(.nav-icon),
.sidebar:focus-within .nav-button span:not(.nav-icon) {
  opacity: 1;
  transform: translateX(0);
}

.brand-name {
  text-align: left;
  text-transform: none;
  font-size: 0.98rem;
  font-weight: 850;
  color: var(--ink);
}

.brand-subtitle {
  margin-top: 3px;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--muted);
}

.nav {
  width: 306px;
  gap: 4px;
  padding: 0 8px 16px;
}

.nav-group {
  margin: 6px 0 10px;
}

.nav-group-title {
  height: 18px;
  padding: 0 10px;
  color: #8795a3;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 18px;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.sidebar:hover .nav-group-title,
.sidebar:focus-within .nav-group-title {
  opacity: 1;
  transform: translateX(0);
}

.nav-submenu {
  display: grid;
  gap: 4px;
}

.nav-button {
  width: 48px;
  height: 42px;
  min-height: 42px;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #3e5264;
  font-weight: 720;
  overflow: hidden;
}

.nav-button span:not(.nav-icon) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar:hover .nav-button,
.sidebar:focus-within .nav-button {
  width: 100%;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: #d7e3ec;
  background: #edf4f8;
  color: var(--ink);
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: #f3f6f9;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
}

.nav-button.is-active .nav-icon {
  background: #dce7ef;
  color: var(--brand);
}

.main {
  min-width: 0;
  padding: 22px 18px 58px;
  background: var(--bg);
}

.sepria-budget-shell {
  height: calc(100vh - 80px);
  min-height: 720px;
  margin: -14px -10px -46px;
  background: #f6f8fb;
}

.sepria-budget-iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 720px;
  border: 0;
  background: #f6f8fb;
}

.actua-top-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, auto)) minmax(110px, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.actua-top-strip button,
.actua-user-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: #3e5264;
  padding: 7px 10px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.actua-top-strip button:hover {
  border-color: #c8d6e2;
  background: #edf4f8;
  color: var(--ink);
}

.actua-top-strip button strong {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 9px;
  background: #dce7ef;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 850;
}

.actua-top-strip button span,
.actua-user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 780;
}

.actua-top-strip .is-primary {
  background: var(--brand);
  color: #ffffff;
}

.actua-top-strip .is-primary strong {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.actua-user-chip {
  justify-content: flex-end;
  color: var(--muted);
}

.topbar {
  align-items: center;
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  color: var(--brand);
  letter-spacing: 0.04em;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.08rem;
}

h3 {
  font-size: 0.98rem;
}

.button,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  font-weight: 760;
}

.button:hover,
.icon-button:hover {
  border-color: #b9c8d4;
  background: #f8fafc;
}

.button.primary {
  border-color: #223243;
  background: #223243;
  color: #ffffff;
}

.button.primary:hover {
  border-color: #162331;
  background: #162331;
}

.button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--brand);
}

.button.warn {
  border-color: #f5d48b;
  background: #fff7db;
  color: #73500b;
}

.button.danger {
  border-color: #ffc7c7;
  background: #fff1f1;
  color: var(--danger);
}

.button.mini {
  min-height: 31px;
  border-radius: 10px;
  padding: 5px 9px;
  font-size: 0.78rem;
}

.panel,
.module-card,
.status-card,
.operation-metric,
.quick-status {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel.flat {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: none;
}

.module-card:hover,
.status-card:hover,
.status-card.is-active {
  border-color: #b9c8d4;
  background: #f8fafc;
}

.status-card strong,
.stat-value {
  color: var(--brand);
}

label {
  color: #3e5264;
  font-weight: 720;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid #d4e0ea;
  border-radius: 13px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #8aa9bd;
  box-shadow: 0 0 0 3px rgba(138, 169, 189, 0.18);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

th {
  color: #3e5264;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.04em;
}

td {
  border-bottom: 1px solid var(--soft-line);
}

tbody tr:nth-child(even) td {
  background: #fcfdff;
}

tr[data-open-expediente]:hover td {
  background: #eef5fb;
}

.table-select {
  border-radius: 10px;
}

.badge {
  min-height: 24px;
  border-radius: 999px;
  font-weight: 760;
}

.badge.info {
  background: #d8efff;
  color: #075985;
  border-color: #b9def5;
}

.badge.success {
  background: #d8f6e2;
  color: #0f5132;
  border-color: #b9eac8;
}

.badge.warn {
  background: #fff0c7;
  color: #73500b;
  border-color: #f3d994;
}

.badge.danger {
  background: #ffd8d8;
  color: #8b1d13;
  border-color: #f6b7b7;
}

.badge.muted {
  background: #e8ece9;
  color: #52605a;
  border-color: #d4ddd7;
}

.tabs {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
}

.tab-button {
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  color: var(--muted);
}

.tab-button.is-active {
  border-bottom-color: transparent;
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.empty {
  border-color: #cbd8e2;
  background: #f8fafc;
}

.timeline-item {
  border-left-color: var(--brand);
}

.summary-row {
  border-bottom-color: var(--soft-line);
}

.notice {
  border-color: #b9d2e4;
  border-left-color: var(--brand);
  background: #edf4f8;
  color: #263d50;
}

.notice.warn {
  border-color: #f5d48b;
  border-left-color: #c58a18;
  background: #fff7db;
  color: #73500b;
}

.pill,
.section-tags span,
.mini-ledger {
  border-color: var(--line);
  background: #ffffff;
  color: #3e5264;
}

.mini-ledger div {
  border-bottom-color: var(--soft-line);
}

.actua-alert-grid {
  margin-bottom: 14px;
}

.actua-notice-card {
  min-height: 220px;
}

.actua-period-panel {
  margin-bottom: 14px;
}

.state-kpi h2 {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.state-kpi-list {
  display: grid;
  gap: 7px;
}

.state-kpi-list button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 7px 10px;
  font-weight: 760;
}

.actua-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.actua-filters.compact {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.actua-bulk-actions {
  justify-content: flex-start;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 8px 10px;
  color: #3e5264;
  font-size: 0.82rem;
  font-weight: 760;
}

.check-grid input {
  width: auto;
  min-height: 0;
}

.config-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 520px;
}

.config-pill-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #3e5264;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 760;
  white-space: nowrap;
}

.process-rule-panel {
  margin-bottom: 14px;
}

.config-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.config-rule-grid > div {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.config-rule-grid strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.actua-operation-bar {
  grid-template-columns: repeat(3, minmax(130px, 0.5fr)) minmax(340px, 1fr) minmax(360px, 1.4fr);
}

.record-title .badge {
  border: 1px solid transparent;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.doc-slot {
  display: grid;
  gap: 5px;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 10px;
}

.doc-slot.is-ok {
  border-color: #b9eac8;
  background: #f1fbf4;
}

.doc-slot label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.doc-slot label input {
  width: auto;
  min-height: 0;
}

.doc-slot strong {
  font-size: 0.9rem;
}

.doc-slot span,
.doc-slot small {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .actua-filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .actua-operation-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actua-top-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: 100%;
  }

  .brand-block,
  .nav {
    width: 100%;
  }

  .brand-copy,
  .nav-button span:not(.nav-icon),
  .nav-group-title {
    opacity: 1;
    transform: none;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px;
  }

  .nav-button {
    grid-template-columns: 34px 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .actua-top-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actua-filters,
  .actua-filters.compact,
  .config-rule-grid,
  .check-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }
}

.ag-detail-page {
  --ag-red: var(--brand);
  --ag-bg: #e9eef4;
  --ag-band: #ded7c9;
  --ag-band-soft: #eeeae3;
  --ag-border: #d8dde4;
  --ag-dark: #343a40;
  background: var(--ag-bg);
  margin: -8px -6px 0;
  padding: 6px 0 26px;
  color: #17212b;
}

.ag-record-head {
  display: grid;
  grid-template-columns: auto minmax(640px, 1fr);
  align-items: center;
  justify-content: start;
  gap: 34px;
  margin-bottom: 16px;
}

.ag-record-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.18rem;
}

.ag-red-mark {
  color: var(--ag-red);
  font-size: 1.72rem;
  font-weight: 900;
  line-height: 1;
}

.ag-red-mark.small {
  font-size: 1.35rem;
}

.ag-warn-dot {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #9aa1a8;
  border-radius: 50%;
  background: #ffffff;
  color: #7a828a;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ag-warn-dot:hover,
.ag-warn-dot:focus-visible {
  border-color: #f59e0b;
  color: #b45309;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
  outline: 0;
}

.ag-warn-dot.is-active {
  border-color: #f59e0b;
  background: #f59e0b;
  color: #ffffff;
}

.ag-status-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 890px);
  max-width: 890px;
  padding: 7px;
  border: 1px solid #dfe8f2;
  border-radius: 17px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.ag-status-step {
  flex: 1 1 0;
  min-width: 112px;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: #f6f9fd;
  color: #667384;
  padding: 0 18px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  box-shadow: none;
}

.ag-status-step.is-active {
  background: #ffde83;
  color: #5d4707;
  box-shadow: inset 0 0 0 1px rgba(180, 125, 0, 0.12);
}

.badge.status-pending,
.ag-status-step.status-pending.is-active {
  background: #fff0bd;
  color: #6f4d00;
  border-color: #f1cf70;
}

.badge.status-reviewed,
.ag-status-step.status-reviewed.is-active {
  background: #dceeff;
  color: #155b8c;
  border-color: #acd3f2;
}

.badge.status-processing,
.ag-status-step.status-processing.is-active {
  background: #d9f1ff;
  color: #075e86;
  border-color: #9dd9f3;
}

.badge.status-incident,
.ag-status-step.status-incident.is-active {
  background: #ffe0dc;
  color: #9b2c21;
  border-color: #f2afa7;
}

.badge.status-completed,
.ag-status-step.status-completed.is-active {
  background: #d9f5df;
  color: #176333;
  border-color: #a9dfb6;
}

.badge.status-cancelled,
.ag-status-step.status-cancelled.is-active {
  background: #eceff3;
  color: #59616d;
  border-color: #cfd5dd;
}

.badge.status-archived {
  background: #e7ecea;
  color: #4d5c56;
  border-color: #ccd6d1;
}

.badge.status-neutral {
  background: #edf1f5;
  color: #536273;
  border-color: #d5dde5;
}

.ag-record-card {
  border: 1px solid var(--ag-border);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.ag-tabs {
  display: flex;
  align-items: stretch;
  min-height: 54px;
  border-bottom: 1px solid var(--ag-border);
  background: #f7f7f7;
}

.ag-tab,
.ag-tab-back {
  border: 0;
  border-right: 1px solid var(--ag-border);
  border-radius: 0;
  background: #f2f2f2;
  color: #26323f;
  padding: 0 20px;
  font-size: 1.08rem;
}

.ag-tab.is-active {
  background: #fff;
  color: var(--ag-red);
}

.ag-tab-back {
  margin-left: auto;
  border-left: 1px solid var(--ag-border);
  border-right: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.ag-tab-body {
  min-height: 330px;
}

.ag-form {
  padding: 18px 20px 30px;
}

.ag-ficha-grid,
.ag-form-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 18px 26px;
  align-items: end;
}

.ag-ficha-grid label,
.ag-form-row label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #111827;
  font-size: 0.9rem;
  font-weight: 620;
}

.ag-form-row input,
.ag-form-row select,
.ag-form-row textarea {
  font-weight: 450;
}

.ag-form-row.two {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.ag-form-row.narrow {
  grid-template-columns: minmax(260px, 540px) 34px 34px;
  padding: 18px 0 38px;
}

.ag-form-row .wide {
  grid-column: span 3;
}

.ag-form-row .compact {
  max-width: 160px;
}

.ag-side-meta {
  grid-column: span 2;
  justify-self: end;
  align-self: start;
  line-height: 2.15;
  color: #58616c;
}

.ag-form input,
.ag-form select,
.ag-form textarea,
.ag-table input,
.ag-table select,
.ag-table textarea {
  width: 100%;
  min-height: 33px;
  border: 1px solid #cfd8e3;
  border-radius: 4px;
  background: #fff;
  color: #243244;
  padding: 6px 9px;
}

.ag-form input:disabled,
.ag-form select:disabled {
  background: #ececec;
  color: #4b5563;
}

.ag-form textarea {
  min-height: 134px;
  resize: vertical;
}

.ag-band,
.ag-subsection-title {
  margin: 28px -20px 16px;
  background: var(--ag-band);
  color: #111827;
  padding: 11px 15px;
  font-size: 1.12rem;
  font-weight: 500;
}

.ag-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ag-band b {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: 6px;
  background: var(--ag-red);
  color: #fff;
  margin-left: 6px;
}

.ag-subsection-title {
  margin-top: 16px;
  background: var(--ag-band-soft);
  grid-column: 1 / -1;
}

.ag-icon-btn,
.ag-dark-btn {
  border: 0;
  border-radius: 4px;
  background: var(--ag-dark);
  color: #fff;
  min-height: 32px;
  padding: 6px 11px;
  font-weight: 800;
}

.ag-icon-btn {
  color: var(--ag-red);
  background: #fff;
  border: 1px solid #cfd8e3;
  font-size: 1rem;
}

.ag-dark-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ag-action-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--ag-border);
}

.ag-action-right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.ag-accordion-list {
  display: grid;
  gap: 8px;
}

.ag-accordion {
  border: 1px solid var(--ag-border);
  background: #fff;
}

.ag-accordion summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  background: var(--ag-band);
  color: #202a35;
  cursor: pointer;
  font-size: 1.12rem;
  list-style: none;
}

.ag-accordion summary::-webkit-details-marker {
  display: none;
}

.ag-accordion-body {
  padding: 18px 18px 20px;
}

.ag-inline-actions {
  display: flex;
  gap: 78px;
  margin-top: 24px;
}

.ag-toggle-select {
  max-width: 125px;
  text-align: center;
}

.ag-search-input {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 34px;
}

.ag-search-input button {
  border: 1px solid #cfd8e3;
  background: #ded7c9;
  color: #111827;
  font-weight: 900;
}

.ag-table-block {
  padding: 18px 14px 26px;
}

.ag-table-block h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
  font-weight: 500;
}

.ag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.ag-table th,
.ag-table td {
  border: 1px solid #edf0f3;
  padding: 10px;
  vertical-align: middle;
}

.ag-table th {
  background: #fff;
  color: #111827;
  font-weight: 900;
}

.ag-table td {
  background: #fff;
}

.ag-empty-row {
  text-align: center;
  color: #4b5563;
}

.ag-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 14px 18px;
}

.ag-dgt-report {
  margin: 0 18px 16px;
  padding: 14px 16px;
  border: 1px solid #cbddea;
  border-radius: 8px;
  background: #f7fbfe;
}

.ag-dgt-report-head,
.ag-dgt-report-actions,
.ag-dgt-report-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ag-dgt-report-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.ag-dgt-report h2 {
  margin: 0;
  font-size: 1rem;
}

.ag-dgt-report p,
.ag-dgt-report small {
  color: var(--muted);
  font-size: 0.78rem;
}

.ag-dgt-report p { margin: 3px 0 0; }

.ag-dgt-status {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5eef5;
  color: #244967;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.ag-dgt-report-actions { flex-wrap: wrap; }
.ag-dgt-plate { min-width: 240px; font-size: 0.86rem; }

.ag-dgt-upload {
  position: relative;
  padding: 8px 10px;
  border: 1px dashed #93aec4;
  border-radius: 6px;
  color: #244967;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.ag-dgt-file { font-size: 0.78rem; color: var(--muted); }

.ag-dgt-report-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dbe6ee;
  flex-wrap: wrap;
}

.ag-dgt-report-form label {
  display: grid;
  gap: 4px;
  min-width: 190px;
  color: #29445c;
  font-size: 0.75rem;
  font-weight: 800;
}

.ag-dgt-report-form input,
.ag-dgt-report-form select { min-height: 34px; }

.ag-file-group {
  border-top: 1px solid var(--ag-border);
}

.ag-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 20px 38px;
  padding: 14px 20px 26px;
}

.ag-upload-slot {
  border: 1px solid #dce2e9;
  background: #fff;
}

.ag-upload-title {
  border-bottom: 1px solid #dce2e9;
  padding: 11px 13px;
  min-height: 42px;
}

.ag-upload-box {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  min-height: 150px;
  margin: 20px;
  border: 2px dashed #c7d4e3;
  border-radius: 9px;
  background: #f4f7fb;
  color: #c2ccda;
  font-size: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.ag-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.ag-upload-slot.is-dragging .ag-upload-box {
  border-color: var(--brand);
  background: #eaf2f7;
  color: var(--brand);
}

.ag-upload-box:focus-within {
  border-color: var(--brand);
  outline: 3px solid rgba(31, 78, 104, 0.14);
  outline-offset: 2px;
}

.ag-upload-box span,
.ag-upload-box small {
  font-size: 0.78rem;
  color: var(--muted);
}

.ag-upload-box .ag-upload-plus {
  font-size: 2rem;
  color: #aebdce;
}

.ag-incidence-editor {
  padding: 16px 18px 20px;
  border-bottom: 1px solid var(--ag-border);
  background: #f8fafc;
}

.ag-incidence-editor h2 {
  margin: 0 0 14px;
}

.ag-payment-editor {
  padding: 16px 18px 20px;
  border-bottom: 1px solid var(--ag-border);
  background: #f8fafc;
}

.ag-payment-editor h2 {
  margin: 0 0 14px;
}

.ag-payment-form-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr repeat(2, 1fr) 1.1fr auto;
  gap: 14px;
  align-items: end;
}

@media (max-width: 1050px) {
  .ag-payment-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .ag-payment-form-grid {
    grid-template-columns: 1fr;
  }
}

.ag-incidence-form-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 2fr) auto;
  gap: 14px;
  align-items: end;
}

.ag-incidence-form-grid textarea {
  min-height: 82px;
  resize: vertical;
}

.ag-dark-btn.is-danger {
  background: #a53b35;
  border-color: #a53b35;
}

@media (max-width: 900px) {
  .ag-incidence-form-grid {
    grid-template-columns: 1fr;
  }
}

.actua-top-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: auto;
}

.actua-profile-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: center;
}

.actua-top-strip .actua-profile-menu .actua-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: auto;
  cursor: pointer;
}

.actua-top-strip .actua-profile-name {
  display: inline-block;
  max-width: 150px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actua-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  display: none;
  width: 230px;
  overflow: hidden;
  border: 1px solid #d7e1e9;
  border-radius: 8px;
  background: #ffffff;
  color: #172a3c;
  box-shadow: 0 18px 46px rgba(15, 31, 45, 0.24);
  padding: 6px;
}

.actua-profile-menu.is-open .actua-profile-dropdown {
  display: block;
}

.actua-profile-summary {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid #e3eaf0;
  margin-bottom: 5px;
  padding: 9px 10px 11px;
}

.actua-profile-summary span {
  color: #728395;
  font-size: 0.76rem;
  font-weight: 500;
}

.actua-top-strip .actua-profile-dropdown button {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #243b50;
  padding: 8px 10px;
  box-shadow: none;
}

.actua-top-strip .actua-profile-dropdown button:hover {
  background: #eef4f7;
}

.actua-top-strip .actua-profile-dropdown button.is-danger {
  color: #b33a35;
}

.actua-profile-dropdown button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.actua-profile-dropdown button span {
  display: inline;
  color: inherit;
  font-size: 0.8rem;
}

.ag-account-dialog {
  width: min(460px, calc(100vw - 32px));
  margin: auto;
  border: 1px solid #d7e1e9;
  border-radius: 8px;
  background: #ffffff;
  color: #172a3c;
  box-shadow: 0 24px 70px rgba(15, 31, 45, 0.3);
  padding: 0;
}

.ag-account-dialog::backdrop {
  background: rgba(15, 31, 45, 0.58);
}

.ag-account-dialog form {
  padding: 22px;
}

.ag-account-fields {
  display: grid;
  gap: 14px;
}

.ag-account-error {
  margin: 12px 0 0;
  color: #b33a35;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Identidad visual SURIDA */
:root {
  --bg: #edf2f6;
  --surface: #ffffff;
  --surface-2: #f5f8fb;
  --ink: #14273a;
  --muted: #687b8e;
  --line: #d4dfe8;
  --soft-line: #e7edf2;
  --brand: #0c2744;
  --brand-2: #173d60;
  --accent: #dce4ed;
  --shadow: 0 7px 18px rgba(12, 39, 68, 0.07);
  --shadow-md: 0 16px 38px rgba(12, 39, 68, 0.1);
}

body,
.layout,
.main {
  background: var(--bg);
}

.actua-top-strip {
  background: #0c2744;
  box-shadow: 0 5px 16px rgba(6, 24, 43, 0.16);
}

.brand-block {
  background: #0c2744;
  border-bottom-color: #29445f;
}

.brand-visual {
  border-radius: 9px;
  background: #ffffff;
}

.brand-logo {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  transform: none;
  transform-origin: center;
}

.brand-block::after {
  content: "SURIDA";
  align-self: center;
  margin-left: 14px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0.18em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.sidebar:hover .brand-visual,
.sidebar:focus-within .brand-visual,
.sidebar.is-auto-expanded .brand-visual {
  width: 62px;
  height: 62px;
}

.sidebar:hover .brand-logo,
.sidebar:focus-within .brand-logo,
.sidebar.is-auto-expanded .brand-logo {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.sidebar:hover .brand-block::after,
.sidebar:focus-within .brand-block::after,
.sidebar.is-auto-expanded .brand-block::after {
  opacity: 1;
  transform: translateX(0);
}

.sidebar:hover .brand-block,
.sidebar:focus-within .brand-block,
.sidebar.is-auto-expanded .brand-block {
  min-height: 82px;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: #cbd9e5;
  background: #e7eef4;
  color: #0c2744;
}

.nav-button:hover .nav-icon,
.nav-button.is-active .nav-icon {
  background: #d6e1eb;
  color: #0c2744;
}

.button.primary,
.ag-dark-btn {
  border-color: #0c2744;
  background: #0c2744;
}

/* Capa final telefono: prevalece sobre todos los estilos heredados anteriores. */
@media (max-width: 760px) {
  html,
  body,
  #app,
  .app-shell,
  .layout,
  .main {
    max-width: 100%;
    overflow-x: hidden;
  }

  .layout {
    display: block;
    min-height: 100dvh;
  }

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.is-auto-expanded,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) {
    position: sticky;
    top: 0;
    z-index: 200;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid #263f58;
    background: #0c2744;
  }

  .sidebar .brand-block,
  .sidebar:hover .brand-block,
  .sidebar:focus-within .brand-block,
  .sidebar.is-auto-expanded .brand-block,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-block {
    display: flex;
    width: 100%;
    height: 48px;
    min-height: 48px;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 5px 10px;
    border-bottom: 1px solid #263f58;
    background: #0c2744;
  }

  .sidebar .brand-visual,
  .sidebar:hover .brand-visual,
  .sidebar:focus-within .brand-visual,
  .sidebar.is-auto-expanded .brand-visual,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-visual {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 9px;
    background-color: #ffffff;
    background-image: url("./assets/surida-symbol.png?v=20260713-1");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 90%;
  }

  .sidebar .brand-logo,
  .sidebar:hover .brand-logo,
  .sidebar:focus-within .brand-logo,
  .sidebar.is-auto-expanded .brand-logo {
    display: none;
  }

  .sidebar .brand-block::after,
  .sidebar:hover .brand-block::after,
  .sidebar:focus-within .brand-block::after,
  .sidebar.is-auto-expanded .brand-block::after {
    content: "SURIDA";
    opacity: 1;
    transform: none;
    margin-left: 10px;
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 760;
    letter-spacing: 0.16em;
    white-space: nowrap;
  }

  .sidebar .brand-copy,
  .sidebar .nav-group-title {
    display: none;
  }

  .sidebar .nav,
  .sidebar:hover .nav,
  .sidebar:focus-within .nav,
  .sidebar.is-auto-expanded .nav {
    display: flex;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 8px 8px;
    background: #0c2744;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav-group,
  .sidebar .nav-submenu {
    display: contents;
  }

  .sidebar .nav-button,
  .sidebar:hover .nav-button,
  .sidebar:focus-within .nav-button,
  .sidebar.is-auto-expanded .nav-button,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .nav-button {
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
    height: 58px;
    min-height: 58px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 28px 1fr;
    place-items: center;
    gap: 2px;
    padding: 5px 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #eef5fb;
    text-align: center;
  }

  .sidebar .nav-button:hover,
  .sidebar .nav-button.is-active {
    border-color: rgba(255, 255, 255, 0.28);
    background: #ffffff;
    color: #0c2744;
  }

  .sidebar .nav-icon,
  .sidebar:hover .nav-icon,
  .sidebar:focus-within .nav-icon,
  .sidebar.is-auto-expanded .nav-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-size: 0.68rem;
  }

  .sidebar .nav-button span:not(.nav-icon),
  .sidebar:hover .nav-button span:not(.nav-icon),
  .sidebar:focus-within .nav-button span:not(.nav-icon),
  .sidebar.is-auto-expanded .nav-button span:not(.nav-icon) {
    display: block;
    width: 100%;
    overflow: hidden;
    color: inherit;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.05;
    opacity: 1;
    text-overflow: ellipsis;
    transform: none;
    white-space: nowrap;
  }

  .main {
    width: 100%;
    padding: 10px 10px 30px;
  }

  .main > * {
    max-width: 100%;
  }

  .grid > *,
  .split > *,
  .module-grid > *,
  .status-board > *,
  .field-grid > *,
  .operation-bar > *,
  .ag-dashboard-grid > *,
  .ag-state-gate > *,
  .ag-work-kpis > *,
  .ag-filter-grid > *,
  .ag-process-fields > *,
  .ag-form-row > * {
    min-width: 0;
    max-width: 100%;
  }

  .actua-top-strip {
    display: flex;
    width: calc(100% + 20px);
    min-height: 44px;
    height: auto;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    margin: -10px -10px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 8px;
    border-radius: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .actua-top-strip::-webkit-scrollbar {
    display: none;
  }

  .actua-top-strip button.actua-strip-icon,
  .actua-top-strip .actua-user-chip {
    flex: 0 0 auto;
    min-width: 38px;
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
    padding: 0 8px;
  }

  .actua-top-strip .actua-strip-label {
    display: none;
  }

  .actua-profile-dropdown,
  .ag-action-menu div,
  .ag-row-action-menu div {
    right: auto;
    left: 0;
    max-width: calc(100vw - 24px);
  }

  .topbar,
  .detail-header,
  .ag-client-detail-head,
  .ag-list-search,
  .ag-list-filter,
  .ag-list-panel,
  .panel,
  .ag-record-card,
  .ag-table-block,
  .ag-status-overview,
  .ag-state-gate {
    max-width: 100%;
    min-width: 0;
    border-radius: 10px;
  }

  .panel {
    overflow: hidden;
  }

  .topbar,
  .detail-header,
  .ag-client-detail-head,
  .ag-list-search,
  .ag-fiscal-toolbar,
  .ag-list-titlebar,
  .section-title,
  .history-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .topbar,
  .detail-header,
  .panel,
  .ag-list-search,
  .ag-list-filter,
  .ag-list-panel,
  .ag-table-block {
    padding: 12px;
  }

  .topbar h1,
  .detail-header h1,
  h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 1.32rem;
    line-height: 1.18;
  }

  h2,
  .ag-list-titlebar h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 1.02rem;
  }

  .topbar p,
  .detail-header p,
  .ag-list-search p {
    max-width: 100%;
  }

  .grid,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .module-grid,
  .status-board,
  .field-grid,
  .split,
  .operation-bar,
  .quick-status,
  .ag-form-row,
  .ag-form-row.two,
  .ag-form-row.narrow,
  .ag-process-fields,
  .ag-work-kpis,
  .ag-dashboard-grid,
  .ag-state-gate,
  .ag-filter-grid,
  .ag-client-dialog-grid,
  .ag-client-picker,
  .ag-payment-method-editor,
  .config-rule-grid,
  .check-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .field-grid .span-2,
  .field-grid .span-3,
  .field-grid .span-4,
  .ag-process-fields .span-4 {
    grid-column: auto;
  }

  label,
  .toolbar .filters label,
  .inline-form > label,
  .ag-list-toolbar .ag-list-controls > label,
  .ag-mini-field {
    min-width: 0;
  }

  input,
  select,
  textarea {
    min-width: 0;
    max-width: 100%;
    min-height: 40px;
    font-size: 16px;
  }

  .ag-list-search input,
  .ag-list-centered-search input[type="search"],
  .ag-expediente-topline .ag-list-search input {
    width: 100%;
  }

  .actions,
  .row-actions,
  .ag-row-actions,
  .actua-bulk-actions,
  .ag-list-titlebar .actions,
  .ag-list-heading-tools,
  .ag-list-controls,
  .ag-export-buttons,
  .ag-pagination,
  .ag-filter-actions,
  .ag-list-search-actions,
  .ag-fiscal-import,
  .history-actions,
  .ag-client-profile-actions {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 7px;
  }

  .topbar > .actions,
  .detail-header > .actions,
  .ag-client-detail-head > .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar > .actions:empty,
  .detail-header > .actions:empty {
    display: none;
  }

  .button,
  .icon-button,
  .ag-dark-btn,
  .ag-icon-button {
    min-width: 0;
  }

  .button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .button.mini {
    min-height: 32px;
    padding: 6px 8px;
  }

  .inline-form,
  .ag-inline-actions,
  .ag-client-choice-options {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .tabs,
  .ag-tabs,
  .ag-client-tabs,
  .ag-budget-tabs,
  .ag-budget-subtabs,
  .ag-fiscal-tabs,
  .ag-catalog-tabs,
  .ag-quick-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    gap: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar,
  .ag-tabs::-webkit-scrollbar,
  .ag-client-tabs::-webkit-scrollbar,
  .ag-budget-tabs::-webkit-scrollbar,
  .ag-budget-subtabs::-webkit-scrollbar,
  .ag-fiscal-tabs::-webkit-scrollbar,
  .ag-catalog-tabs::-webkit-scrollbar,
  .ag-quick-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button,
  .ag-tab,
  .ag-tab-back,
  .ag-client-tabs button,
  .ag-catalog-tabs .tab-button {
    flex: 0 0 auto;
    min-height: 38px;
    white-space: nowrap;
  }

  .ag-detail-page {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 0 24px;
    overflow-x: hidden;
  }

  .ag-record-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 0 10px;
    padding: 10px;
  }

  .ag-record-name {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    line-height: 1.22;
  }

  .ag-record-name strong {
    overflow-wrap: anywhere;
  }

  .ag-red-mark {
    font-size: 1.35rem;
  }

  .ag-status-stepper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    padding: 6px;
    border-radius: 10px;
  }

  .ag-status-step {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 0.68rem;
    line-height: 1.05;
  }

  .ag-status-overview {
    grid-template-columns: 1fr;
  }

  .table-wrap,
  .ag-table-block {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 640px;
  }

  .table-wrap.is-dense table,
  .ag-table,
  .ag-process-cost-table,
  .ag-list-table,
  .ag-invoice-table,
  .is-work-table {
    min-width: 720px;
  }

  .ag-dashboard-queue-table {
    min-width: 0;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .ag-action-footer,
  .ag-top-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ag-account-dialog,
  .ag-client-dialog,
  .ag-client-dialog-full,
  .ag-process-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .ag-account-dialog form,
  .ag-client-dialog form,
  .ag-client-dialog-full form,
  .ag-process-dialog > form {
    padding: 14px;
  }

  .sepria-budget-shell {
    height: calc(100dvh - 150px);
    min-height: 560px;
    margin: -2px -10px -30px;
  }

  .sepria-budget-iframe {
    min-height: 560px;
  }
}

@media (max-width: 430px) {
  .topbar > .actions,
  .detail-header > .actions,
  .ag-client-detail-head > .actions {
    grid-template-columns: 1fr;
  }

  .button:not(.mini),
  .ag-dark-btn:not(.mini) {
    width: 100%;
  }
}

/* Vehiculo: matricula, marca y modelo no deben bailar al validar o cargar ayudas. */
.ag-form-row label:has(input[data-plate-field]),
.ag-form-row label[data-field-id="marca"]:has([data-hacienda-make]),
.ag-form-row label[data-field-id="modeloDgt"]:has([data-hacienda-model-input]),
.ag-form-row label[data-field-id="modelo"]:has([data-hacienda-model-input]) {
  position: relative;
  align-self: start;
  min-width: 0;
  contain: layout;
}

.ag-form-row label:has(input[data-plate-field]) {
  grid-template-rows: auto 34px 18px;
  min-height: 102px;
}

.ag-form-row label:has(input[data-plate-field]) .ag-search-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  grid-template-columns: 40px minmax(0, 1fr) 34px;
}

.ag-form-row label:has(input[data-plate-field]) .ag-search-input > input,
.ag-form-row label:has(input[data-plate-field]) .ag-search-input > button {
  height: 34px;
  min-height: 34px;
  box-sizing: border-box;
}

.ag-form-row label:has(input[data-plate-field]) .ag-plate-feedback {
  position: absolute;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.ag-form-row label[data-field-id="marca"]:has([data-hacienda-make]),
.ag-form-row label[data-field-id="modeloDgt"]:has([data-hacienda-model-input]),
.ag-form-row label[data-field-id="modelo"]:has([data-hacienda-model-input]) {
  grid-template-rows: auto 34px;
  min-height: 72px;
}

.ag-form-row label[data-field-id="marca"]:has([data-hacienda-make]) .ag-hacienda-brand-picker,
.ag-form-row label[data-field-id="modeloDgt"]:has([data-hacienda-model-input]) .ag-hacienda-picker,
.ag-form-row label[data-field-id="modelo"]:has([data-hacienda-model-input]) .ag-hacienda-picker {
  width: 100%;
  min-width: 0;
  height: 34px;
}

.ag-form-row label[data-field-id="marca"]:has([data-hacienda-make]) input,
.ag-form-row label[data-field-id="modeloDgt"]:has([data-hacienda-model-input]) input:not([type="hidden"]),
.ag-form-row label[data-field-id="modelo"]:has([data-hacienda-model-input]) input:not([type="hidden"]),
.ag-form-row label[data-field-id="modeloDgt"]:has([data-hacienda-model-input]) .ag-clear-vehicle,
.ag-form-row label[data-field-id="modelo"]:has([data-hacienda-model-input]) .ag-clear-vehicle {
  height: 34px;
  min-height: 34px;
  box-sizing: border-box;
}

.ag-representative-heading .ag-representative-check-inline {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  line-height: 1 !important;
}

.ag-representative-heading .ag-representative-check-inline input[type="checkbox"] {
  order: 0 !important;
  flex: 0 0 16px !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
}

.ag-representative-heading .ag-representative-check-inline > span {
  order: 1 !important;
  display: inline-block !important;
  line-height: 16px !important;
}

/* Centro de presupuestos: el cálculo y las tablas comparten una sola superficie. */
.ag-budget-tabs {
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
}

.ag-budget-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

.ag-budget-card,
.ag-budget-result {
  min-width: 0;
  border: 1px solid #d9e4ed;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.ag-budget-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ag-budget-card-head h2,
.ag-budget-result h2,
.ag-budget-result h3 {
  margin: 0;
}

.ag-budget-kicker {
  display: block;
  margin-bottom: 3px;
  color: #66809a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ag-budget-form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.ag-budget-form-grid label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #36516d;
  font-size: 0.77rem;
  font-weight: 750;
  line-height: 1.25;
}

.ag-budget-form-grid input,
.ag-budget-form-grid select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  margin: 0;
  border: 1px solid #cfddea;
  border-radius: 7px;
  background: #fff;
  color: #19334f;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
}

.ag-budget-form-grid input::placeholder {
  color: #8193a7;
  font-weight: 400;
}

.ag-budget-form-grid input:focus,
.ag-budget-form-grid select:focus {
  border-color: #1f5d8b;
  outline: 3px solid rgba(31, 93, 139, 0.13);
  outline-offset: 0;
}

.ag-budget-form-grid input[type="number"] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ag-budget-form-grid label:nth-child(1),
.ag-budget-form-grid label:nth-child(4),
.ag-budget-form-grid label:nth-child(5),
.ag-budget-form-grid label:nth-child(8) {
  grid-column: span 2;
}

.ag-budget-card .actions {
  margin-top: 18px;
}

.ag-budget-help {
  margin: 10px 0 0;
  color: #70859a;
  font-size: 0.78rem;
  line-height: 1.4;
}

.ag-budget-total {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d9e4ed;
  border-radius: 7px;
  background: #f1f5f9;
  color: #536b83;
}

.ag-budget-total strong {
  color: #0c2744;
  font-size: 1.55rem;
}

.ag-budget-result h3 {
  margin-top: 18px;
  padding: 10px 12px;
  border-left: 4px solid #f2a228;
  background: #0c2744;
  color: #fff;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.ag-budget-result-lines {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ag-budget-result-lines > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px;
  border: 1px solid #f0d9ae;
  border-radius: 6px;
  background: #fff8ea;
}

.ag-budget-result-lines span {
  color: #0c2744;
  font-weight: 700;
  text-align: right;
}

.ag-budget-default-costs {
  margin-top: 16px;
  border: 1px solid #dce7ef;
  border-radius: 7px;
  overflow: hidden;
}

.ag-budget-default-costs h3 {
  margin: 0;
  padding: 10px 12px;
  background: #f4f7fa;
  color: #19334f;
  font-size: 0.84rem;
  text-transform: none;
}

.ag-budget-default-costs > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid #e7eef4;
  color: #48627a;
}

.ag-budget-default-costs > div strong {
  color: #0c2744;
}

.ag-budget-default-costs .small {
  margin: 10px 12px;
}

.ag-budget-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 16px;
}

@media (max-width: 1180px) {
  .ag-budget-workspace { grid-template-columns: 1fr; }
  .ag-budget-form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .ag-budget-card,
  .ag-budget-result { padding: 14px; }
  .ag-budget-form-grid { grid-template-columns: 1fr 1fr; }
  .ag-budget-form-grid label:nth-child(1),
  .ag-budget-form-grid label:nth-child(4),
  .ag-budget-form-grid label:nth-child(5),
  .ag-budget-form-grid label:nth-child(8) { grid-column: span 2; }
}

/* El lienzo de la aplicacion nunca debe crear espacio vacio ni scroll lateral. */
html,
body,
#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.layout,
.main,
.main > * ,
.ag-form,
.ag-accordion-list,
.ag-accordion,
.ag-accordion-body {
  min-width: 0;
  max-width: 100%;
}

.layout {
  width: 100%;
  overflow-x: hidden;
}

.ag-form-row,
.ag-ficha-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  min-width: 0;
}

.ag-form-row .wide {
  grid-column: 1 / -1;
}

/* Las tablas mantienen el scroll solo dentro de su contenedor propio. */
.table-wrap {
  max-width: 100%;
}

/* La validacion del NIF no debe alterar la altura de la fila del formulario. */
.ag-form-row label:has([data-tax-id-feedback], [data-plate-feedback]) {
  position: relative;
}

.ag-form-row .ag-tax-id-feedback,
.ag-form-row .ag-plate-feedback {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 2;
  width: max-content;
  max-width: 100%;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.1;
  white-space: nowrap;
}

.ag-form-row {
  row-gap: 28px;
}

.ag-process-dialog {
  width: min(1060px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  margin: auto;
  overflow: auto;
  border: 1px solid #d4dfe8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(7, 25, 45, 0.3);
  padding: 0;
}

.ag-process-dialog::backdrop {
  background: rgba(7, 25, 45, 0.58);
}

.ag-process-dialog > form {
  padding: 20px;
}

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

.ag-process-fields .span-4 {
  grid-column: 1 / -1;
}

.ag-process-fields textarea {
  min-height: 76px;
}

.ag-process-cost-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 10px;
}

.ag-process-cost-heading h3,
.ag-process-cost-heading p {
  margin: 0;
}

.ag-process-cost-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.ag-process-cost-table {
  min-width: 820px;
}

.ag-process-cost-table input,
.ag-process-cost-table select {
  width: 100%;
  min-width: 100px;
}

.ag-inline-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ag-icon-button.is-danger {
  border-color: #efd2cf;
  background: #fff5f4;
  color: #a5322d;
}

@media (max-width: 760px) {
  .ag-process-fields {
    grid-template-columns: 1fr;
  }

  .ag-process-fields .span-4 {
    grid-column: auto;
  }
}

/* El menu plegado conserva el scroll con rueda, pero no muestra la barra. */
.sidebar {
  overflow-x: hidden;
}

.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded)::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar:hover,
.sidebar:focus-within,
.sidebar.is-auto-expanded {
  scrollbar-width: thin;
  scrollbar-color: #8da0b3 transparent;
}

.sidebar:hover::-webkit-scrollbar,
.sidebar:focus-within::-webkit-scrollbar,
.sidebar.is-auto-expanded::-webkit-scrollbar {
  width: 7px;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar:focus-within::-webkit-scrollbar-thumb,
.sidebar.is-auto-expanded::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: #8da0b3;
}

/* Bandeja de tramites compacta */
.ag-expediente-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.ag-expediente-topline .ag-list-search {
  min-height: 46px;
  margin: 0;
  padding: 7px 12px;
}

.ag-expediente-topline .ag-list-search h2 {
  font-size: 1.08rem;
}

.ag-expediente-topline .ag-list-search input {
  min-height: 32px;
}

.ag-expediente-topline .ag-list-filter {
  width: 210px;
  margin: 0;
}

.ag-expediente-topline .ag-list-filter summary {
  min-height: 46px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.ag-expediente-topline .ag-list-filter[open] {
  grid-column: 1 / -1;
  width: 100%;
}

.ag-list-titlebar {
  min-height: 48px;
  padding: 6px 12px;
}

.ag-list-heading-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 7px;
  width: 100%;
}

.ag-list-panel > .ag-list-titlebar > h2 {
  display: none;
}

.ag-bulk-strip.ag-bulk-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.ag-bulk-compact .ag-action-group summary {
  min-height: 30px;
  padding: 5px 9px;
}

.ag-list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) minmax(0, 1fr);
  align-items: center;
  min-height: 48px;
  padding: 7px 12px;
}

.ag-list-toolbar .ag-list-controls > label {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 6px;
  white-space: nowrap;
}

.ag-list-centered-search {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.ag-list-centered-search label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: 0;
  white-space: nowrap;
}

.ag-list-centered-search input[type="search"] {
  width: 100%;
  min-width: 0;
}

.ag-list-pagination-slot {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.ag-list-toolbar .ag-list-controls select,
.ag-list-toolbar .ag-list-controls input,
.ag-list-toolbar .ag-page-button {
  min-height: 30px;
}

.ag-list-toolbar .ag-page-button {
  min-width: 32px;
}

@media (max-width: 980px) {
  .ag-expediente-topline {
    grid-template-columns: 1fr;
  }

  .ag-expediente-topline .ag-list-filter {
    width: 100%;
  }

  .ag-list-heading-tools,
  .ag-list-toolbar {
    justify-content: flex-start;
  }

  .ag-list-toolbar {
    grid-template-columns: 1fr;
  }

  .ag-list-centered-search,
  .ag-list-pagination-slot {
    grid-column: 1;
    justify-content: flex-start;
    width: 100%;
  }
}

.actua-top-brand {
  display: flex;
  align-items: center;
  align-self: stretch;
  width: min(650px, calc(100vw - 520px));
  min-width: 480px;
  height: 52px;
  margin-right: auto;
  gap: 10px;
  overflow: hidden;
  background: transparent;
  color: #ffffff;
}

.actua-top-brand > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}

.actua-top-brand strong {
  color: #ffffff;
  font-family: "Century Gothic", "Avenir Next", "Montserrat", "Segoe UI", sans-serif;
  font-size: 1.22rem;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(145, 174, 214, 0.2);
}

.actua-top-brand small {
  color: #c7d3df;
  font-family: "Century Gothic", "Avenir Next", "Montserrat", "Segoe UI", sans-serif;
  font-size: 0.56rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.actua-top-brand i {
  color: #7699c7;
  font-size: 0.72rem;
  font-style: normal;
}

@media (max-width: 760px) {
  .actua-top-brand {
    width: auto;
    min-width: 0;
    gap: 7px;
  }

  .actua-top-brand small,
  .actua-top-brand i {
    display: none;
  }

  .actua-top-brand strong {
    font-size: 1rem;
  }
}

.ag-page-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.ag-account-help {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #d9e3ee;
  border-radius: 7px;
  background: #f5f8fb;
  color: #516579;
  font-size: 0.82rem;
}

.ag-catalog-tabs {
  align-items: center;
  gap: 4px;
  margin: -4px 0 14px;
  overflow: visible;
}

.ag-catalog-tabs .ag-catalog-create {
  margin-left: auto;
  margin-right: 4px;
  flex: 0 0 auto;
}

.ag-catalog-tabs .tab-button {
  min-width: 150px;
  padding: 11px 16px 10px;
  text-align: center;
}

.ag-catalog-panel .section-title {
  margin-bottom: 8px;
}

.ag-representative-check {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.ag-representative-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* La activación vive en la cabecera: no reserva una fila vacía del formulario. */
.ag-representative-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ag-representative-check-inline {
  grid-column: auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  border: 0;
  font-size: 0.88rem;
  line-height: 1;
  white-space: nowrap;
}

.ag-representative-check-inline input[type="checkbox"] {
  order: 0;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0 6px 0 0;
}

.ag-representative-check-inline > span {
  order: 1;
  display: inline-block;
  line-height: 16px;
}

/* Los ajustes opcionales del vehículo se muestran en una misma banda compacta. */
.ag-form-row label.ag-conditional-check {
  grid-column: span 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.ag-conditional-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

details[data-accordion-section-id="sec-transferencia-vehiculo"] .ag-accordion-body,
details[data-accordion-section-id="sec-vehiculo"] .ag-accordion-body {
  padding-top: 14px;
  padding-bottom: 14px;
}

details[data-accordion-section-id="sec-transferencia-vehiculo"] .ag-form-row,
details[data-accordion-section-id="sec-vehiculo"] .ag-form-row {
  row-gap: 18px;
}

details[data-accordion-section-id="sec-transferencia-vehiculo"] .ag-inline-actions,
details[data-accordion-section-id="sec-vehiculo"] .ag-inline-actions {
  gap: 12px;
  margin-top: 14px;
}

/* La casilla es la unica puerta de entrada a los datos del representante. */
[data-field-id][hidden] {
  display: none !important;
}

[data-representative-field][hidden] {
  display: none !important;
}

[data-client-representative][hidden] {
  display: none !important;
}

/* Factura y contrato/documento son bloques excluyentes. */
.ag-transmission-field[hidden] {
  display: none !important;
}

/* Los grupos dependientes de una casilla no ocupan espacio hasta activarse. */
[data-conditional-group][hidden] {
  display: none !important;
}

.ag-binary-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.ag-binary-label {
  min-height: 32px;
  color: var(--text);
  font-weight: 700;
}

.ag-binary-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(50px, 1fr));
  width: 124px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fb;
}

.ag-binary-control label {
  display: block;
  min-width: 0;
  cursor: pointer;
}

.ag-binary-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ag-binary-control span {
  display: grid;
  place-items: center;
  height: 100%;
  color: #52677b;
  font-size: 0.78rem;
  font-weight: 800;
}

.ag-binary-control input:checked + span {
  background: var(--brand);
  color: #ffffff;
}

.clean-ficha-grid {
  grid-template-columns: minmax(190px, 1fr) minmax(240px, 1.15fr) minmax(24px, 1fr) minmax(210px, 1fr) minmax(210px, 1fr);
  gap: 18px 24px;
  align-items: end;
}

.ag-ficha-number {
  grid-column: 1;
  min-width: 0;
}

.ag-ficha-number > label {
  display: grid;
  gap: 8px;
}

.clean-ficha-grid .ag-ficha-created {
  grid-column: 5;
  justify-self: end;
  align-self: end;
  white-space: nowrap;
  text-align: right;
}

.clean-ficha-grid .ag-ficha-process {
  grid-column: 2;
}

.clean-ficha-grid .ag-ficha-status {
  grid-column: 3;
}

.ag-clients-panel {
  width: 100%;
}

.ag-clients-title {
  margin-bottom: 10px;
}

.ag-clients-title .button {
  margin-left: auto;
}

.ag-client-dialog-full {
  width: min(1320px, calc(100vw - 32px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.ag-client-dialog-full form {
  padding: 18px;
}

.ag-client-section {
  margin: 0 -18px;
  padding: 0 18px 18px;
}

.ag-client-section > h3 {
  margin: 0 -18px 14px;
  padding: 10px 14px;
  background: #e9edf1;
  color: #263b50;
  font-size: 0.98rem;
  font-weight: 650;
}

.ag-client-fields {
  display: grid;
  gap: 12px 18px;
}

.ag-client-fields.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ag-client-fields.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ag-client-fields.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ag-client-fields .span-2 { grid-column: span 2; }

.ag-client-fields label,
.ag-client-notes {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #2f4357;
  font-size: 0.78rem;
  font-weight: 700;
}

.ag-client-fields input,
.ag-client-fields select,
.ag-client-fields textarea,
.ag-client-notes textarea {
  width: 100%;
}

.ag-tax-id-feedback {
  display: block;
  margin-top: 5px;
  font-size: 0.72rem;
  font-weight: 650;
}

.ag-tax-id-feedback.is-valid { color: #177245; }
.ag-tax-id-feedback.is-existing { color: #9a5b00; }
.ag-tax-id-feedback.is-error { color: #b42318; }

.ag-plate-feedback { color: #9a5b00; }
.ag-plate-feedback.is-found { color: #177245; }

input.is-valid-tax-id { border-color: #56b788 !important; background: #f3fbf7 !important; }
input.is-invalid-tax-id { border-color: #d8645b !important; background: #fff6f5 !important; }

/* NIF y caducidad NIF: cajas fijas aunque aparezca validacion/autorelleno. */
.ag-form-row label:has(input[data-tax-id-field]),
.ag-form-row label:has(input[name$="FechaCaducidadNif"]),
.ag-client-fields label:has(input[name="taxId"]),
.ag-client-fields label:has(input[name="taxIdExpiry"]),
.ag-client-fields label:has(input[name="representativeTaxId"]) {
  position: relative;
  align-self: start;
  min-width: 0;
  min-height: 72px;
  contain: layout;
}

.ag-form-row label:has(input[data-tax-id-field]) .ag-search-input {
  width: 100%;
  min-width: 0;
  grid-template-columns: 40px minmax(0, 1fr) 34px;
}

.ag-form-row label:has(input[data-tax-id-field]) .ag-search-input > input,
.ag-form-row label:has(input[data-tax-id-field]) .ag-search-input > button,
.ag-form-row label:has(input[name$="FechaCaducidadNif"]) input,
.ag-client-fields label:has(input[name="taxId"]) input,
.ag-client-fields label:has(input[name="taxIdExpiry"]) input,
.ag-client-fields label:has(input[name="representativeTaxId"]) input {
  height: 34px;
  min-height: 34px;
  box-sizing: border-box;
}

.ag-form-row label:has(input[data-tax-id-field]) .ag-tax-id-feedback,
.ag-client-fields label:has(input[name="taxId"]) .ag-tax-id-feedback,
.ag-client-fields label:has(input[name="representativeTaxId"]) .ag-tax-id-feedback {
  position: absolute;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.ag-client-representative-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0;
  background: #e9edf1;
}

.ag-client-representative-head > h3 {
  margin: 0;
  background: transparent;
}

.ag-client-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.ag-client-representative {
  margin: 0 -18px;
  padding: 16px 18px 20px;
  border-bottom: 1px solid var(--line);
}

.ag-client-binary {
  display: inline-grid;
  grid-template-columns: repeat(2, 48px);
  width: max-content;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.ag-client-binary label { display: block; cursor: pointer; }
.ag-client-binary input { position: absolute; opacity: 0; }
.ag-client-binary span { display: grid; place-items: center; height: 31px; color: #566b7e; font-size: 0.72rem; font-weight: 800; }
.ag-client-binary input:checked + span { background: var(--brand); color: #fff; }

.ag-client-notes textarea {
  min-height: 120px;
}

@media (max-width: 1000px) {
  .ag-client-fields.cols-5,
  .ag-client-fields.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .ag-client-fields.cols-4,
  .ag-client-fields.cols-5,
  .ag-client-fields.cols-6 { grid-template-columns: 1fr; }
  .ag-client-fields .span-2 { grid-column: auto; }
}

@media (max-width: 1050px) {
  .clean-ficha-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .ag-ficha-number,
  .clean-ficha-grid .ag-ficha-created,
  .clean-ficha-grid .ag-ficha-process,
  .clean-ficha-grid .ag-ficha-status {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .clean-ficha-grid {
    grid-template-columns: 1fr;
  }
}

.ag-page-ellipsis {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  color: var(--muted);
  font-weight: 700;
}

.ag-upload-box strong {
  color: #243244;
  font-size: 0.9rem;
}

.ag-red-note,
.ag-red-link,
.ag-red-text {
  color: var(--ag-red);
}

.ag-red-note {
  margin-top: 18px;
  line-height: 1.55;
}

.ag-followups {
  width: min(890px, 100%);
  margin-top: 18px;
  border: 1px solid var(--ag-border);
  border-radius: 4px;
  background: #fff;
}

.ag-followups > summary {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  color: #17212b;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.ag-followups > summary::-webkit-details-marker {
  display: none;
}

.ag-followups > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--brand);
  font-size: 1.1rem;
}

.ag-followups[open] > summary {
  border-bottom: 1px solid #edf0f3;
}

.ag-followups[open] > summary::after {
  content: "-";
}

.ag-followups-head,
.ag-followups-input,
.ag-followups-count {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #edf0f3;
}

.ag-followups-head {
  justify-content: space-between;
}

.ag-followups-input input {
  flex: 1;
  min-height: 34px;
  border: 1px solid #cfd8e3;
  border-radius: 4px;
  padding: 6px 9px;
}

.ag-followups-count {
  justify-content: flex-end;
  border-bottom: 0;
  color: #6b7280;
}

.ag-followups-list {
  display: grid;
}

.ag-followup-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 34px;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #edf0f3;
}

.ag-followup-delete {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #f2c8c2;
  border-radius: 6px;
  background: #fff7f5;
  color: #b3392e;
  cursor: pointer;
}

.ag-followup-delete:hover {
  background: #fee9e5;
}

.ag-followup-delete svg {
  width: 17px;
  height: 17px;
}

.ag-followup-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6b7280;
  font-size: 0.84rem;
}

.ag-followup-meta strong {
  color: #17212b;
}

.ag-followup-item p {
  margin: 5px 0 0;
  white-space: pre-wrap;
}

.ag-avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #243244;
  color: #fff;
  font-weight: 900;
}

.ag-avatar.mini {
  width: 32px;
  height: 32px;
}

.ag-avatar.small {
  width: 30px;
  height: 30px;
  font-size: 0.78rem;
}

.ag-empty {
  padding: 28px;
  color: #6b7280;
}

@media (max-width: 1200px) {
  .ag-record-head {
    grid-template-columns: 1fr;
  }

  .ag-status-stepper {
    max-width: none;
  }

  .ag-ficha-grid,
  .ag-form-row {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .ag-upload-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }
}

@media (max-width: 760px) {
  .ag-action-footer,
  .ag-tabs,
  .ag-top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ag-status-stepper,
  .ag-ficha-grid,
  .ag-form-row,
  .ag-form-row.two,
  .ag-form-row.narrow,
  .ag-upload-grid {
    grid-template-columns: 1fr;
  }

  .ag-tab-back,
  .ag-action-right {
    margin-left: 0;
  }
}

.layout {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  width: 64px;
  padding: 0;
  border-right: 1px solid #d8dde4;
  background: #f7f9fc;
}

.brand-block {
  height: 64px;
  padding: 8px;
  margin: 0;
  border-bottom: 1px solid #d8dde4;
}

.brand-logo {
  width: 42px;
  height: 42px;
  margin: 0 auto;
}

.brand-copy,
.nav-group-title,
.nav-button span:not(.nav-icon) {
  display: none;
}

.nav {
  display: block;
  padding: 8px 0;
}

.nav-group {
  margin: 0;
}

.nav-submenu {
  display: grid;
  gap: 0;
}

.nav-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 56px;
  border: 0;
  border-radius: 0;
  padding: 0;
  grid-template-columns: 1fr;
  background: transparent;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.nav-button:hover .nav-icon,
.nav-button.is-active .nav-icon {
  color: #fff;
  background: transparent;
}

.nav-icon {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: #344255;
  font-size: 0.92rem;
  font-weight: 900;
}

.main {
  padding: 0 18px 44px;
  background: #e9eef4;
}

.actua-top-strip {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  min-height: 64px;
  margin: 0 -18px 18px;
  padding: 0 18px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.actua-top-strip button,
.actua-user-chip {
  min-width: 32px;
  min-height: 64px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  padding: 0;
}

.actua-top-strip button span {
  display: none;
}

.actua-top-strip button strong {
  min-width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand);
}

.actua-top-strip .is-primary {
  background: transparent;
  color: #fff;
}

.actua-top-strip .is-primary strong {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.actua-user-chip {
  padding-right: 8px;
  font-weight: 800;
}

.actua-user-chip span {
  color: #fff;
}

.topbar h1,
.ag-list-titlebar h2,
.ag-tab,
.nav-button,
.button {
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 1.42rem;
  font-weight: 760;
  line-height: 1.2;
}

.eyebrow,
.nav-group-title,
th {
  letter-spacing: 0;
  text-transform: none;
}

.nav-group-title {
  height: auto;
  margin: 10px 0 5px;
  color: #6d7c8a;
  font-size: 0.72rem;
}

.ag-work-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.ag-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 14px;
  margin-top: 14px;
}

.ag-dashboard-grid > .ag-list-panel {
  min-width: 0;
}

.table-wrap.is-dense > table.ag-dashboard-queue-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.ag-dashboard-queue-table th,
.ag-dashboard-queue-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.ag-dashboard-queue-table th:nth-child(1),
.ag-dashboard-queue-table td:nth-child(1) {
  width: 28%;
}

.ag-dashboard-queue-table th:nth-child(2),
.ag-dashboard-queue-table td:nth-child(2) {
  width: 24%;
}

.ag-dashboard-queue-table th:nth-child(3),
.ag-dashboard-queue-table td:nth-child(3) {
  width: 18%;
}

.ag-dashboard-queue-table th:nth-child(4),
.ag-dashboard-queue-table td:nth-child(4) {
  width: 15%;
}

.ag-dashboard-queue-table th:nth-child(5),
.ag-dashboard-queue-table td:nth-child(5) {
  width: 15%;
}

.ag-dashboard-queue-table .button {
  max-width: 100%;
  padding-inline: 7px;
  white-space: nowrap;
}

.ag-state-gate {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(130px, 0.6fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9fbfd;
}

.ag-state-gate.is-blocked {
  border-color: #e8d18b;
  background: #fffaf0;
}

.ag-state-gate.is-ready {
  border-color: #b9dec8;
  background: #f3fbf6;
}

.ag-state-gate div {
  display: grid;
  gap: 4px;
}

.ag-state-gate span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.ag-state-gate strong {
  color: var(--ink);
  font-size: 1rem;
}

.ag-state-gate ul,
.ag-state-gate p {
  grid-column: 1 / -1;
  margin: 0;
  color: #4a5b6c;
  font-size: 0.84rem;
}

.ag-state-gate ul {
  display: grid;
  gap: 4px;
  padding-left: 18px;
}

.ag-section-warning {
  margin-bottom: 10px;
  border: 1px solid #ead7a2;
  border-radius: 12px;
  background: #fff9e8;
  color: #73500b;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 760;
}

.ag-action-group {
  position: relative;
}

.ag-action-group summary {
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 780;
  list-style: none;
  cursor: pointer;
}

.ag-action-group summary::-webkit-details-marker {
  display: none;
}

.ag-action-group[open] summary {
  border-color: #b9c8d4;
  background: #eef5fb;
}

.ag-action-group div {
  position: absolute;
  z-index: 20;
  display: grid;
  gap: 6px;
  min-width: 210px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

.ag-status-step.is-done {
  background: #edf4fa;
  color: #405166;
}

.ag-status-step.is-locked {
  cursor: not-allowed;
  opacity: 1;
}

.ag-status-step:disabled {
  cursor: not-allowed;
}

.ag-action-menu,
.ag-row-action-menu {
  position: relative;
}

.ag-action-menu summary,
.ag-row-action-menu summary {
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  background: #343a40;
  color: #ffffff;
  padding: 7px 11px;
  font-size: 0.82rem;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.ag-action-menu.is-primary summary {
  background: var(--brand);
}

.ag-row-action-menu summary {
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand);
  padding: 5px 9px;
  font-size: 0.78rem;
}

.ag-action-menu summary::-webkit-details-marker,
.ag-row-action-menu summary::-webkit-details-marker {
  display: none;
}

.ag-action-menu[open] summary,
.ag-row-action-menu[open] summary {
  filter: brightness(0.96);
}

.ag-action-menu div,
.ag-row-action-menu div {
  position: absolute;
  right: 0;
  z-index: 50;
  display: grid;
  gap: 6px;
  min-width: 220px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.ag-action-menu div .button,
.ag-row-action-menu div .button {
  justify-content: flex-start;
}

.ag-action-menu.is-document-menu > div {
  width: min(330px, calc(100vw - 32px));
  max-height: min(72vh, 620px);
  overflow-y: auto;
  align-content: start;
}

.ag-action-menu.is-document-menu > div .button {
  min-height: 34px;
  white-space: normal;
  text-align: left;
}

/* Los menus de acciones del pie del expediente se abren hacia arriba para
   no cubrir el bloque de seguimiento que queda justo debajo. */
.ag-action-footer .ag-action-menu > div {
  top: auto;
  bottom: calc(100% + 6px);
  margin-top: 0;
}

.ag-action-hint {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.ag-dark-btn:disabled,
.ag-action-menu button:disabled,
.ag-row-action-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ag-select-count {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  border: 1px solid #d7e3ec;
  border-radius: 999px;
  background: #f8fbfd;
  color: #3e5264;
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 780;
}

.is-work-table {
  min-width: 1420px;
}

.is-work-table th,
.is-work-table td {
  font-size: 0.82rem;
}

.is-work-table .ag-row-actions {
  min-width: 265px;
}

.ag-blocker-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1.5fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft-line);
}

.ag-blocker-row small {
  color: var(--muted);
}

@media (max-width: 1200px) {
  .ag-work-kpis,
  .ag-dashboard-grid,
  .ag-state-gate {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ag-work-kpis,
  .ag-dashboard-grid,
  .ag-state-gate {
    grid-template-columns: 1fr;
  }

  .ag-blocker-row {
    grid-template-columns: 1fr;
  }
}

.ag-list-search,
.ag-list-filter,
.ag-list-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.ag-list-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
}

.ag-list-search h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 780;
}

.ag-list-search input {
  width: min(360px, 42vw);
  min-height: 34px;
  border-radius: 10px;
}

.ag-list-search .ag-list-search-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ag-list-filter {
  margin-bottom: 14px;
  overflow: hidden;
}

.ag-list-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 780;
  list-style: none;
  cursor: pointer;
}

.ag-list-filter summary::-webkit-details-marker {
  display: none;
}

.ag-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.ag-filter-grid label,
.ag-list-toolbar label,
.ag-mini-field {
  gap: 5px;
  font-size: 0.78rem;
}

.ag-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.ag-list-panel {
  overflow: hidden;
}

.ag-list-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.ag-list-titlebar h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 780;
}

.ag-list-titlebar .actions,
.ag-list-controls,
.ag-export-buttons,
.ag-pagination,
.ag-bulk-strip,
.ag-row-actions,
.ag-quick-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.ag-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
  background: #ffffff;
}

.ag-list-controls select,
.ag-list-toolbar input,
.ag-mini-field input,
.ag-mini-field select {
  min-height: 32px;
  border-radius: 10px;
}

.ag-list-toolbar input[type="search"] {
  width: min(280px, 28vw);
}

.ag-pagination {
  margin-left: auto;
}

.ag-page-button {
  min-width: 36px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: #3e5264;
  font-weight: 760;
}

.ag-page-button.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.ag-bulk-strip {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.ag-bulk-strip strong {
  margin-right: 4px;
  color: #3e5264;
  font-size: 0.82rem;
}

.ag-list-table {
  min-width: 1580px;
}

.ag-list-table th,
.ag-list-table td {
  vertical-align: top;
}

.ag-list-table th {
  white-space: nowrap;
}

.ag-list-table td {
  font-size: 0.86rem;
}

.ag-list-table tr.is-urgent td {
  background: #fffaf0;
}

.ag-row-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 820;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}

.ag-row-primary:hover .ag-id-text,
.ag-row-primary:focus-visible .ag-id-text {
  color: var(--brand);
  text-decoration: underline;
}

.ag-row-primary:focus-visible {
  outline: 2px solid rgba(31, 78, 104, 0.3);
  outline-offset: 3px;
  border-radius: 8px;
}

.ag-row-primary .ag-row-hash,
.ag-row-primary > span:first-child {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 26px;
  height: 22px;
  border-radius: 8px;
  background: #e7eef4;
  color: var(--brand);
  font-size: 0.72rem;
}

.ag-id-text {
  display: inline-block;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.ag-cell-stack {
  display: grid;
  gap: 5px;
}

.ag-cell-muted {
  color: var(--muted);
  font-size: 0.78rem;
}

.ag-pill-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.ag-pill-line .pill,
.ag-tiny-pill {
  border: 1px solid #d7e3ec;
  border-radius: 999px;
  background: #f8fbfd;
  color: #3e5264;
  padding: 3px 7px;
  font-size: 0.7rem;
  font-weight: 760;
  white-space: nowrap;
}

.ag-state-select {
  width: 100%;
  margin-top: 6px;
}

.ag-row-actions {
  min-width: 310px;
}

.ag-row-actions .button.mini {
  min-height: 29px;
  padding: 4px 8px;
}

.ag-row-actions.is-icon-group {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 78px;
}

.ag-row-icon-btn,
.ag-row-action-menu > summary {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #223247;
  background: #26384d;
  color: #ffffff;
  cursor: pointer;
}

.ag-row-action-menu > summary {
  background: var(--brand);
  border-color: var(--brand);
  list-style: none;
}

.ag-row-icon-btn svg,
.ag-row-action-menu > summary svg {
  width: 17px;
  height: 17px;
}

.ag-row-action-menu.is-row-combined {
  position: relative;
}

.ag-row-action-menu.is-row-combined > .ag-row-action-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: 260px;
  min-width: 260px;
  max-height: min(520px, 72vh);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.22);
}

.ag-row-action-menu.is-row-combined > .ag-row-action-dropdown.is-short-list {
  gap: 2px;
  width: 190px;
  min-width: 190px;
  padding: 7px;
}

.ag-row-action-section {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--soft-line);
}

.ag-row-action-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ag-row-action-section > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.ag-row-action-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 31px;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid #dbe6ee;
  border-radius: 9px;
  background: #ffffff;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.ag-menu-file-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: #64748b;
}

.ag-menu-file-icon svg {
  width: 15px;
  height: 15px;
}

.ag-row-action-item:hover {
  border-color: #b8cad8;
  background: #f7fafc;
}

.ag-row-action-item:disabled {
  background: #f4f6f8;
  color: #8795a3;
  cursor: not-allowed;
}

.ag-table-checkbox {
  width: 18px;
  min-height: 18px;
}

.ag-invoice-table {
  min-width: 1480px;
}

.ag-list-footnote {
  padding: 11px 14px;
  border-top: 1px solid var(--soft-line);
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .ag-list-search,
  .ag-list-toolbar,
  .ag-list-titlebar {
    align-items: stretch;
    flex-direction: column;
  }

  .ag-list-search input,
  .ag-list-toolbar input[type="search"] {
    width: 100%;
  }

  .ag-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ag-filter-grid {
    grid-template-columns: 1fr;
  }
}

.ag-payment-method-editor {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin: 12px 0 16px;
  border: 1px solid #d7e1e9;
  border-radius: 8px;
  background: #f7fafc;
  padding: 14px;
}

.ag-payment-method-editor .actions {
  flex-wrap: nowrap;
  margin: 0;
}

.ag-payment-method-select {
  width: 96px;
  text-align: center;
}

.ag-payment-method-select input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.ag-payment-edit {
  width: 34px;
  height: 34px;
  font-size: 1rem;
}

@media (max-width: 900px) {
  .ag-payment-method-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Pasada de depuracion: navegacion siempre legible y acciones con sentido */
.layout {
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar,
.sidebar:hover,
.sidebar:focus-within {
  width: 264px;
  padding: 0;
  overflow-x: hidden;
  background: #f7f9fc;
  border-right: 1px solid #d8dde4;
}

.brand-block {
  width: 264px;
  height: auto;
  min-height: 66px;
  padding: 10px 12px;
  margin: 0;
  display: flex;
  justify-content: flex-start;
}

.brand-logo {
  margin: 0;
}

.brand-copy,
.nav-group-title,
.nav-button span:not(.nav-icon) {
  display: block;
  opacity: 1;
  transform: none;
}

.nav {
  width: 264px;
  display: grid;
  gap: 4px;
  padding: 8px 8px 18px;
}

.nav-group {
  margin: 7px 0;
}

.nav-group-title {
  height: auto;
  padding: 4px 9px;
  color: #6d7c8a;
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

.nav-submenu {
  display: grid;
  gap: 3px;
}

.nav-button,
.sidebar:hover .nav-button,
.sidebar:focus-within .nav-button {
  width: 100%;
  height: 42px;
  min-height: 42px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  place-items: initial;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #344255;
  text-align: left;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: #d7e3ec;
  background: #edf4f8;
  color: var(--ink);
}

.nav-button:hover .nav-icon,
.nav-button.is-active .nav-icon {
  color: var(--brand);
  background: #dce7ef;
}

.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #eef3f7;
  color: var(--brand);
  font-size: 0.72rem;
}

.main {
  padding-left: 18px;
}

.actua-top-strip {
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 64px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.actua-top-strip button,
.actua-user-chip {
  min-height: 38px;
  border-radius: 10px;
  padding: 0 10px;
}

.actua-top-strip button span {
  display: inline;
}

.ag-row-actions {
  min-width: 430px;
  align-items: flex-start;
}

.ag-action-menu.is-compact summary {
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand);
  padding: 5px 9px;
  font-size: 0.78rem;
}

.ag-action-menu.is-compact.is-primary summary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.ag-action-menu div {
  min-width: 250px;
}

.ag-action-menu button[disabled] {
  background: #f4f6f8;
  color: #8795a3;
}

.ag-bulk-logic {
  align-items: center;
  background: #f8fbfd;
}

.ag-bulk-help {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.ag-bulk-logic [data-requires-selection]:disabled {
  opacity: 0.42;
}

.is-work-table {
  min-width: 1680px;
}

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

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .brand-block,
  .nav {
    width: 100%;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Sidebar desplegable con iconos reales */
.layout {
  grid-template-columns: 74px minmax(0, 1fr);
}

.sidebar {
  z-index: 90;
  width: 74px;
  transition: width 0.18s ease, box-shadow 0.18s ease;
}

.sidebar:hover,
.sidebar:focus-within,
.sidebar.is-auto-expanded {
  width: 264px;
  box-shadow: 12px 0 34px rgba(15, 23, 42, 0.12);
}

.brand-block {
  width: 264px;
}

.brand-copy,
.nav-group-title,
.nav-button span:not(.nav-icon) {
  display: block;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.sidebar:hover .brand-copy,
.sidebar:focus-within .brand-copy,
.sidebar:hover .nav-group-title,
.sidebar:focus-within .nav-group-title,
.sidebar.is-auto-expanded .nav-group-title,
.sidebar:hover .nav-button span:not(.nav-icon),
.sidebar:focus-within .nav-button span:not(.nav-icon),
.sidebar.is-auto-expanded .brand-copy,
.sidebar.is-auto-expanded .nav-button span:not(.nav-icon) {
  opacity: 1;
  transform: translateX(0);
}

.nav {
  width: 264px;
}

.nav-button,
.sidebar:hover .nav-button,
.sidebar:focus-within .nav-button,
.sidebar.is-auto-expanded .nav-button {
  grid-template-columns: 42px minmax(0, 1fr);
  height: 44px;
  min-height: 44px;
  padding-left: 12px;
}

.nav-icon {
  width: 34px;
  height: 34px;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-button.is-active .nav-icon {
  color: #ffffff;
  background: var(--brand);
}

.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .nav-button {
  width: 58px;
  grid-template-columns: 42px 1fr;
}

.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-block {
  justify-content: center;
  padding-left: 8px;
}

.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-logo {
  margin-left: 0;
}

/* Identidad SURIDA: simbolo compacto y marca completa al desplegar el menu. */
.brand-block {
  min-height: 66px;
  padding: 10px 16px;
  overflow: hidden;
  background: #071426;
  border-bottom-color: #23344b;
}

.brand-visual {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 6px;
  background: #071426;
  transition: width 0.18s ease, height 0.18s ease;
}

.brand-logo {
  position: absolute;
  left: -105px;
  top: -49px;
  width: 254px;
  height: 190px;
  max-width: none;
  margin: 0;
  object-fit: fill;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  mix-blend-mode: normal;
  transition: width 0.18s ease, height 0.18s ease, left 0.18s ease, top 0.18s ease;
}

.sidebar:hover .brand-visual,
.sidebar:focus-within .brand-visual,
.sidebar.is-auto-expanded .brand-visual {
  width: 228px;
  height: 96px;
}

.sidebar:hover .brand-logo,
.sidebar:focus-within .brand-logo,
.sidebar.is-auto-expanded .brand-logo {
  left: 0;
  top: -35px;
  width: 228px;
  height: 171px;
}

.sidebar:hover .brand-block,
.sidebar:focus-within .brand-block,
.sidebar.is-auto-expanded .brand-block {
  min-height: 116px;
}

.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-block {
  padding-left: 16px;
}

.ag-contact-field {
  min-width: 0;
}

.ag-contact-input {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ag-contact-input > input {
  min-width: 0;
  flex: 1 1 auto;
}

.ag-contact-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.ag-contact-link {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.ag-contact-link:hover,
.ag-contact-link:focus-visible {
  filter: brightness(0.9);
  transform: translateY(-1px);
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

.ag-contact-link svg {
  width: 17px;
  height: 17px;
}

.ag-contact-link.is-phone {
  background: #365268;
}

.ag-contact-link.is-whatsapp {
  background: #15803d;
}

.ag-contact-link.is-email {
  background: #b45309;
}

.ag-client-direct-field {
  min-width: 0;
}

.ag-client-direct-input {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ag-client-direct-input > select,
.ag-client-direct-input > input {
  min-width: 0;
  flex: 1 1 auto;
}

.ag-client-direct-link {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid #c9d8e6;
  border-radius: 6px;
  background: #0c2744;
  color: #ffffff;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.ag-client-direct-link:hover,
.ag-client-direct-link:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

.ag-client-direct-link svg {
  width: 18px;
  height: 18px;
}

.ag-inline-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ag-dark-btn.is-danger {
  background: #b42318;
  border-color: #b42318;
}

.ag-dark-btn.is-danger:hover,
.ag-dark-btn.is-danger:focus-visible {
  background: #8f1d14;
  border-color: #8f1d14;
}

.ag-dark-btn.is-danger svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* Estructura de escritorio: un unico lienzo sin desplazamiento lateral.
   La navegacion permanece estable y solo se desplaza el contenido central. */
@media (min-width: 981px) {
  html,
  body,
  #app,
  .app-shell {
    height: 100%;
    min-height: 0;
  }

  body {
    overflow: hidden;
  }

  .layout {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .main {
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  .actua-top-strip {
    position: sticky;
    top: 0;
    z-index: 80;
    min-width: 0;
    max-width: none;
  }

  .actua-profile-menu,
  .actua-top-strip .actua-user-chip {
    min-width: 0;
    flex: 0 0 auto;
  }
}

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

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .brand-block,
  .nav {
    width: 100%;
  }

  .brand-copy,
  .nav-group-title,
  .nav-button span:not(.nav-icon) {
    opacity: 1;
    transform: none;
  }

  .sidebar:not(:hover):not(:focus-within) .nav-button {
    width: 100%;
  }

  .brand-block {
    min-height: 112px;
  }

  .brand-visual,
  .sidebar:not(:hover):not(:focus-within) .brand-visual {
    width: 228px;
    height: 96px;
  }

  .brand-logo,
  .sidebar:not(:hover):not(:focus-within) .brand-logo {
    left: 0;
    top: -35px;
    width: 228px;
    height: 171px;
  }
}

.ag-status-overview {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.ag-status-donut {
  position: relative;
  width: min(150px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--status-chart);
  box-shadow: inset 0 0 0 1px rgba(16, 35, 52, 0.08);
}

.ag-status-donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--line);
}

.ag-status-donut > div {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--ink);
}

.ag-status-donut strong {
  font-size: 1.5rem;
  line-height: 1;
}

.ag-status-donut span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.ag-status-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ag-status-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ag-status-legend-row:hover {
  border-color: #b7c9d8;
  background: #f7fafc;
}

.ag-status-legend-row span:not(.ag-status-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.ag-status-legend-row strong {
  font-weight: 900;
}

.ag-status-legend-row small {
  color: var(--muted);
  font-weight: 800;
}

.ag-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-color);
  box-shadow: 0 0 0 3px rgba(16, 35, 52, 0.04);
}

@media (max-width: 780px) {
  .ag-status-overview {
    grid-template-columns: 1fr;
  }

  .ag-status-legend {
    grid-template-columns: 1fr;
  }
}

.is-work-table .ag-row-actions.is-icon-group,
.ag-row-actions.is-icon-group {
  min-width: 78px !important;
  width: 78px;
  justify-content: flex-start;
  align-items: center;
}

.ag-row-action-menu.is-row-combined > .ag-row-action-dropdown {
  text-align: left;
}

details.ag-action-menu:not([open]) > div,
details.ag-action-group:not([open]) > div {
  display: none !important;
}

.ag-list-table.is-actuagest-columns {
  min-width: 1680px;
}

.is-actuagest-columns th,
.is-actuagest-columns td {
  border-right: 1px solid var(--soft-line);
}

.is-actuagest-columns th:last-child,
.is-actuagest-columns td:last-child {
  border-right: 0;
}

.is-actuagest-columns .ag-id-cell {
  min-width: 160px;
  width: 160px;
}

.is-actuagest-columns .ag-urgent-cell,
.is-actuagest-columns .ag-paid-cell {
  text-align: center;
}

.is-actuagest-columns .ag-urgent-cell {
  width: 82px;
}

.ag-client-type-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
}

.ag-paid-ok,
.ag-paid-no {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.ag-paid-ok {
  color: var(--success);
}

.ag-paid-no {
  color: var(--danger);
}

.actua-top-strip {
  align-items: center;
  flex-wrap: nowrap;
  overflow: visible;
}

.actua-top-strip button.actua-strip-icon,
.actua-top-strip .actua-user-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 38px;
  padding: 0 8px;
  overflow: visible;
}

.actua-top-strip .actua-strip-symbol {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: currentColor;
}

.actua-top-strip .actua-strip-symbol svg {
  display: block;
  width: 18px;
  height: 18px;
}

.actua-top-strip button.actua-strip-icon strong {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.actua-top-strip button.actua-strip-icon.is-primary strong {
  min-width: 22px;
  font-size: 0.88rem;
}

.actua-top-strip .actua-strip-label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 80;
  display: inline-flex;
  width: max-content;
  max-width: 220px;
  transform: translate(-50%, -4px);
  border-radius: 8px;
  background: #172a3c;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 31, 45, 0.22);
  padding: 6px 9px;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.actua-top-strip .actua-strip-label::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: #172a3c;
}

.actua-top-strip button.actua-strip-icon:hover .actua-strip-label,
.actua-top-strip button.actua-strip-icon:focus-visible .actua-strip-label,
.actua-top-strip .actua-user-chip:hover .actua-strip-label,
.actua-top-strip .actua-user-chip:focus-within .actua-strip-label {
  transform: translate(-50%, 0);
  opacity: 1;
}

.ag-client-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.ag-client-picker label {
  min-width: 0;
}

.ag-add-client-button {
  min-height: 40px;
  white-space: nowrap;
}

.ag-new-expediente-client {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ag-client-choice-title {
  color: #172a3c;
  font-size: 0.8rem;
  font-weight: 700;
}

.ag-client-choice-options {
  display: flex;
  align-items: center;
  gap: 24px;
}

.ag-client-choice-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #203d56;
  font-weight: 700;
}

.ag-client-choice-options input {
  accent-color: #e45442;
}

.ag-client-search label {
  display: grid;
  gap: 5px;
  color: #172a3c;
  font-size: 0.8rem;
  font-weight: 700;
}

.ag-client-search .ag-search-input {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  min-width: 0;
}

.ag-client-search .ag-search-input > span {
  display: grid;
  width: 34px;
  height: 40px;
  place-items: center;
  border: 1px solid #d7e1e9;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #edf3f7;
  color: #31536d;
  font-size: 1.05rem;
}

.ag-client-search .ag-search-input input {
  min-width: 0;
  border-radius: 0;
}

.ag-clear-search {
  width: 34px;
  height: 40px;
  border: 1px solid #d7e1e9;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #fff;
  color: #607889;
  font-size: 1.1rem;
  line-height: 1;
}

.ag-clear-search:hover,
.ag-clear-search:focus-visible {
  background: #fff2f0;
  color: #b43d30;
}

.ag-client-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.ag-client-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid #dce6ed;
  border-radius: 8px;
  background: #fff;
}

.ag-client-detail-head h1 {
  margin: 2px 0 3px;
  color: #172a3c;
  font-size: 1.35rem;
}

.ag-client-detail-head p {
  margin: 0;
  color: #6b8192;
}

.ag-client-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #d7e1e9;
}

.ag-client-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #4a6479;
  font-weight: 700;
}

.ag-client-tabs button.is-active {
  border-bottom-color: #e45442;
  color: #172a3c;
}

.ag-client-tabs span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #eaf3f8;
  color: #31536d;
  font-size: 0.75rem;
}

.ag-client-detail-body {
  overflow: hidden;
  border: 1px solid #dce6ed;
  border-radius: 8px;
  background: #fff;
}

.ag-client-profile {
  padding: 0 18px 18px;
}

.ag-client-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
}

.ag-client-linked {
  padding: 18px;
}

@media (max-width: 700px) {
  .ag-client-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ag-client-profile-actions {
    justify-content: stretch;
  }

  .ag-client-profile-actions .button {
    flex: 1;
  }
}

.ag-client-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  border: 1px solid #d7e1e9;
  border-radius: 8px;
  background: #ffffff;
  color: #172a3c;
  box-shadow: 0 24px 70px rgba(15, 31, 45, 0.28);
  padding: 0;
}

.ag-client-dialog::backdrop {
  background: rgba(15, 31, 45, 0.46);
}

.ag-client-dialog form {
  padding: 20px;
}

.ag-client-dialog-head,
.ag-client-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ag-client-dialog-head {
  margin-bottom: 18px;
}

.ag-client-dialog-head h2 {
  margin: 3px 0 0;
}

.ag-client-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ag-client-dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e3eaf0;
}

.ag-icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d7e1e9;
  border-radius: 6px;
  background: #f5f8fa;
  color: #172a3c;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 720px) {
  .ag-client-picker,
  .ag-client-dialog-grid {
    grid-template-columns: 1fr;
  }

  .ag-client-choice-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

/* Paleta y marca finales: mantener al final para prevalecer sobre estilos heredados. */

.ag-hacienda-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
}

.ag-hacienda-picker select,
.ag-hacienda-picker input:not([type="hidden"]) {
  min-width: 0;
}

.ag-hacienda-brand-picker {
  position: relative;
  display: block;
}

.ag-hacienda-brand-picker input {
  width: 100%;
}

.ag-hacienda-brand-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #cbd9e7;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(18, 47, 78, 0.16);
}

.ag-hacienda-brand-suggestions[hidden] {
  display: none;
}

.ag-hacienda-brand-option {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #17324f;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ag-hacienda-brand-option:hover,
.ag-hacienda-brand-option:focus-visible {
  outline: none;
  background: #eaf3fb;
}

.ag-clear-vehicle {
  width: 34px;
  height: 34px;
  border: 1px solid #f2c8c2;
  border-radius: 8px;
  background: #fff7f5;
  color: #b3392e;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.ag-clear-vehicle:hover {
  background: #fee9e5;
}

.ag-field-help {
  display: block;
  margin-top: 5px;
  color: #718096;
  font-size: 12px;
  font-weight: 400;
}

/* Formularios de trámite: cabeceras y secciones más compactas. */
.ag-accordion-list {
  gap: 6px;
}

.ag-accordion summary {
  min-height: 42px;
  padding: 0 14px;
  font-size: 1rem;
}

.ag-accordion-body {
  padding: 12px 14px 14px;
}

.ag-accordion-body .ag-form-row {
  gap: 14px 20px;
  row-gap: 16px;
}

.ag-accordion-body .ag-inline-actions {
  gap: 12px;
  margin-top: 16px;
}

.ag-fiscal-panel {
  display: grid;
  gap: 18px;
}

.ag-fiscal-tabs {
  margin: -2px -2px 0;
}

.ag-fiscal-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ag-fiscal-toolbar h2,
.ag-fiscal-toolbar h3 {
  margin: 0;
}

.ag-fiscal-toolbar p {
  margin: 5px 0 0;
  color: #718096;
}

.ag-fiscal-import {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ag-fiscal-editor {
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid #dbe5ef;
}

.ag-fiscal-editor h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

@media (max-width: 760px) {
  .ag-fiscal-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .ag-fiscal-import {
    justify-content: flex-start;
  }
}
.ag-list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) minmax(0, 1fr);
  align-items: center;
}

.ag-list-centered-search {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.ag-list-centered-search label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: 0;
  white-space: nowrap;
}

.ag-list-centered-search input[type="search"] {
  width: 100%;
  min-width: 0;
}

.ag-list-pagination-slot {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

@media (max-width: 980px) {
  .ag-list-toolbar {
    grid-template-columns: 1fr;
  }

  .ag-list-centered-search,
  .ag-list-pagination-slot {
    grid-column: 1;
    justify-content: flex-start;
    width: 100%;
  }
}
:root {
  --bg: #edf2f6;
  --surface: #ffffff;
  --surface-2: #f5f8fb;
  --ink: #14273a;
  --muted: #687b8e;
  --line: #d4dfe8;
  --soft-line: #e7edf2;
  --brand: #0c2744;
  --brand-2: #173d60;
  --accent: #dce4ed;
  --shadow: 0 7px 18px rgba(12, 39, 68, 0.07);
  --shadow-md: 0 16px 38px rgba(12, 39, 68, 0.1);
}

body,
.layout,
.main {
  background: var(--bg);
}

.actua-top-strip {
  justify-content: flex-end;
  min-height: 52px;
  height: 52px;
  margin-bottom: 12px;
  padding-top: 0;
  padding-bottom: 0;
  background: #0c2744;
  box-shadow: 0 5px 16px rgba(6, 24, 43, 0.16);
}

.actua-top-strip button.actua-strip-icon,
.actua-top-strip .actua-user-chip {
  min-height: 38px;
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
}

/* Vista telefono: menu compacto y contenido usable desde el primer pantallazo. */
@media (max-width: 760px) {
  html,
  body,
  #app,
  .app-shell {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    background: var(--bg);
  }

  .layout {
    display: block;
    width: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.is-auto-expanded,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) {
    position: sticky;
    top: 0;
    z-index: 120;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid #223d58;
    background: #0c2744;
    box-shadow: 0 8px 20px rgba(5, 20, 36, 0.18);
  }

  .sidebar .brand-block,
  .sidebar:hover .brand-block,
  .sidebar:focus-within .brand-block,
  .sidebar.is-auto-expanded .brand-block,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-block {
    display: flex;
    width: 100%;
    height: 48px;
    min-height: 48px;
    justify-content: flex-start;
    align-items: center;
    margin: 0;
    padding: 5px 10px;
    border-bottom: 1px solid #233f5a;
    background: #0c2744;
  }

  .sidebar .brand-block::after,
  .sidebar:hover .brand-block::after,
  .sidebar:focus-within .brand-block::after,
  .sidebar.is-auto-expanded .brand-block::after {
    opacity: 1;
    transform: none;
    margin-left: 10px;
    font-size: 0.86rem;
    letter-spacing: 0.16em;
  }

  .sidebar .brand-visual,
  .sidebar:hover .brand-visual,
  .sidebar:focus-within .brand-visual,
  .sidebar.is-auto-expanded .brand-visual,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-visual {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 9px;
    background-size: 90%;
  }

  .sidebar .brand-logo,
  .sidebar:hover .brand-logo,
  .sidebar:focus-within .brand-logo,
  .sidebar.is-auto-expanded .brand-logo,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-logo {
    display: none;
  }

  .sidebar .brand-copy,
  .sidebar .nav-group-title {
    display: none;
  }

  .sidebar .nav,
  .sidebar:hover .nav,
  .sidebar:focus-within .nav,
  .sidebar.is-auto-expanded .nav {
    display: flex;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 8px 8px;
    background: #0c2744;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav-group,
  .sidebar .nav-submenu {
    display: contents;
    margin: 0;
  }

  .sidebar .nav-button,
  .sidebar:hover .nav-button,
  .sidebar:focus-within .nav-button,
  .sidebar.is-auto-expanded .nav-button,
  .sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .nav-button {
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
    height: 58px;
    min-height: 58px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 28px 1fr;
    place-items: center;
    gap: 2px;
    padding: 5px 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #eef5fb;
    text-align: center;
  }

  .sidebar .nav-button:hover,
  .sidebar .nav-button.is-active {
    border-color: rgba(255, 255, 255, 0.28);
    background: #ffffff;
    color: #0c2744;
  }

  .sidebar .nav-icon,
  .sidebar:hover .nav-icon,
  .sidebar:focus-within .nav-icon,
  .sidebar.is-auto-expanded .nav-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-size: 0.68rem;
  }

  .sidebar .nav-button span:not(.nav-icon),
  .sidebar:hover .nav-button span:not(.nav-icon),
  .sidebar:focus-within .nav-button span:not(.nav-icon),
  .sidebar.is-auto-expanded .nav-button span:not(.nav-icon) {
    display: block;
    width: 100%;
    color: inherit;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.05;
    opacity: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: none;
    white-space: nowrap;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 10px 10px 30px;
    overflow-x: hidden;
  }

  .actua-top-strip {
    display: flex;
    width: calc(100% + 20px);
    min-height: 44px;
    height: auto;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    margin: -10px -10px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 8px;
    border-radius: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .actua-top-strip::-webkit-scrollbar {
    display: none;
  }

  .actua-top-strip button.actua-strip-icon,
  .actua-top-strip .actua-user-chip {
    flex: 0 0 auto;
    min-width: 38px;
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
    padding: 0 8px;
  }

  .actua-top-strip .actua-strip-symbol,
  .actua-top-strip .actua-strip-symbol svg {
    width: 16px;
    height: 16px;
  }

  .actua-top-strip button.actua-strip-icon strong {
    min-width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 0.72rem;
  }

  .actua-top-strip .actua-profile-menu {
    flex: 0 0 auto;
  }

  .actua-top-strip .actua-profile-name {
    max-width: 74px;
    font-size: 0.75rem;
  }

  .actua-top-strip .actua-strip-label {
    display: none;
  }

  .topbar,
  .detail-header,
  .ag-client-detail-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 12px;
  }

  .topbar p,
  .detail-header p {
    max-width: none;
  }

  h1,
  .topbar h1,
  .detail-header h1 {
    font-size: 1.34rem;
    line-height: 1.18;
  }

  h2 {
    font-size: 1.02rem;
  }

  .eyebrow {
    font-size: 0.68rem;
  }

  .actions,
  .row-actions,
  .ag-row-actions,
  .actua-bulk-actions {
    justify-content: flex-start;
    gap: 7px;
  }

  .ag-list-heading-tools,
  .ag-list-titlebar .actions,
  .ag-bulk-strip,
  .ag-bulk-strip.ag-bulk-compact {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow: hidden;
  }

  .ag-list-heading-tools > *,
  .ag-list-titlebar .actions > *,
  .ag-bulk-strip > * {
    flex: 0 1 auto;
  }

  .topbar > .actions,
  .detail-header > .actions,
  .ag-client-detail-head > .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .topbar > .actions:empty,
  .detail-header > .actions:empty {
    display: none;
  }

  .topbar > .actions .button,
  .detail-header > .actions .button,
  .ag-client-detail-head > .actions .button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .button,
  .icon-button,
  .ag-dark-btn {
    min-width: 0;
  }

  .button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .button.mini {
    min-height: 32px;
    padding: 6px 8px;
  }

  .panel,
  .ag-list-panel,
  .ag-client-detail-body,
  .ag-table-block {
    border-radius: 10px;
    padding: 12px;
  }

  .grid,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .module-grid,
  .status-board,
  .field-grid,
  .split,
  .operation-bar,
  .quick-status,
  .ag-form-row,
  .ag-process-fields,
  .ag-client-dialog-grid,
  .ag-payment-method-editor {
    grid-template-columns: 1fr;
  }

  .field-grid .span-2,
  .field-grid .span-3,
  .field-grid .span-4,
  .ag-process-fields .span-4 {
    grid-column: auto;
  }

  .stat,
  .module-card,
  .status-card,
  .operation-metric {
    min-height: auto;
  }

  .stat-value {
    margin-top: 6px;
    font-size: 1.45rem;
  }

  .module-card,
  .status-card {
    padding: 12px;
  }

  label {
    min-width: 0;
  }

  input,
  select,
  textarea {
    min-width: 0;
    min-height: 40px;
    font-size: 16px;
  }

  .inline-form,
  .ag-inline-actions,
  .ag-fiscal-toolbar,
  .ag-client-profile-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inline-form > label {
    min-width: 0;
  }

  .tabs,
  .ag-tabs,
  .ag-client-tabs,
  .ag-budget-tabs,
  .ag-budget-subtabs,
  .ag-fiscal-tabs,
  .ag-catalog-tabs,
  .ag-quick-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    gap: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar,
  .ag-tabs::-webkit-scrollbar,
  .ag-client-tabs::-webkit-scrollbar,
  .ag-budget-tabs::-webkit-scrollbar,
  .ag-budget-subtabs::-webkit-scrollbar,
  .ag-fiscal-tabs::-webkit-scrollbar,
  .ag-catalog-tabs::-webkit-scrollbar,
  .ag-quick-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button,
  .ag-client-tabs button,
  .ag-catalog-tabs .tab-button {
    flex: 0 0 auto;
    min-height: 38px;
    white-space: nowrap;
  }

  .record-title,
  .meta-line,
  .section-title,
  .ag-list-titlebar,
  .history-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .ag-detail-page {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0 0 24px;
  }

  .ag-record-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 0 10px;
    padding: 10px;
  }

  .ag-record-name {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    line-height: 1.22;
  }

  .ag-record-name strong {
    overflow-wrap: anywhere;
  }

  .ag-red-mark {
    font-size: 1.35rem;
  }

  .ag-warn-dot {
    flex: 0 0 22px;
  }

  .ag-status-stepper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    padding: 6px;
    border-radius: 10px;
  }

  .ag-status-step {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 0.68rem;
    line-height: 1.05;
  }

  .ag-tabs {
    flex-direction: row;
    align-items: stretch;
    min-height: 44px;
    padding: 5px;
    border-bottom: 1px solid var(--line);
  }

  .ag-tab,
  .ag-tab-back {
    flex: 0 0 auto;
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    padding: 0 12px;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .ag-tab-back {
    margin-left: 0;
  }

  .ag-record-card {
    border-radius: 10px;
  }

  .operation-bar .row-actions,
  .ag-row-actions {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .operation-bar .row-actions::-webkit-scrollbar,
  .ag-row-actions::-webkit-scrollbar {
    display: none;
  }

  .operation-bar .row-actions .button,
  .ag-row-actions .button {
    flex: 0 0 auto;
  }

  .table-wrap {
    max-width: 100%;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 640px;
  }

  .table-wrap.is-dense table,
  .ag-table,
  .ag-process-cost-table,
  .ag-list-table,
  .ag-invoice-table,
  .is-work-table {
    min-width: 720px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .ag-accordion summary {
    min-height: 40px;
    padding: 0 10px;
  }

  .ag-accordion-body {
    padding: 10px;
  }

  .sepria-budget-shell {
    height: calc(100dvh - 150px);
    min-height: 560px;
    margin: -2px -10px -30px;
  }

  .sepria-budget-iframe {
    min-height: 560px;
  }
}

.brand-block,
.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-block {
  min-height: 52px;
  height: 52px;
  padding: 7px 16px;
  justify-content: flex-start;
  background: #0c2744;
  border-bottom-color: #29445f;
}

.brand-visual,
.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-visual {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background-color: #ffffff;
  background-image: url("./assets/surida-symbol.png?v=20260713-1");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 92%;
}

.brand-logo,
.sidebar:not(:hover):not(:focus-within):not(.is-auto-expanded) .brand-logo {
  display: none;
}

.brand-block::after {
  content: "SURIDA";
  align-self: center;
  margin-left: 14px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0.18em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.sidebar:hover .brand-visual,
.sidebar:focus-within .brand-visual,
.sidebar.is-auto-expanded .brand-visual {
  width: 62px;
  height: 62px;
}

.sidebar:hover .brand-logo,
.sidebar:focus-within .brand-logo,
.sidebar.is-auto-expanded .brand-logo {
  display: none;
}

.sidebar:hover .brand-block,
.sidebar:focus-within .brand-block,
.sidebar.is-auto-expanded .brand-block {
  min-height: 82px;
}

.sidebar:hover .brand-block::after,
.sidebar:focus-within .brand-block::after,
.sidebar.is-auto-expanded .brand-block::after {
  opacity: 1;
  transform: translateX(0);
}

.nav-button:hover,
.nav-button.is-active {
  border-color: #cbd9e5;
  background: #e7eef4;
  color: #0c2744;
}

.nav-button:hover .nav-icon,
.nav-button.is-active .nav-icon {
  background: #d6e1eb;
  color: #0c2744;
}

.button.primary,
.ag-dark-btn {
  border-color: #0c2744;
  background: #0c2744;
}
