:root { --app-footer-height: 38px; }
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh; margin: 0; color: var(--app-fg); background: var(--app-bg);
  font-family: var(--app-font-sans); font-size: 14px;
}
button, input, select, textarea { font: inherit; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font-size: var(--app-control-font-size); font-weight: 500; line-height: 1.3;
}
input::placeholder, textarea::placeholder { color: var(--app-fg-soft); font-weight: 500; }
a { color: inherit; }
.muted { color: var(--app-fg-muted); }
.mono { font-family: var(--app-font-mono); font-size: .92em; }
.strong { font-weight: 700; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-icon {
  width: 17px; height: 17px; display: inline-block; flex: 0 0 auto;
  color: currentColor; stroke: currentColor; stroke-width: 1.9;
}
.eyebrow { margin: 0 0 5px; color: var(--app-accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 16px; }
.app-shell {
  min-height: 100vh; display: grid; grid-template-columns: var(--app-sidebar-width) 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
}
.sidebar {
  position: sticky; top: 0; height: calc(100vh - var(--app-footer-height)); display: flex; flex-direction: column; padding: 22px 16px;
  border-right: 1px solid var(--app-sidebar-border); color: var(--app-sidebar-fg);
  background: var(--app-sidebar-bg); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 5px 8px 25px; text-decoration: none; }
.brand span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 16px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--app-sidebar-muted); font-size: 11px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px;
  color: #21150c; background: #d19a62; font-weight: 800; letter-spacing: -.05em;
}
.brand-mark-large { width: 48px; height: 48px; font-size: 18px; }
.main-nav { display: grid; gap: 6px; }
.nav-group { display: grid; gap: 4px; }
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-link-group::after { content: "›"; justify-self: end; font-size: 16px; transform: rotate(0deg); transition: transform .15s ease; }
.nav-group[open] > .nav-link-group::after { transform: rotate(90deg); }
.nav-link {
  min-height: 43px; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px;
  padding: 0 12px; border-radius: var(--app-radius); color: var(--app-sidebar-muted); text-decoration: none; font-weight: 600;
}
.nav-link:hover, .nav-link.active { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.nav-link[aria-disabled="true"] { cursor: default; opacity: .58; }
.nav-link .app-icon { justify-self: center; }
.nav-link small { font-size: 9px; font-weight: 600; }
.nav-submenu { display: grid; gap: 2px; margin: 2px 0 6px 20px; padding-left: 12px; border-left: 1px solid var(--app-sidebar-border); }
.nav-subitem {
  min-height: 34px; display: flex; align-items: center; padding: 0 10px;
  border-radius: var(--app-radius-sm); color: var(--app-sidebar-muted); text-decoration: none;
  font-size: 13px; font-weight: 650;
}
.nav-subitem:hover, .nav-subitem.active { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; padding: 12px 8px 0; border-top: 1px solid var(--app-sidebar-border); }
.tenant-chip { display: flex; flex-direction: column; }
.tenant-chip span { color: var(--app-sidebar-muted); font-size: 11px; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.theme-switch button {
  height: 32px; border: 1px solid var(--app-sidebar-border); border-radius: 6px;
  color: var(--app-sidebar-fg); background: transparent; cursor: pointer;
}
.theme-switch button.active { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.sidebar-profile { position: relative; }
.sidebar-profile > summary { list-style: none; }
.sidebar-profile > summary::-webkit-details-marker { display: none; }
.profile-button {
  width: 100%; min-height: 54px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; gap: 10px;
  align-items: center; padding: 8px; border-radius: var(--app-radius); color: var(--app-sidebar-fg);
  cursor: pointer; background: transparent;
}
.profile-button:hover, .sidebar-profile[open] .profile-button { background: var(--app-sidebar-active); }
.avatar {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  color: var(--app-accent-foreground); background: var(--app-accent); font-size: 12px; font-weight: 800;
}
.profile-copy { min-width: 0; display: grid; gap: 2px; }
.profile-copy strong, .profile-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 13px; }
.profile-copy small { color: var(--app-sidebar-muted); font-size: 11px; }
.profile-chevron { color: var(--app-sidebar-muted); text-align: center; transition: transform .15s ease; }
.sidebar-profile[open] .profile-chevron { transform: rotate(180deg); }
.user-dropdown {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 10px); display: grid; gap: 4px;
  padding: 10px; border: 1px solid var(--app-sidebar-border); border-radius: var(--app-radius);
  color: var(--app-sidebar-fg); background: var(--app-sidebar-bg); box-shadow: var(--app-shadow-md); z-index: 20;
}
.user-dropdown__identity { display: grid; gap: 2px; padding: 4px 6px 9px; border-bottom: 1px solid var(--app-sidebar-border); }
.user-dropdown__identity strong { font-size: 13px; }
.user-dropdown__identity span, .user-dropdown__identity small { color: var(--app-sidebar-muted); font-size: 11px; }
.user-dropdown__item {
  width: 100%; min-height: 36px; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center;
  gap: 8px; padding: 0 8px; border: 0; border-radius: var(--app-radius-sm); color: var(--app-sidebar-muted);
  background: transparent; text-align: left; text-decoration: none; font-weight: 700; cursor: pointer;
}
.user-dropdown__item .app-icon { justify-self: center; }
.user-dropdown__item:hover { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.user-dropdown__item:disabled { cursor: not-allowed; opacity: .52; }
.user-dropdown__item-danger:hover { color: #fff; background: var(--app-danger); }
.user-dropdown__theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px 0; }
.user-dropdown__theme button {
  height: 32px; border: 1px solid var(--app-sidebar-border); border-radius: var(--app-radius-sm);
  color: var(--app-sidebar-muted); background: transparent; cursor: pointer;
}
.user-dropdown__theme button:hover,
.user-dropdown__theme button.active { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.user-dropdown__theme svg {
  width: 16px; height: 16px; display: block; margin: auto; fill: none; stroke: currentColor;
  stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8;
}
.app-main { min-width: 0; min-height: calc(100vh - var(--app-footer-height)); display: flex; flex-direction: column; }
.topbar {
  height: var(--app-topbar-height); position: sticky; top: 0; z-index: 8; display: flex; align-items: center;
  justify-content: flex-end; gap: 18px; padding: 0 30px; border-bottom: 1px solid var(--app-border);
  background: var(--app-topbar-bg); backdrop-filter: blur(16px);
}
.topbar-context { display: flex; align-items: center; gap: 12px; text-align: right; }
.topbar-company { color: var(--app-fg-muted); font-size: 11px; font-weight: 750; }
.organization-switch-button {
  min-height: 42px; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 9px;
  padding: 5px 11px 5px 7px; border: 1px solid rgba(var(--app-accent-rgb), .34);
  border-radius: var(--app-radius); color: var(--app-fg); background: rgba(var(--app-accent-rgb), .08);
  text-align: left; cursor: pointer; box-shadow: var(--app-shadow-sm);
}
.organization-switch-button:hover {
  border-color: rgba(var(--app-accent-rgb), .55); background: rgba(var(--app-accent-rgb), .13);
}
.organization-switch-button__icon {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px;
  color: var(--app-accent); background: rgba(var(--app-accent-rgb), .14); font-size: 14px; font-weight: 800;
}
.organization-switch-button__copy { min-width: 0; display: grid; gap: 1px; }
.organization-switch-button__copy strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--app-fg);
  font-size: 14px; font-weight: 850; letter-spacing: -.015em;
}
.organization-switch-button__copy small { color: var(--app-fg-muted); font-size: 10px; font-weight: 800; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.page-content { width: 100%; max-width: 1640px; flex: 1 0 auto; margin: 0 auto; padding: 28px 30px 50px; }
.app-footer {
  grid-column: 1 / -1; min-height: var(--app-footer-height); width: 100%; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 9px 30px; border-top: 1px solid var(--app-border);
  color: color-mix(in srgb, var(--app-fg-muted) 86%, transparent); background: color-mix(in srgb, var(--app-bg) 94%, transparent);
  font-size: 10.5px; font-weight: 600; letter-spacing: .018em; line-height: 1.35;
}
.app-footer span:last-child { text-align: right; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-header p:last-child { margin-bottom: 0; }
.counter { padding: 7px 11px; border: 1px solid var(--app-border); border-radius: 999px; color: var(--app-fg-muted); background: var(--app-surface); }
.header-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.button {
  min-height: var(--app-control-height); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 14px; border: 1px solid transparent; border-radius: var(--app-radius-sm); text-decoration: none;
  font-weight: 700; cursor: pointer; transition: transform .15s, opacity .15s, background .15s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled, .button.is-loading { cursor: wait; opacity: .72; transform: none; }
.button-primary { color: var(--app-accent-foreground); background: var(--app-accent); }
.button-secondary { color: var(--app-fg); border-color: var(--app-border); background: var(--app-surface); }
.button-success { color: #fff; background: var(--app-success); }
.button-danger { color: #fff; background: var(--app-danger); }
.button-block { width: 100%; }
.button-spinner {
  width: 15px; height: 15px; display: none; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .65s linear infinite;
}
.is-loading .button-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.filter-card, .table-card, .content-card, .status-strip {
  border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow-sm);
}
.filter-card { margin-bottom: 16px; padding: 14px 16px; }
.filters {
  display: flex; align-items: end; flex-wrap: wrap; gap: 12px;
}
.filters label {
  flex: 0 1 170px;
}
.filters .filter-grow {
  flex: 0 1 360px; max-width: 420px;
}
.filters label, .form-stack label, .swal-form label { display: grid; gap: 6px; color: var(--app-fg-muted); font-size: 11px; font-weight: 700; }
.filters input, .filters select, .form-stack input, .swal-form input, .swal-form select, .swal-form textarea {
  width: 100%; min-height: var(--app-control-height); padding: 8px 10px; border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm); color: var(--app-fg); background: var(--app-surface); outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--app-accent); box-shadow: 0 0 0 3px var(--app-focus-ring); }
.filter-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; padding-top: 0;
}
.filter-actions .button { white-space: nowrap; }
.client-filters { gap: 12px; }
.table-card { overflow: hidden; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--app-border); text-align: left; vertical-align: middle; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: var(--app-fg-muted); background: var(--app-surface-muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:hover { background: rgba(var(--app-accent-rgb), .045); }
tbody tr:last-child td { border-bottom: 0; }
.icon-link { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--app-accent); background: rgba(var(--app-accent-rgb), .1); text-decoration: none; font-size: 18px; cursor: pointer; }
.icon-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge-success { color: var(--app-success); background: rgba(var(--app-success-rgb), .12); }
.badge-warning { color: var(--app-warning); background: rgba(var(--app-warning-rgb), .13); }
.badge-danger { color: var(--app-danger); background: rgba(var(--app-danger-rgb), .12); }
.badge-neutral { color: var(--app-fg-muted); background: var(--app-surface-muted); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--app-border); color: var(--app-fg-muted); }
.pagination div { display: flex; gap: 8px; }
.empty-table, .empty-state { min-height: 260px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 30px; text-align: center; color: var(--app-fg-muted); }
.empty-icon { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 50%; color: var(--app-danger); background: rgba(var(--app-danger-rgb), .1); font-size: 24px; font-weight: 800; }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--app-accent); text-decoration: none; font-weight: 700; }
.status-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; padding: 15px 18px; }
.status-strip div { display: grid; gap: 4px; padding: 0 16px; border-right: 1px solid var(--app-border); }
.status-strip div:last-child { border-right: 0; }
.status-strip span, dt { color: var(--app-fg-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 16px; }
.content-card { margin-bottom: 16px; overflow: hidden; }
.content-card > header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-bottom: 1px solid var(--app-border); }
.content-card > header span { color: var(--app-fg-muted); font-size: 11px; }
.definition-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 18px; gap: 16px; }
.definition-grid div, .totals div { display: grid; gap: 5px; }
dd { margin: 0; font-weight: 700; }
.totals { display: grid; gap: 8px; margin: 0; padding: 18px; }
.totals div { grid-template-columns: 1fr auto; align-items: center; }
.totals .total { margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--app-border); font-size: 17px; }
.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px; }
.notes-grid div { min-height: 85px; padding: 14px; border-radius: var(--app-radius-sm); background: var(--app-surface-muted); }
.notes-grid p { margin: 7px 0 0; color: var(--app-fg-muted); white-space: pre-wrap; }
.auth-body { background: radial-gradient(circle at 20% 10%, rgba(var(--app-accent-rgb), .16), transparent 34%), var(--app-bg); }
.public-theme-control {
  position: fixed; top: 14px; right: 14px; z-index: 20; padding: 3px; border: 1px solid var(--app-border);
  border-radius: 999px; background: color-mix(in srgb, var(--app-surface) 88%, transparent); backdrop-filter: blur(10px);
}
.public-theme-switch { grid-template-columns: repeat(3, auto); gap: 2px; }
.public-theme-switch button {
  width: 27px; height: 27px; padding: 0; border: 1px solid transparent; border-radius: 50%; color: var(--app-fg-muted);
  background: transparent; font-size: 14px; line-height: 1; cursor: pointer;
}
.public-theme-switch button:hover { color: var(--app-fg); background: var(--app-surface-muted); }
.public-theme-switch button.active { color: var(--app-accent); background: rgba(var(--app-accent-rgb), .14); }
.public-theme-switch svg { width: 15px; height: 15px; display: block; margin: auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.login-screen { min-height: calc(100vh - var(--app-footer-height)); display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(430px, 100%); display: grid; gap: 28px; padding: 34px; border: 1px solid var(--app-border); border-radius: 12px; background: var(--app-surface); box-shadow: var(--app-shadow-md); }
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-brand > div { display: flex; flex-direction: column; }
.login-brand strong { font-size: 17px; }
.login-brand span:last-child { color: var(--app-fg-muted); font-size: 11px; }
.login-documentation-link { justify-self: center; color: var(--app-fg-muted); font-size: 11px; font-weight: 700; text-decoration-color: var(--app-border-strong); text-underline-offset: 3px; }
.login-documentation-link:hover { color: var(--app-accent); }
.form-stack { display: grid; gap: 16px; }
.validation-summary, .field-error { color: var(--app-danger); font-size: 11px; }
.validation-summary:empty, .field-error:empty { display: none; }
.swal2-popup { color: var(--app-fg) !important; background: var(--app-surface) !important; font-family: var(--app-font-sans) !important; }
.swal2-title { font-size: 20px !important; }
.swal-form { display: grid; gap: 14px; text-align: left; }
.swal-form-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.swal-full { grid-column: 1 / -1; }
.swal-form label.inline-check { display: flex; align-items: center; gap: 8px; }
.swal-form label.inline-check input { width: auto; min-height: auto; }
.swal-form textarea { resize: vertical; }
.assignment-list { max-height: 520px; overflow: auto; display: grid; gap: 10px; padding-right: 4px; text-align: left; }
.assignment-card { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); background: var(--app-surface-muted); }
.assignment-card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.assignment-card__title { display: grid; gap: 2px; }
.assignment-card__title strong { font-size: 13px; }
.assignment-card__title span { color: var(--app-fg-muted); font-family: var(--app-font-mono); font-size: 11px; }
.role-pills { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.role-pills label {
  display: inline-flex !important; align-items: center; gap: 6px; padding: 6px 8px;
  border: 1px solid var(--app-border); border-radius: 999px; color: var(--app-fg);
  background: var(--app-surface); font-size: 11px !important; font-weight: 700;
}
.role-pills input { width: auto !important; min-height: auto !important; }
.organization-options { display: flex; flex-wrap: wrap; gap: 14px; color: var(--app-fg-muted); font-size: 11px; font-weight: 700; }
.organization-options label { display: inline-flex !important; align-items: center; gap: 6px; }
.organization-options input { width: auto !important; min-height: auto !important; }
.organization-radio {
  display: grid !important; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  color: var(--app-fg); background: var(--app-surface-muted);
}
.organization-radio input { width: auto !important; min-height: auto !important; }
.organization-radio span { display: grid; gap: 2px; }
.organization-radio small { color: var(--app-fg-muted); font-size: 11px; }
.history-list { max-height: 460px; overflow: auto; display: grid; gap: 0; margin: 0; padding: 0; text-align: left; list-style: none; }
.history-list li { display: grid; gap: 4px; padding: 14px 4px; border-bottom: 1px solid var(--app-border); }
.history-list time, .history-list small { color: var(--app-fg-muted); font-size: 10px; }
.history-list em { color: var(--app-accent); font-style: normal; }
.flatpickr-calendar { font-family: var(--app-font-sans); font-size: 12px; }
.flatpickr-current-month, .flatpickr-weekday { font-size: 12px; }
.flatpickr-day { font-size: 12px; }
.flatpickr-day.selected { border-color: var(--app-accent); background: var(--app-accent); }
.revchile-calendar .revchile-year-select {
  height: 30px; min-width: 78px; padding: 0 26px 0 8px; border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm); color: var(--app-fg); background: var(--app-surface);
  font-family: var(--app-font-sans); font-size: 12px; font-weight: 500; outline: 0;
}
.revchile-calendar .numInputWrapper { width: auto; }
.mobile-only { display: none; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); color: var(--app-fg); background: var(--app-surface); }

/* DataTables: grilla paginada en servidor */
#quotes-table, #clients-table, #users-table, #organizations-table { width: 100%; }
.dt-container { color: var(--app-fg); }
.dt-container .dt-layout-row { margin: 0; padding: 13px 16px; }
.dt-container .dt-layout-row:first-child { border-bottom: 1px solid var(--app-border); }
.dt-container .dt-layout-row:last-child { border-top: 1px solid var(--app-border); color: var(--app-fg-muted); }
.dt-container .dt-length label { display: flex; align-items: center; gap: 8px; color: var(--app-fg-muted); font-size: 11px; font-weight: 700; }
.dt-container .dt-length select {
  min-height: 34px; padding: 5px 28px 5px 9px; border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm); color: var(--app-fg); background-color: var(--app-surface);
  font-size: var(--app-control-font-size); font-weight: 500;
}
.dt-container .dt-info { font-size: 11px; }
.dt-container .dt-paging { display: flex; flex-wrap: wrap; gap: 4px; }
.dt-container .dt-paging .dt-paging-button {
  min-width: 35px; min-height: 34px; margin: 0 !important; padding: 5px 9px !important;
  border: 1px solid var(--app-border) !important; border-radius: var(--app-radius-sm) !important;
  color: var(--app-fg) !important; background: var(--app-surface) !important;
}
.dt-container .dt-paging .dt-paging-button.current {
  border-color: var(--app-accent) !important; color: var(--app-accent-foreground) !important;
  background: var(--app-accent) !important;
}
.dt-container .dt-paging .dt-paging-button.disabled { opacity: .42; }
.dt-container .dt-processing {
  z-index: 4; padding: 14px 20px; border: 1px solid var(--app-border);
  border-radius: var(--app-radius); color: var(--app-fg); background: var(--app-surface);
  box-shadow: var(--app-shadow-md);
}
table.dataTable > thead > tr > th { border-bottom-color: var(--app-border); }
table.dataTable > tbody > tr { background: transparent; }
table.dataTable > tbody > tr > * { box-shadow: none; }
table.dataTable.no-footer { border-bottom: 0; }
.options-cell { width: 76px; }
.options-cell-wide { width: 126px; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; }

/* Detalle de cotización */
.clients-layout { grid-template-columns: 1fr 1fr; }
.client-card { display: flex; flex-direction: column; }
.client-card .definition-grid { flex: 1; }
.definition-grid-two { grid-template-columns: 2fr 1fr; }
.button-compact { min-height: 32px; padding-inline: 10px; font-size: 11px; }
.card-help { margin: 0; padding: 0 18px 16px; color: var(--app-fg-muted); font-size: 11px; }
.content-card > header > div:first-child { display: grid; gap: 3px; }
.profile-page-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.profile-summary-card, .profile-action-card {
  border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow-sm);
}
.profile-summary-card { display: grid; gap: 18px; padding: 20px; }
.profile-action-card { display: grid; gap: 18px; padding: 20px; }
.profile-action-card h2, .profile-section h3 { margin: 0 0 6px; font-size: 16px; }
.profile-action-card .button { justify-self: start; }
.profile-hero { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--app-border); }
.profile-hero h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.profile-avatar-large {
  width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 18px; color: var(--app-accent-foreground); background: var(--app-accent);
  box-shadow: 0 14px 28px rgba(var(--app-accent-rgb), .2); font-size: 18px; font-weight: 900;
}
.profile-metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-metadata div {
  min-width: 0; display: grid; gap: 6px; padding: 14px; border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm); background: var(--app-surface-muted);
}
.profile-metadata span { color: var(--app-fg-muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.profile-metadata strong { overflow-wrap: anywhere; font-size: 15px; }
.profile-section { display: grid; gap: 8px; }
.profile-role-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.wiki-hero-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: stretch;
  margin-bottom: 16px; padding: 22px; border: 1px solid var(--app-border); border-radius: var(--app-radius);
  background: linear-gradient(135deg, rgba(var(--app-accent-rgb), .11), transparent 48%), var(--app-surface);
  box-shadow: var(--app-shadow-sm);
}
.wiki-hero-card h2 { margin: 12px 0 8px; font-size: 22px; letter-spacing: -.025em; }
.wiki-hero-card p { max-width: 820px; margin-bottom: 0; color: var(--app-fg-muted); line-height: 1.65; }
.wiki-hero-note {
  display: grid; align-content: center; gap: 6px; padding: 16px; border: 1px solid rgba(var(--app-accent-rgb), .24);
  border-radius: var(--app-radius); background: rgba(var(--app-accent-rgb), .08);
}
.wiki-hero-note strong { color: var(--app-fg); }
.wiki-hero-note span { color: var(--app-fg-muted); line-height: 1.5; }
.wiki-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.wiki-card {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px; padding: 18px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow-sm);
}
.wiki-card__icon {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px;
  color: var(--app-accent); background: rgba(var(--app-accent-rgb), .12); font-weight: 900;
}
.wiki-card h2 { margin: 0 0 6px; font-size: 17px; }
.wiki-card p { margin: 0 0 12px; color: var(--app-fg-muted); line-height: 1.55; }
.wiki-steps { display: grid; gap: 7px; margin: 0; padding-left: 18px; color: var(--app-fg-muted); line-height: 1.55; }
.wiki-steps strong { color: var(--app-fg); }
.wiki-section { margin-bottom: 16px; }
.wiki-content { padding: 18px; }
.wiki-content p { max-width: 880px; margin: 0; color: var(--app-fg-muted); line-height: 1.65; }
.wiki-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.wiki-shot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.wiki-shot-placeholder {
  min-height: 150px; display: grid; align-content: center; justify-items: center; gap: 7px;
  padding: 18px; border: 1px dashed var(--app-border-strong); border-radius: var(--app-radius);
  color: var(--app-fg-muted); background: var(--app-surface-muted); text-align: center;
}
.wiki-shot-placeholder span { color: var(--app-accent); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.wiki-shot-placeholder strong { color: var(--app-fg); }
.wiki-shot-placeholder small { max-width: 230px; line-height: 1.45; }
.payment-totals-inline { display: flex; align-items: center; gap: 20px; }
.payment-totals-inline span { display: grid; gap: 2px; text-align: right; }
.payment-totals-inline strong { color: var(--app-fg); font-size: 14px; }
.empty-inline { min-height: 120px; display: grid; place-content: center; gap: 5px; padding: 24px; text-align: center; color: var(--app-fg-muted); }
.empty-inline strong { color: var(--app-fg); }
.cell-secondary { display: block; margin-top: 3px; color: var(--app-fg-muted); font-size: 10px; }
.payment-note-row td { padding-top: 7px; padding-bottom: 9px; color: var(--app-fg-muted); background: var(--app-surface-muted); font-size: 11px; }
.notes-grid-single { grid-template-columns: 1fr; }
.history-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin: 7px 0; padding: 10px; border-radius: var(--app-radius-sm); background: var(--app-surface-muted); }
.history-data div { min-width: 0; display: grid; gap: 3px; }
.history-data dd { overflow-wrap: anywhere; font-size: 11px; }
.client-search-results {
  min-height: 150px; max-height: 330px; overflow: auto; display: grid; align-content: start;
  gap: 7px; padding: 9px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  background: var(--app-surface-muted);
}
.client-search-results > p { margin: auto; padding: 20px; color: var(--app-fg-muted); text-align: center; }
.client-search-item {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  color: var(--app-fg); background: var(--app-surface); text-align: left; cursor: pointer;
}
.client-search-item:hover, .client-search-item.selected {
  border-color: var(--app-accent); box-shadow: 0 0 0 2px var(--app-focus-ring);
}
.client-search-item.selected { background: rgba(var(--app-accent-rgb), .08); }
.search-error { color: var(--app-danger) !important; }
.approval-summary { display: grid; gap: 14px; text-align: left; }
.approval-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.approval-numbers span { display: grid; gap: 3px; padding: 11px; border-radius: var(--app-radius-sm); background: var(--app-surface-muted); color: var(--app-fg-muted); font-size: 11px; }
.approval-numbers strong { color: var(--app-fg); font-size: 15px; }
.approval-summary ul { max-height: 210px; overflow: auto; display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.approval-summary li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 10px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); }
.approval-summary li small { grid-column: 1 / -1; color: var(--app-fg-muted); }
.approval-summary .payment-warning { display: block; color: var(--app-warning); text-align: center; }
.approval-summary label { display: grid; gap: 6px; color: var(--app-fg-muted); font-size: 11px; font-weight: 700; }
.approval-summary textarea {
  width: 100%; min-height: 80px; padding: 9px 10px; border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm); color: var(--app-fg); background: var(--app-surface);
}

/* Portal público de documentación (solo ambientes no productivos) */
.docs-shell { min-height: calc(100vh - var(--app-footer-height)); display: grid; grid-template-columns: 292px minmax(0, 1fr); background: var(--app-bg); }
.docs-sidebar {
  position: sticky; top: 0; height: calc(100vh - var(--app-footer-height)); overflow-y: auto; padding: 20px 16px; color: var(--app-sidebar-fg);
  border-right: 1px solid var(--app-sidebar-border); background: var(--app-sidebar-bg);
  scrollbar-color: var(--app-sidebar-tree-line) transparent;
}
.docs-primary-nav { display: grid; gap: 3px; margin-bottom: 14px; }
.docs-primary-nav a {
  padding: 9px 11px; border-radius: var(--app-radius-sm); color: var(--app-sidebar-muted);
  text-decoration: none; font-size: 13px; font-weight: 650;
}
.docs-primary-nav a:hover { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.docs-nav-tree { border-top: 1px solid var(--app-sidebar-border); padding-top: 15px; }
.docs-index-title {
  margin: 0 7px 10px; color: var(--app-sidebar-muted); font-size: 12px; font-weight: 800;
  letter-spacing: .055em; text-transform: uppercase;
}
.docs-index-node { margin: 1px 0; }
.docs-index-node > summary {
  min-height: 31px; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center;
  border-radius: var(--app-radius-sm); color: var(--app-sidebar-fg); cursor: pointer; list-style: none;
}
.docs-index-node > summary::-webkit-details-marker,
.contract-tree summary::-webkit-details-marker { display: none; }
.docs-index-node > summary::before {
  content: "›"; width: 18px; height: 18px; display: grid; place-items: center; justify-self: center;
  border: 1px solid var(--app-sidebar-border); border-radius: 4px; color: var(--app-sidebar-active-fg);
  background: var(--app-sidebar-active); font-family: var(--app-font-sans); font-size: 17px;
  font-weight: 800; line-height: 1; transform: rotate(0deg); transition: transform .14s ease;
}
.docs-index-node[open] > summary::before { transform: rotate(90deg); }
.docs-index-children {
  display: grid; gap: 1px; margin: 2px 0 4px 9px; padding-left: 11px;
  border-left: 1px solid var(--app-sidebar-tree-line);
}
.docs-index-link {
  min-width: 0; padding: 6px 7px; border-radius: 5px; color: var(--app-sidebar-muted);
  text-decoration: none; font-family: var(--app-font-mono); font-size: 12.5px; font-weight: 600;
  line-height: 1.3; overflow-wrap: anywhere;
}
.docs-index-leaf { display: block; margin-left: 20px; }
.docs-index-link:hover,
.docs-index-link.active { color: var(--app-sidebar-active-fg); background: var(--app-sidebar-active); }
.docs-nav-tree code { padding: 0; color: inherit; background: none; font-size: inherit; }
.docs-main { width: min(1040px, 100%); margin: 0 auto; padding: 58px 42px 90px; }
.docs-hero { margin-bottom: 26px; }
.docs-hero > p:last-of-type { max-width: 740px; color: var(--app-fg-muted); font-size: 17px; line-height: 1.65; }
.docs-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.docs-card {
  margin-bottom: 16px; padding: 24px; border: 1px solid var(--app-border);
  border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow-sm);
  scroll-margin-top: 20px;
}
.docs-card h2 { margin-bottom: 14px; font-size: 20px; }
.docs-card h3 { margin: 0; font-size: 14px; }
.docs-card p, .docs-card li { color: var(--app-fg-muted); line-height: 1.65; }
.docs-card code {
  padding: 2px 5px; border-radius: 4px; color: var(--app-accent);
  background: rgba(var(--app-accent-rgb), .09); font-family: var(--app-font-mono); font-size: .9em;
}
.docs-card pre {
  max-height: 600px; overflow: auto; margin: 14px 0; padding: 18px; border-radius: var(--app-radius-sm);
  color: #e9eef4; background: #111820; line-height: 1.55;
}
.docs-card pre code { padding: 0; color: inherit; background: none; font-size: 12px; }
.docs-steps { display: grid; gap: 7px; padding-left: 22px; }
.docs-table-wrap { overflow: auto; }
.docs-card table { min-width: 700px; }
.docs-card th { position: static; }
.docs-callout { margin-top: 15px; padding: 12px 14px; border-left: 3px solid var(--app-warning); color: var(--app-fg-muted); background: var(--app-surface-muted); }
.docs-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.docs-section-heading h2 { margin-bottom: 0; }
.docs-version-badge {
  flex: 0 0 auto; padding: 6px 10px; border: 1px solid rgba(var(--app-accent-rgb), .32);
  border-radius: 999px; color: var(--app-accent); background: rgba(var(--app-accent-rgb), .09);
  font-family: var(--app-font-mono); font-size: 11px; font-weight: 700;
}
.docs-download-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.docs-download-card {
  min-width: 0; min-height: 154px; display: flex; align-items: flex-start; flex-direction: column; gap: 7px;
  padding: 16px; border: 1px solid var(--app-border); border-radius: var(--app-radius);
  color: var(--app-fg); background: var(--app-surface-muted); text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.docs-download-card:hover {
  border-color: var(--app-border-strong); box-shadow: var(--app-shadow-sm); transform: translateY(-1px);
}
.docs-download-card-primary {
  min-height: 132px; grid-column: 1 / -1; background: rgba(var(--app-accent-rgb), .07);
}
.docs-download-kind {
  color: var(--app-accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.docs-download-card strong { font-size: 15px; }
.docs-download-file {
  max-width: 100%; color: var(--app-fg-muted); font-family: var(--app-font-mono);
  font-size: 10.5px; line-height: 1.45; overflow-wrap: anywhere;
}
.docs-download-action { margin-top: auto; color: var(--app-accent); font-size: 12px; font-weight: 800; }
.docs-download-action span { display: inline-block; margin-left: 3px; font-size: 15px; }
.docs-download-steps { margin: 20px 0 0; }
.contract-changelog { margin: 20px 0 0; padding: 0; list-style: none; }
.contract-changelog > li {
  position: relative; padding: 2px 0 4px 20px; border-left: 2px solid var(--app-border-strong);
}
.contract-changelog > li::before {
  content: ""; position: absolute; top: 4px; left: -6px; width: 10px; height: 10px;
  border: 2px solid var(--app-surface); border-radius: 50%; background: var(--app-accent);
}
.contract-changelog-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.contract-changelog-meta strong { color: var(--app-fg); font-family: var(--app-font-mono); font-size: 14px; }
.contract-changelog-meta time { color: var(--app-fg-muted); font-size: 12px; }
.contract-changelog-meta span {
  padding: 3px 7px; border-radius: 999px; color: var(--app-success);
  background: rgba(var(--app-success-rgb), .1); font-size: 10px; font-weight: 800; text-transform: uppercase;
}
.contract-changelog h3 { margin-bottom: 7px; font-size: 15px; }
.contract-changelog ul { display: grid; gap: 5px; margin: 0; padding-left: 18px; }
.endpoint-line { display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: var(--app-radius-sm); background: var(--app-surface-muted); }
.endpoint-line > span { padding: 5px 8px; border-radius: 5px; color: #fff; background: var(--app-success); font-size: 11px; font-weight: 800; }
.code-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.copy-button {
  padding: 6px 10px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  color: var(--app-fg); background: var(--app-surface); font-size: 11px; font-weight: 700; cursor: pointer;
}
.contract-tree { display: grid; gap: 10px; }
.contract-tree details { border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); background: var(--app-surface); scroll-margin-top: 18px; }
.contract-tree summary {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; cursor: pointer; list-style: none;
  color: var(--app-fg); font-size: 15px; font-weight: 800;
}
.contract-tree summary::before {
  content: "›"; width: 19px; height: 19px; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid var(--app-border-strong); border-radius: 5px; color: var(--app-fg);
  background: var(--app-surface-muted); font-size: 18px; font-weight: 800; line-height: 1;
  transform: rotate(0deg); transition: transform .14s ease;
}
.contract-tree details[open] > summary::before { transform: rotate(90deg); }
.contract-tree summary > code { font-size: 15px; font-weight: 800; letter-spacing: -.015em; }
.contract-tree summary span { color: var(--app-fg-muted); font-size: 12px; font-weight: 500; }
.contract-tree > details > summary { color: var(--app-accent); }
.contract-node-body { display: grid; gap: 10px; overflow-x: auto; padding: 0 12px 12px; }
.contract-node-body > p { margin: 2px 2px 0; }
.field-table { min-width: 650px; }
.field-table td:first-child { width: 27%; color: var(--app-fg); }
.field-table td:nth-child(2) { width: 16%; color: var(--app-fg-muted); font-family: var(--app-font-mono); font-size: 11px; }
.field-table td:last-child { white-space: normal; color: var(--app-fg-muted); }
@media (max-width: 1180px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(var(--app-sidebar-width), 86vw); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; place-items: center; margin-right: auto; }
  .topbar { padding: 0 16px; }
  .topbar-context { max-width: min(70vw, 360px); }
  .topbar-company { display: none; }
  .organization-switch-button { min-width: 0; }
  .page-content { padding: 20px 16px 40px; }
  .app-footer { align-items: flex-start; flex-direction: column; gap: 3px; padding: 10px 16px 14px; }
  .app-footer span:last-child { text-align: left; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .filters { align-items: stretch; }
  .filters label, .filters .filter-grow, .filter-actions { flex: 1 1 100%; max-width: none; }
  .filter-actions { justify-content: flex-start; margin-left: 0; }
  .status-strip, .definition-grid, .detail-grid, .notes-grid { grid-template-columns: 1fr; }
  .profile-page-layout, .profile-metadata { grid-template-columns: 1fr; }
  .wiki-hero-card, .wiki-grid, .wiki-shot-grid { grid-template-columns: 1fr; }
  .history-data, .approval-numbers { grid-template-columns: 1fr; }
  .payment-totals-inline { width: 100%; justify-content: flex-start; padding-top: 9px; }
  .content-card > header { flex-wrap: wrap; padding-block: 10px; }
  .docs-shell { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; height: auto; }
  .docs-primary-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-nav-tree { max-height: 280px; overflow: auto; }
  .docs-main { padding: 32px 16px 60px; }
  .docs-card { padding: 18px; }
  .docs-section-heading { align-items: flex-start; flex-direction: column; }
  .docs-download-grid { grid-template-columns: 1fr; }
  .docs-download-card-primary { grid-column: auto; }
  .public-theme-control { top: 10px; right: 10px; }
  .status-strip div { padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--app-border); }
  .status-strip div:last-child { border-bottom: 0; }
}
