/*
 * SISTEMA VISUAL CUINANATURAL · APROBADO Y BLOQUEADO
 * Definición: docs/SISTEMA_VISUAL.md
 * No modificar identidad, composición ni componentes sin autorización explícita del usuario.
 */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Questrial&display=swap');

:root {
  --yellow: #F5CE22;
  --yellow-soft: #FBE99C;
  --charcoal: #212529;
  --ivory: #F9F6EE;
  --white: #FFFFFF;
  --ink: #212529;
  --text-muted: rgba(33, 37, 41, .66);
  --line: rgba(33, 37, 41, .16);
  --canvas: var(--ivory);
  --surface: var(--white);
  --surface-soft: var(--ivory);
  --sidebar-bg: var(--charcoal);
  --sidebar-text: var(--white);
  --proposal-bg: var(--surface);
  --calculation-bg: var(--surface);
  --order-area-bg: var(--surface-soft);
  --supplier-bg: var(--surface-soft);
  --proposal-cell-bg: var(--yellow-soft);
  --dev-alert-bg: var(--yellow-soft);
  --manual-field-bg: var(--white);
  --profile-border: var(--yellow);
  --action-bg: var(--charcoal);
  --action-text: var(--white);
  --primary-bg: var(--yellow);
  --primary-text: var(--charcoal);
  --field-bg: var(--surface-soft);
  --table-bg: var(--charcoal);
  --table-text: var(--white);
  --ok-color: #2E7D32;
  --review-color: #C62828;
  --warning-color: #F5CE22;
  --topbar-bg: var(--charcoal);
  --topbar-text: var(--white);
  --topbar-menu-bg: var(--surface);
  --topbar-icon: var(--white);
  --topbar-active: var(--yellow);
  --section-header-bg: var(--charcoal);
  --section-header-text: var(--white);
  --supplier-hover-bg: var(--yellow-soft);
  --supplier-active-bg: rgba(33, 37, 41, .12);
  --supplier-active-frame: rgba(33, 37, 41, .52);
  --pending-order-color: var(--ok-color);
  --module-purchase-bg: var(--surface);
  --module-purchase-accent: var(--yellow);
  --module-frequency-bg: var(--surface);
  --module-frequency-accent: var(--yellow);
  --module-billing-bg: var(--surface);
  --module-billing-accent: var(--yellow);
  --module-delivery-bg: var(--surface);
  --module-delivery-accent: var(--yellow);
  --module-supplier-notes-bg: var(--surface);
  --module-supplier-notes-accent: var(--yellow);
  --module-hover-border: var(--yellow);
  --radius: var(--user-radius, 18px);
  --button-radius: var(--user-button-radius, 10px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: var(--white);
  --text-muted: rgba(255, 255, 255, .68);
  --line: rgba(255, 255, 255, .18);
  --canvas: var(--charcoal);
  --surface: var(--charcoal);
  --surface-soft: rgba(249, 246, 238, .08);
  --action-bg: var(--yellow);
  --action-text: var(--charcoal);
  --table-bg: var(--yellow);
  --table-text: var(--charcoal);
  --supplier-active-bg: rgba(249, 246, 238, .16);
  --supplier-active-frame: rgba(249, 246, 238, .62);
  color-scheme: dark;
}

:root[data-theme="light"][data-canvas="white"] { --canvas: var(--white); }
:root[data-theme="light"][data-panels="ivory"] { --surface: var(--ivory); --surface-soft: var(--white); }
:root[data-theme="dark"][data-panels="ivory"] { --surface: rgba(249, 246, 238, .08); }
:root[data-table="yellow"] { --table-bg: var(--yellow); --table-text: var(--charcoal); }
:root[data-table="charcoal"] { --table-bg: var(--charcoal); --table-text: var(--white); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: 'Questrial', Arial, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }

.startup-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--canvas);
  opacity: 1;
  transition: opacity .4s ease, visibility .4s ease;
}
.startup-screen.is-finished { visibility: hidden; opacity: 0; }
.startup-content { width: min(310px, calc(100% - 48px)); text-align: center; }
.startup-logo { min-height: 200px; display: grid; place-items: center; margin-bottom: 24px; }
.startup-loader-image { width: min(210px, 70vw); height: auto; display: block; object-fit: contain; }
.startup-progress { height: 5px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.startup-progress span { width: 100%; height: 100%; display: block; border-radius: inherit; background: var(--yellow); transform-origin: left; animation: cook-progress 2.15s cubic-bezier(.22,.8,.25,1) both; }
.startup-content p { margin: 16px 0 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 21px; }
.cooking-dots span { opacity: .2; animation: cook-dot 1.2s infinite; }
.cooking-dots span:nth-child(2) { animation-delay: .2s; }
.cooking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes cook-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cook-dot { 0%, 70%, 100% { opacity: .2; } 35% { opacity: 1; } }

.app-shell {
  width: min(1500px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 24px 65px rgba(33, 37, 41, .10);
}

.sidebar {
  position: relative;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 22px 20px;
  border-radius: 25px 0 0 25px;
  color: var(--sidebar-text);
  background: var(--sidebar-bg);
}

.brand {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: transparent;
}
.brand img { width: 128px; height: 59px; object-fit: contain; }
.brand-logo-light { display: none; }
.brand-logo-dark { display: block; }
:root[data-sidebar="ivory"] .brand-logo-light { display: block; }
:root[data-sidebar="ivory"] .brand-logo-dark { display: none; }
:root[data-topbar-tone="light"] .brand-logo-light { display: block; }
:root[data-topbar-tone="light"] .brand-logo-dark { display: none; }
:root[data-topbar-tone="dark"] .brand-logo-light { display: none; }
:root[data-topbar-tone="dark"] .brand-logo-dark { display: block; }

.sidebar nav { display: grid; gap: 8px; }
.nav-module-group { display: grid; gap: 8px; }
.nav-module-group[hidden] { display: none; }
.nav-section-toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.14);
  color: var(--sidebar-text);
  background: transparent;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-section-toggle:hover:not(:disabled) { filter: none; transform: none; background: rgba(255,255,255,.07); }
.nav-chevron { font-size: 18px; transition: transform .18s ease; }
.nav-section-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(180deg); }
.nav-section-panel { display: grid; gap: 6px; padding: 2px 0 8px 10px; }
.nav-link {
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.nav-link:hover { background: rgba(255,255,255,.07); }
.nav-link.active { color: var(--charcoal); background: var(--yellow); }
.nav-icon { width: 18px; font-size: 18px; text-align: center; }
.nav-action { width: 100%; border: 0; background: transparent; text-align: left; }

:root[data-sidebar="ivory"] { --sidebar-bg: var(--ivory); --sidebar-text: var(--charcoal); }
:root[data-sidebar="ivory"] .sidebar { color: var(--sidebar-text); background: var(--sidebar-bg); }
:root[data-sidebar="ivory"] .nav-section-toggle { border-color: rgba(33,37,41,.18); color: var(--sidebar-text); }
:root[data-sidebar="ivory"] .nav-section-toggle:hover:not(:disabled),
:root[data-sidebar="ivory"] .nav-link:hover { background: rgba(33,37,41,.07); }
:root[data-sidebar="ivory"] .nav-link { color: var(--sidebar-text); }
:root[data-sidebar="ivory"] .nav-link.active { color: var(--charcoal); background: var(--yellow); }

.sidebar-identity { display: grid; gap: 10px; }
.sidebar-status {
  margin: 0;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 15px;
  background: rgba(255,255,255,.045);
}
.sidebar-status-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.sidebar-status p { margin: 10px 0 0; color: rgba(255, 255, 255, .70); font-size: 11px; line-height: 1.45; }
:root[data-sidebar="ivory"] .sidebar-status { border-color: rgba(33,37,41,.18); background: rgba(33,37,41,.04); }
:root[data-sidebar="ivory"] .sidebar-status p { color: rgba(33,37,41,.70); }
.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 15px; background: rgba(255,255,255,.045); }
.sidebar-user-profile { min-width: 0; min-height: 44px; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; justify-items: start; gap: 9px; padding: 4px 6px; color: var(--sidebar-text); background: transparent; text-align: left; }
.sidebar-user-profile:hover:not(:disabled) { filter: none; background: rgba(255,255,255,.07); }
.sidebar-user-copy { min-width: 0; display: grid; gap: 3px; }
.sidebar-user-copy strong { max-width: 96px; overflow: hidden; color: var(--sidebar-text); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy small { color: color-mix(in srgb, var(--sidebar-text) 68%, transparent); font-size: 10px; }
.sidebar-user form { margin: 0; }
.sidebar-user form button { min-height: 34px; padding: 0 10px; border: 1px solid rgba(255,255,255,.18); color: var(--sidebar-text); background: transparent; font-size: 11px; }
:root[data-sidebar="ivory"] .sidebar-user { border-color: rgba(33,37,41,.18); background: rgba(33,37,41,.04); }
:root[data-sidebar="ivory"] .sidebar-user form button { border-color: rgba(33,37,41,.18); }
:root[data-sidebar="ivory"] .sidebar-user-profile:hover:not(:disabled) { background: rgba(33,37,41,.07); }
.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--charcoal);
  background: var(--yellow);
  font-size: 10px;
  letter-spacing: .06em;
}
.env-badge span { width: 6px; height: 6px; border-radius: 50%; background: var(--charcoal); }
.env-badge.large { font-size: 12px; }

.workspace { min-width: 0; padding: 28px 30px 40px; }
.app-view { min-width: 0; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--ink); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; }
h1 { margin: 0; font-size: clamp(31px, 3vw, 40px); line-height: 1.06; }
.page-subtitle { margin: 8px 0 0; color: var(--text-muted); font-size: 14px; }
.module-view-selector { min-width: 230px; display: grid; gap: 7px; color: var(--text-muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.module-view-selector select { width: 100%; height: 43px; padding: 0 36px 0 12px; border: 1px solid var(--line); border-radius: var(--button-radius); outline: 0; color: var(--ink); background: var(--field-bg); font-size: 12px; letter-spacing: 0; text-transform: none; }
.module-view-selector select:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 20%, transparent); }

.dashboard-view { min-height: calc(100vh - 105px); }
.module-dashboard-section { width: 100%; }
.module-dashboard-grid { display: grid; gap: 22px; }
.module-dashboard {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  box-shadow: 0 10px 30px rgba(33, 37, 41, .05);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.module-dashboard.is-available { cursor: pointer; }
.module-dashboard.is-available:hover { transform: translateY(-2px); border-color: var(--module-hover-border); box-shadow: 0 16px 36px rgba(33, 37, 41, .10); }
.module-dashboard.is-available::before { content: ''; position: absolute; z-index: 2; top: -1px; bottom: -1px; left: -1px; width: 7px; border-radius: var(--radius) 0 0 var(--radius); background: var(--yellow); }
.module-dashboard.is-locked { opacity: .82; }
.module-card-purchase { background: var(--module-purchase-bg); }
.module-card-purchase.is-available::before, .module-card-purchase .module-dashboard-icon { background: var(--module-purchase-accent); }
.module-card-frequency { background: var(--module-frequency-bg); }
.module-card-frequency.is-available::before, .module-card-frequency .module-dashboard-icon { background: var(--module-frequency-accent); }
.module-card-billing { background: var(--module-billing-bg); }
.module-card-billing.is-available::before, .module-card-billing .module-dashboard-icon { background: var(--module-billing-accent); }
.module-card-delivery { background: var(--module-delivery-bg); }
.module-card-delivery.is-available::before, .module-card-delivery .module-dashboard-icon { background: var(--module-delivery-accent); }
.module-card-supplier-notes { background: var(--module-supplier-notes-bg); }
.module-card-supplier-notes.is-available::before, .module-card-supplier-notes .module-dashboard-icon { background: var(--module-supplier-notes-accent); }
.module-dashboard-content { position: relative; z-index: 1; }
.module-dashboard-heading { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.module-dashboard-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; color: var(--charcoal); background: var(--yellow-soft); }
.module-dashboard-icon svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.module-dashboard-title { min-width: 0; }
.module-dashboard-title .eyebrow { margin-bottom: 3px; }
.module-dashboard-title h2 { margin: 0; font-size: clamp(25px, 2.4vw, 32px); line-height: 1.08; }
.module-dashboard-title > p:last-child { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; }
.module-dashboard-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.module-dashboard-toggle { width: 42px; min-width: 42px; height: 42px; min-height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid color-mix(in srgb, var(--section-header-text) 30%, transparent); border-radius: 50%; color: var(--section-header-text); background: color-mix(in srgb, var(--section-header-text) 10%, transparent); }
.module-dashboard-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.module-dashboard-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.module-dashboard-toggle:hover { border-color: var(--module-hover-border); background: color-mix(in srgb, var(--module-hover-border) 16%, transparent); transform: none; filter: none; }
.module-dashboard-toggle:focus-visible { outline: 2px solid var(--module-hover-border); outline-offset: 2px; }
.module-dashboard:not(.is-expanded) .module-dashboard-heading { padding: 14px 20px; }
.module-dashboard:not(.is-expanded) .module-dashboard-icon { width: 46px; height: 46px; border-radius: 13px; }
.module-dashboard:not(.is-expanded) .module-dashboard-icon svg { width: 24px; height: 24px; }
.module-dashboard:not(.is-expanded) .module-dashboard-title h2 { font-size: clamp(21px, 2vw, 27px); }
.module-dashboard:not(.is-expanded) .module-dashboard-title > p:last-child { display: none; }
.module-dashboard:not(.is-expanded) .module-dashboard-status { padding-block: 7px; }
.module-dashboard:not(.is-expanded) .module-dashboard-kpis { padding-block: 12px 15px; }
.module-dashboard:not(.is-expanded) .module-dashboard-kpi { padding: 12px 14px 11px; }
.module-dashboard:not(.is-expanded) .module-dashboard-kpi strong { margin: 6px 0 3px; font-size: 25px; }
.module-dashboard:not(.is-expanded) .module-dashboard-kpi small { display: none; }
.module-access-state { align-self: start; padding: 7px 10px; border-radius: 999px; color: var(--charcoal); background: var(--yellow-soft); font-size: 10px; white-space: nowrap; }
.module-dashboard button.module-access-state { min-height: 0; border: 0; }
.module-access-state.is-disabled { color: var(--text-muted); background: var(--surface-soft); }
.module-dashboard-status { margin: 0; padding: 10px 24px; border-bottom: 1px solid var(--line); color: var(--text-muted); background: color-mix(in srgb, var(--surface-soft) 78%, transparent); font-size: 11px; }
.module-dashboard-status.is-error { color: var(--review-color); }
.module-dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 18px 24px; }
.module-dashboard-kpi { position: relative; min-width: 0; min-height: 0; overflow: hidden; padding: 15px 16px 14px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 4px); color: var(--ink); background: color-mix(in srgb, var(--surface) 82%, transparent); text-align: left; }
.module-dashboard .module-dashboard-kpi:hover:not(:disabled), .module-dashboard .module-access-state:hover:not(:disabled), .module-dashboard .dashboard-priority-row:hover, .module-dashboard .dashboard-trend-row:hover, .module-dashboard .dashboard-urgent-row:hover { filter: none; transform: none; border-color: var(--module-hover-border); background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface)); }
.module-dashboard .module-dashboard-kpi:focus-visible, .module-dashboard .module-access-state:focus-visible, .module-dashboard .dashboard-priority-row:focus-visible, .module-dashboard .dashboard-trend-row:focus-visible, .module-dashboard .dashboard-urgent-row:focus-visible { outline: 2px solid var(--module-hover-border); outline-offset: -2px; }
.module-dashboard-kpi:disabled { color: var(--ink); opacity: 1; cursor: default; }
.module-dashboard-kpi::before { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 4px; background: var(--yellow); }
.module-dashboard-kpi.is-review::before { background: var(--review-color); }
.module-dashboard-kpi.is-warning::before { background: var(--yellow); }
.module-dashboard-kpi.is-ok::before { background: var(--ok-color); }
.module-dashboard-kpi span, .module-dashboard-kpi small { display: block; color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.module-dashboard-kpi strong { display: block; margin: 8px 0 5px; font-family: 'DM Serif Display', Georgia, serif; font-size: 29px; font-weight: 400; line-height: 1; }
.module-dashboard-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 14px; padding: 0 24px 24px; }
.frequency-dashboard-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.module-dashboard-block { overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--radius) - 3px); background: color-mix(in srgb, var(--surface) 82%, transparent); }
.module-dashboard-block-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.module-dashboard-block-head h3 { margin: 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.module-dashboard-block-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 10px; }
.dashboard-priority-list, .dashboard-trend-list, .dashboard-urgent-list { min-height: 76px; }
.dashboard-empty { margin: 0; padding: 22px 16px; color: var(--text-muted); font-size: 11px; }
.dashboard-priority-entry, .dashboard-weekly-forecast-entry { border-bottom: 1px solid var(--line); }
.dashboard-priority-entry:last-child, .dashboard-weekly-forecast-entry:last-child { border-bottom: 0; }
.dashboard-priority-row { width: 100%; min-height: 0; display: grid; grid-template-columns: 5px minmax(0, 1fr) auto auto; align-items: center; gap: 11px; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.dashboard-priority-entry .dashboard-priority-row, .dashboard-weekly-forecast-entry .dashboard-weekly-forecast-row { border-bottom: 0; }
.dashboard-priority-row:last-child, .dashboard-trend-row:last-child, .dashboard-urgent-row:last-child { border-bottom: 0; }
.dashboard-priority-mark { align-self: stretch; border-radius: 999px; background: var(--review-color); }
.dashboard-priority-copy { min-width: 0; }
.dashboard-priority-copy strong, .dashboard-urgent-copy strong { display: block; overflow: hidden; font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-priority-copy small, .dashboard-urgent-copy small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.dashboard-priority-count { text-align: right; }
.dashboard-priority-count strong { display: block; font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.dashboard-priority-count small { color: var(--text-muted); font-size: 9px; }
.dashboard-priority-state { padding: 5px 8px; border-radius: 999px; color: var(--review-color); background: color-mix(in srgb, var(--review-color) 10%, transparent); font-size: 9px; }
.dashboard-stock-summary { padding: 18px 16px; }
.dashboard-stacked-bar { height: 14px; display: flex; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.dashboard-stacked-bar span { display: block; width: 0; transition: width .25s ease; }
.dashboard-stacked-bar .is-review, .dashboard-dot.is-review { background: var(--review-color); }
.dashboard-stacked-bar .is-ok, .dashboard-dot.is-ok { background: var(--ok-color); }
.dashboard-legend { margin: 16px 0 0; }
.dashboard-legend div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.dashboard-legend dt { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.dashboard-legend dd { margin: 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 17px; }
.dashboard-dot { width: 9px; height: 9px; border-radius: 50%; }
.dashboard-weekly-forecast { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--button-radius) + 3px); color: var(--ink); background: color-mix(in srgb, var(--yellow) 10%, var(--surface)); }
.dashboard-weekly-forecast-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border-bottom: 1px solid var(--line); }
.dashboard-weekly-forecast-head span, .dashboard-weekly-forecast-row strong { display: block; overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-weekly-forecast-head strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 25px; font-weight: 400; }
.dashboard-weekly-forecast-head small, .dashboard-weekly-forecast-row small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 9px; line-height: 1.35; }
.dashboard-weekly-forecast-list { max-height: 320px; overflow-y: auto; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.dashboard-weekly-forecast-row { width: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 13px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.dashboard-weekly-forecast-row:last-child { border-bottom: 0; }
.dashboard-weekly-forecast-row:hover:not(:disabled) { color: var(--ink); background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface)); transform: none; filter: none; }
.dashboard-weekly-forecast-values { color: var(--text-muted); font-size: 10px; white-space: nowrap; }
.dashboard-order-links { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 16px 10px 32px; }
.dashboard-order-links[hidden] { display: none; }
.dashboard-order-links .order-link { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--ok-color) 48%, transparent); border-radius: 999px; color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 9%, transparent); font-size: 9px; font-weight: 700; }
.dashboard-next-action { margin-top: 18px; padding: 12px 13px; border-radius: calc(var(--button-radius) + 3px); color: var(--ink); background: color-mix(in srgb, var(--review-color) 9%, var(--surface)); font-size: 11px; line-height: 1.45; }
.delivery-dashboard-body { grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); }
.delivery-dashboard-list { min-height: 76px; }
.delivery-dashboard-row { width: 100%; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.delivery-dashboard-row:last-child { border-bottom: 0; }
.delivery-dashboard-row strong, .delivery-dashboard-row small { display: block; }
.delivery-dashboard-row strong { font-size: 12px; font-weight: 400; }
.delivery-dashboard-row small { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.delivery-dashboard-row b { font-family: 'DM Serif Display', Georgia, serif; font-size: 20px; font-weight: 400; }
.delivery-dashboard-address { min-height: 124px; display: grid; place-content: center; padding: 22px; text-align: center; }
.delivery-dashboard-address strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 42px; font-weight: 400; }
.delivery-dashboard-address span { margin-top: 5px; color: var(--text-muted); font-size: 10px; }

.delivery-controls-panel { overflow: visible; }
.delivery-local-nav { width: fit-content; margin: 0 0 18px; }
.delivery-tab-alert { min-width: 19px; height: 19px; display: inline-grid; place-items: center; margin-left: 5px; padding: 0 5px; border-radius: 999px; color: white; background: var(--review-color); font-size: 8px; font-weight: 700; }
.delivery-tab-alert[hidden] { display: none; }
.delivery-controls { display: grid; grid-template-columns: minmax(160px, .55fr) minmax(220px, 1fr) minmax(170px, .65fr) auto; align-items: end; gap: 14px; padding: 0 20px 20px; }
.delivery-controls label { margin-bottom: 0; }
.delivery-controls input, .delivery-controls select { width: 100%; height: 43px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); background: var(--field-bg); }
.delivery-controls button { height: 43px; margin-bottom: 0; }
.delivery-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.delivery-controls-panel { margin-bottom: 12px; }
.delivery-planning-status { margin: 0 0 22px; }
.delivery-workspace { display: grid; grid-template-columns: minmax(390px, .82fr) minmax(440px, 1.18fr); gap: 18px; }
.delivery-workspace .panel { margin: 0; }
.delivery-list-panel { min-width: 0; }
.delivery-route-list { max-height: 720px; overflow-y: auto; padding: 16px; }
.delivery-route-group { overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 5px); background: var(--surface); }
.delivery-route-group:last-child { margin-bottom: 0; }
.delivery-route-group > summary { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 46px 13px 15px; color: var(--section-header-text); background: var(--section-header-bg); cursor: pointer; list-style: none; }
.delivery-route-group > summary::-webkit-details-marker { display: none; }
.delivery-route-group > summary::after { content: ''; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-68%) rotate(45deg); transition: transform .18s ease; }
.delivery-route-group[open] > summary::after { transform: translateY(-32%) rotate(225deg); }
.delivery-route-group > summary:hover { filter: brightness(1.08); }
.delivery-route-group > summary:focus-visible { outline: 2px solid var(--module-hover-border); outline-offset: -3px; }
.delivery-route-group h3 { margin: 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.delivery-route-group summary p { margin: 4px 0 0; color: color-mix(in srgb, var(--section-header-text) 74%, transparent); font-size: 9px; }
.delivery-route-optimize { min-height: 30px; flex: 0 0 auto; margin: 0 7px 0 auto; padding: 5px 10px; border: 1px solid color-mix(in srgb, var(--section-header-text) 34%, transparent); border-radius: 999px; color: var(--section-header-text); background: color-mix(in srgb, var(--section-header-text) 9%, transparent); font-size: 9px; }
.delivery-route-optimize:hover:not(:disabled), .delivery-route-optimize:focus-visible { color: var(--charcoal); background: var(--module-delivery-accent); box-shadow: none; transform: none; }
.delivery-route-optimize:disabled { opacity: .42; }
.delivery-stop { min-width: 0; display: grid; grid-template-columns: 20px 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 11px 13px; border-bottom: 1px solid var(--line); background: var(--surface); }
.delivery-stop:last-child { border-bottom: 0; }
.delivery-stop .delivery-stop-order { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 50%; color: var(--charcoal); background: var(--module-delivery-accent); font-weight: 700; line-height: 1; text-align: center; }
.delivery-stop-copy { min-width: 0; }
.delivery-stop-handle { width: 20px; height: 32px; display: grid; grid-template-columns: repeat(2, 3px); grid-auto-rows: 3px; place-content: center; gap: 3px; padding: 0; border: 0; border-radius: 6px; color: var(--text-muted); background: transparent; cursor: grab; touch-action: none; }
.delivery-stop-handle:hover, .delivery-stop-handle:focus-visible { color: var(--ink); background: var(--surface-soft); box-shadow: none; transform: none; }
.delivery-stop-handle:active { cursor: grabbing; }
.delivery-stop-handle span { width: 3px; height: 3px; display: block; border-radius: 50%; background: currentColor; }
.delivery-stop strong, .delivery-stop span, .delivery-stop small { display: block; }
.delivery-stop strong { overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.delivery-stop div > span { margin-top: 3px; color: var(--ink); font-size: 10px; line-height: 1.35; }
.delivery-stop small { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.delivery-stop-actions { display: grid; justify-items: end; gap: 6px; }
.delivery-location-state { min-height: 0; padding: 4px 7px; border: 0; border-radius: 999px; font-size: 8px; font-weight: 700; }
.delivery-location-state:hover { transform: none; filter: none; }
.delivery-location-state.is-verified { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.delivery-location-state.is-review { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, transparent); }
.delivery-stop-actions a, .delivery-map-link { color: var(--ok-color); font-size: 9px; font-weight: 700; text-decoration: none; }
.delivery-stop-actions a:hover, .delivery-map-link:hover { text-decoration: underline; }
.delivery-map-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.delivery-map-route-summary { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border: 1px solid color-mix(in srgb, var(--ok-color) 45%, transparent); border-radius: 999px; color: white; background: var(--ok-color); font-size: 10px; font-weight: 700; white-space: nowrap; }
.delivery-map-route-summary.is-estimate { border-color: color-mix(in srgb, var(--warning-color) 45%, transparent); color: var(--charcoal); background: var(--warning-color); }
.delivery-map-route-summary[hidden] { display: none; }
.delivery-state { width: fit-content; padding: 4px 7px; border-radius: 999px; color: var(--warning-color); background: color-mix(in srgb, var(--warning-color) 14%, transparent); font-size: 8px; }
.delivery-state.is-done { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.delivery-proof { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.delivery-proof-item { padding: 4px 7px; border-radius: 999px; font-size: 8px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.delivery-proof-item:hover { text-decoration: underline; }
.delivery-proof-item.is-ok { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.delivery-proof-item.is-missing { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 10%, transparent); }
.delivery-stop-placeholder { margin: 6px 8px; border: 1px dashed var(--module-delivery-accent); border-radius: calc(var(--radius) - 8px); background: color-mix(in srgb, var(--module-delivery-accent) 10%, var(--surface)); }
.delivery-stop.is-reordering { z-index: 2000; overflow: hidden; border: 1px solid var(--module-delivery-accent); border-radius: calc(var(--radius) - 8px); box-shadow: 0 18px 45px rgba(33, 37, 41, .24); cursor: grabbing; pointer-events: none; opacity: .97; }
.delivery-map-panel { overflow: hidden; }
.delivery-map { min-height: 620px; z-index: 0; background: var(--surface-soft); }
.delivery-map-number { border: 0; color: var(--charcoal); background: transparent; box-shadow: none; font: 700 10px 'Questrial', Arial, sans-serif; }
.delivery-map-number::before { display: none; }
.delivery-origin-icon-shell { border: 0; background: transparent; }
.delivery-origin-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 2px solid var(--topbar-text); border-radius: 50% 50% 50% 0; background: var(--topbar-bg); box-shadow: 0 5px 13px rgba(0, 0, 0, .28); transform: rotate(-45deg); }
.delivery-origin-icon img { width: 25px; height: 25px; object-fit: contain; transform: rotate(45deg); }
.delivery-finish-icon-shell { border: 0; background: transparent; }
.delivery-finish-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 2px solid var(--finish-color, var(--topbar-text)); border-radius: 50% 50% 50% 0; background: var(--topbar-bg); box-shadow: 0 5px 13px rgba(0, 0, 0, .28); transform: rotate(-45deg); }
.delivery-finish-icon svg { width: 25px; height: 25px; overflow: visible; transform: rotate(45deg); }
.finish-flag-pole { fill: none; stroke: var(--topbar-text); stroke-width: 2.4; stroke-linecap: round; }
.finish-flag-border { fill: var(--topbar-text); stroke: var(--topbar-text); stroke-width: 1; }
.finish-flag-dark { fill: var(--charcoal); }
.finish-flag-light { fill: white; }
.delivery-map-finish-label { border: 0; border-radius: 999px; color: var(--topbar-text); background: var(--topbar-bg); box-shadow: 0 3px 9px rgba(0, 0, 0, .22); font: 700 9px 'Questrial', Arial, sans-serif; }
.delivery-map-finish-label::before { border-top-color: var(--topbar-bg); }
.delivery-map-location { min-height: 0; margin-top: 7px; padding: 5px 8px; border: 0; border-radius: 999px; font-size: 10px; }
.delivery-map-location.is-verified { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, white); }
.delivery-map-location.is-review { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, white); }
.delivery-map-attribution { margin: 0; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--text-muted); background: var(--surface); font-size: 8px; }
.delivery-location-dialog { width: min(680px, calc(100% - 32px)); }
.delivery-location-dialog > form { max-height: calc(100vh - 34px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.delivery-location-dialog .appearance-head { color: var(--section-header-text); background: var(--section-header-bg); }
.delivery-location-dialog .appearance-head h2 { color: var(--section-header-text); }
.delivery-location-dialog .appearance-head .eyebrow,
.delivery-location-dialog .appearance-head p:last-child { color: color-mix(in srgb, var(--section-header-text) 78%, transparent); }
.delivery-location-dialog .appearance-head .dialog-close { color: var(--section-header-text); background: transparent; }
.delivery-location-body { min-height: 0; display: grid; grid-auto-rows: max-content; align-content: start; gap: 14px; overflow-y: auto; padding: 22px 24px; }
.delivery-location-body label { display: grid; gap: 8px; font-size: 12px; }
.delivery-location-body input { width: 100%; }
.delivery-location-body small { color: var(--text-muted); font-size: 10px; line-height: 1.4; }
.delivery-location-maps-search { width: fit-content; min-height: 38px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); background: var(--surface-soft); font-size: 10px; font-weight: 700; text-decoration: none; }
.delivery-location-maps-search:hover { border-color: var(--module-hover-border); background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface)); }
.delivery-location-note { margin: 0; padding: 12px 14px; border-radius: var(--button-radius); color: var(--ink); background: var(--surface-soft); font-size: 10px; line-height: 1.45; }
.delivery-location-body .inline-status { margin: 0; }
.delivery-location-change { padding: 14px; border-left: 4px solid var(--review-color); border-radius: var(--button-radius); background: color-mix(in srgb, var(--review-color) 9%, var(--surface)); }
.delivery-location-change > strong { color: var(--review-color); font-size: 12px; }
.delivery-location-change dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 0; }
.delivery-location-change dl div { min-width: 0; }
.delivery-location-change dt { color: var(--text-muted); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.delivery-location-change dd { margin: 4px 0 0; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.delivery-location-address-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; border: 0; }
.delivery-location-address-options legend { grid-column: 1 / -1; margin-bottom: 1px; color: var(--ink); font-size: 12px; }
.delivery-location-address-option { min-width: 0; min-height: 70px; display: grid; align-content: center; justify-items: start; gap: 5px; padding: 11px 13px; border: 1px solid var(--line); color: var(--ink); background: var(--surface-soft); text-align: left; }
.delivery-location-address-option span { color: var(--text-muted); font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.delivery-location-address-option strong { max-width: 100%; overflow-wrap: anywhere; font-size: 10px; line-height: 1.4; }
.delivery-location-address-option:hover,
.delivery-location-address-option.is-selected { border-color: var(--yellow); color: var(--ink); background: color-mix(in srgb, var(--yellow) 16%, var(--surface)); transform: none; filter: none; }
.delivery-location-picker { overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--radius) - 6px); background: var(--surface-soft); }
.delivery-location-picker > div:first-child { display: grid; gap: 4px; padding: 12px 14px; color: var(--section-header-text); background: var(--section-header-bg); }
.delivery-location-picker > div:first-child strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 17px; font-weight: 400; }
.delivery-location-picker > div:first-child small { color: color-mix(in srgb, var(--section-header-text) 76%, transparent); }
#delivery-location-picker-map { width: 100%; height: 250px; background: var(--surface-soft); }
.delivery-location-picker > p { margin: 0; padding: 9px 14px; color: var(--text-muted); font-size: 10px; }
.delivery-client-controls-panel { overflow: visible; margin-bottom: 18px; }
.delivery-client-controls { display: grid; grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(160px, .7fr)); gap: 14px; padding: 20px 20px 8px; }
.delivery-client-controls label { margin: 0; }
.delivery-client-controls input, .delivery-client-controls select { width: 100%; height: 43px; margin-top: 7px; }
.delivery-client-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.delivery-client-list { display: grid; }
.delivery-client-row { min-width: 0; display: grid; grid-template-columns: minmax(190px, .85fr) minmax(300px, 1.55fr) auto; align-items: center; gap: 18px; padding: 13px 20px 13px 16px; border-bottom: 1px solid var(--line); border-left: 5px solid var(--line); }
.delivery-client-row:last-child { border-bottom: 0; }
.delivery-client-row.is-verified { border-left-color: var(--ok-color); }
.delivery-client-row.is-pending, .delivery-client-row.is-changed { border-left-color: var(--review-color); }
.delivery-client-row.is-changed { background: color-mix(in srgb, var(--review-color) 7%, var(--surface)); }
.delivery-client-identity, .delivery-client-addresses { min-width: 0; }
.delivery-client-identity strong, .delivery-client-identity small, .delivery-client-addresses span, .delivery-client-addresses small { display: block; }
.delivery-client-identity strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-client-identity small, .delivery-client-addresses small { margin-top: 5px; color: var(--text-muted); font-size: 9px; line-height: 1.35; }
.delivery-client-addresses span { color: var(--ink); font-size: 10px; line-height: 1.4; }
.delivery-client-actions { display: grid; justify-items: end; gap: 7px; }
.delivery-client-actions a { color: var(--ok-color); font-size: 9px; font-weight: 700; text-decoration: none; }
.delivery-client-actions a:hover { text-decoration: underline; }
.delivery-client-state { min-height: 0; padding: 6px 9px; border: 0; border-radius: 999px; font-size: 8px; font-weight: 700; }
.delivery-client-state:hover { transform: none; filter: none; }
.delivery-client-state.is-verified { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.delivery-client-state.is-review { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, transparent); }
.supplier-note-form { display: grid; gap: 16px; padding: 0 20px 20px; }
.supplier-note-dropzone { min-height: 210px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 28px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--text-muted); background: var(--surface-soft); text-align: center; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.supplier-note-dropzone:hover, .supplier-note-dropzone.is-dragging { border-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 10%, var(--surface)); }
.supplier-note-dropzone.has-file { border-style: solid; border-color: var(--ok-color); }
.supplier-note-dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.supplier-note-drop-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; color: var(--charcoal); background: var(--yellow); font-size: 28px; }
.supplier-note-dropzone strong { color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 23px; font-weight: 400; }
.supplier-note-dropzone small { font-size: 11px; }
.supplier-note-form > button { justify-self: end; }
.supplier-note-result { display: grid; gap: 18px; margin-top: 18px; }
.supplier-note-token-metrics { margin: 0; }
.supplier-note-model { overflow-wrap: anywhere; font-size: 18px !important; }
.supplier-note-header { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0 20px 18px; overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--radius) - 5px); background: var(--line); }
.supplier-note-header div { min-width: 0; padding: 13px 15px; background: var(--surface); }
.supplier-note-header span, .supplier-note-header strong { display: block; }
.supplier-note-header span { margin-bottom: 5px; color: var(--text-muted); font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.supplier-note-header strong { overflow-wrap: anywhere; font-size: 12px; }
.supplier-note-table { min-width: 1000px; }
.supplier-note-table td { font-size: 10px; }
.supplier-note-warnings { margin: 18px 20px 20px; padding: 15px 17px; border-left: 4px solid var(--warning-color); border-radius: var(--button-radius); background: color-mix(in srgb, var(--warning-color) 13%, var(--surface)); }
.supplier-note-warnings strong { font-size: 12px; }
.supplier-note-warnings ul { margin: 10px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.dashboard-trend-row { width: 100%; min-height: 0; display: grid; grid-template-columns: minmax(105px, .8fr) minmax(110px, 1.2fr) 54px; align-items: center; gap: 10px; padding: 7px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.dashboard-trend-name { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-trend-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.dashboard-trend-fill { display: block; height: 100%; border-radius: inherit; background: var(--ok-color); }
.dashboard-trend-fill.is-falling { background: var(--review-color); }
.dashboard-trend-value { color: var(--ok-color); font-size: 10px; text-align: right; }
.dashboard-trend-value.is-falling { color: var(--review-color); }
.dashboard-urgent-block { margin: 0 24px 24px; }
.dashboard-urgent-row { width: 100%; min-height: 0; display: grid; grid-template-columns: minmax(160px, .8fr) minmax(180px, 1fr) auto; align-items: center; gap: 14px; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.dashboard-urgent-days { color: var(--review-color); font-size: 11px; text-align: right; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.auth-shell { width: min(940px, 100%); min-height: 590px; display: grid; grid-template-columns: .9fr 1.1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: 0 24px 65px rgba(33,37,41,.12); }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: var(--white); background: var(--charcoal); }
.auth-brand img { width: 180px; height: auto; object-fit: contain; }
.auth-brand h1 { margin-top: 18px; color: var(--white); font-size: 34px; }
.auth-brand p { max-width: 300px; color: rgba(255,255,255,.72); line-height: 1.55; }
.auth-card { align-self: center; padding: 54px clamp(28px, 6vw, 72px); }
.auth-card h2 { margin: 0; font-size: 30px; }
.auth-intro { margin: 9px 0 24px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.auth-error { margin-bottom: 16px; padding: 11px 12px; border-left: 4px solid var(--review-color); border-radius: 8px; color: var(--ink); background: color-mix(in srgb, var(--review-color) 9%, var(--surface)); font-size: 12px; }
.auth-success { margin-bottom: 16px; padding: 11px 12px; border-left: 4px solid var(--ok-color); border-radius: 8px; color: var(--ink); background: color-mix(in srgb, var(--ok-color) 9%, var(--surface)); font-size: 12px; }
.auth-form { display: grid; gap: 2px; }
.auth-form label { margin: 9px 0; }
.auth-form input,
.user-form-grid input[type=text],
.user-form-grid input[type=email],
.user-form-grid input[type=password] { width: 100%; height: 43px; display: block; margin-top: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: var(--field-bg); }
.auth-form input:focus,
.user-form-grid input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,206,34,.18); }
.auth-form small, .user-form-grid small { display: block; margin-top: 5px; color: var(--text-muted); font-size: 10px; }
.auth-form button { width: 100%; margin-top: 14px; }
.auth-recovery-link { display: block; margin-top: 18px; color: var(--ink); font-size: 11px; text-align: center; text-underline-offset: 3px; }

.account-panel { max-width: 860px; }
.account-view .account-panel.aina-usage-panel,
.account-view .account-panel.users-panel { width: min(1180px, 100%); max-width: 1180px; }
.account-view > .account-panel { margin-bottom: 0; }
.account-view > .account-panel + .account-panel { margin-top: 22px; }
.account-collapsible > summary { list-style: none; cursor: pointer; }
.account-collapsible > summary::-webkit-details-marker { display: none; }
.account-collapsible > summary::after {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: '';
  transform: rotate(45deg) translateY(-3px);
  transition: transform .18s ease;
}
.account-collapsible[open] > summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.account-collapsible > summary:hover,
.account-collapsible > summary:focus-visible { background: color-mix(in srgb, var(--section-header-bg) 92%, var(--module-hover-border)); }
.account-collapsible > summary:focus-visible { outline: 3px solid var(--module-hover-border); outline-offset: -3px; }
.profile-avatar { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 3px solid var(--profile-border); border-radius: 50%; color: var(--charcoal); background: var(--yellow-soft); }
.profile-avatar-image, .profile-avatar-fallback { grid-area: 1 / 1; width: 100%; height: 100%; }
.profile-avatar-image { display: block; object-fit: cover; }
.profile-avatar-fallback { display: grid; place-items: center; font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; line-height: 1; }
.profile-avatar-sidebar { width: 38px; height: 38px; border-width: 2px; }
.profile-avatar-sidebar .profile-avatar-fallback { font-size: 15px; }
.profile-avatar-large { width: 118px; height: 118px; border-width: 5px; }
.profile-avatar-large .profile-avatar-fallback { font-size: 42px; }
.profile-avatar-table { width: 38px; height: 38px; border-width: 2px; }
.profile-avatar-table .profile-avatar-fallback { font-size: 14px; }
.profile-editor { display: grid; grid-template-columns: 118px minmax(0, 1fr); align-items: center; gap: 24px; padding: 22px 20px 24px; }
.profile-editor-fields { min-width: 0; display: grid; justify-items: start; gap: 12px; }
.profile-file-label { width: 100%; max-width: 480px; margin: 0; }
.profile-file-label input[type=file] { width: 100%; display: block; margin-top: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--field-bg); }
.profile-file-label input[type=file]::file-selector-button { min-height: 34px; margin-right: 10px; padding: 0 12px; border: 0; border-radius: var(--button-radius); color: var(--action-text); background: var(--action-bg); cursor: pointer; }
.profile-file-label small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 10px; }
.profile-editor .inline-status { width: 100%; margin: 0; }
.profile-editor .inline-status.is-error { border-left: 4px solid var(--review-color); color: var(--ink); background: color-mix(in srgb, var(--review-color) 10%, var(--surface)); }
.profile-actions { flex-wrap: wrap; }
.password-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 16px 14px; padding: 22px 20px 24px; }
.password-form label { min-width: 0; display: flex; flex-direction: column; gap: 8px; margin: 0; line-height: 1.35; }
.password-form input { width: 100%; height: 44px; display: block; margin: 0; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: var(--field-bg); }
.password-form input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,206,34,.18); }
.password-form small { display: block; margin-top: 5px; color: var(--text-muted); font-size: 10px; }
.password-form .inline-status { grid-column: 1 / -1; width: 100%; margin: 0; }
.password-form .inline-status.is-error { border-left: 4px solid var(--review-color); color: var(--ink); background: color-mix(in srgb, var(--review-color) 10%, var(--surface)); }
.password-form button { justify-self: start; }
.account-content { display: grid; justify-items: start; gap: 15px; padding: 22px 20px 24px; }
.account-guidance { width: 100%; padding: 17px; border-radius: 12px; background: var(--surface-soft); }
.account-guidance strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.account-guidance p { max-width: 650px; margin: 7px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.account-content .inline-status { width: 100%; margin: 0; }
.recovery-codes-result { width: 100%; padding: 18px; border: 1px solid var(--yellow); border-radius: 12px; background: var(--yellow-soft); color: var(--charcoal); }
.recovery-codes-result p { margin: 0 0 13px; font-size: 12px; }
.recovery-codes-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 15px; }
.recovery-codes-list code { padding: 9px; border: 1px solid rgba(33,37,41,.18); border-radius: 8px; background: var(--white); color: var(--charcoal); font-size: 13px; text-align: center; }

.users-panel .tablewrap { margin-bottom: 20px; }
.users-table td:first-child { display: grid; gap: 4px; }
.users-table td.user-identity { display: flex; align-items: center; gap: 10px; }
.user-identity-copy { min-width: 0; display: grid; gap: 4px; }
.users-table td:first-child strong { font-weight: 400; }
.users-table td:first-child small { color: var(--text-muted); }
.users-table td:last-child { width: 1%; text-align: right; white-space: nowrap; }
.user-actions { display: flex; justify-content: flex-end; gap: 7px; }
.user-state { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; }
.user-state.is-active { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.user-state.is-inactive { color: var(--text-muted); background: var(--surface-soft); }
.danger-action { border: 1px solid color-mix(in srgb, var(--review-color) 42%, var(--line)); color: var(--review-color); background: color-mix(in srgb, var(--review-color) 8%, var(--surface)); }
.danger-action:hover, .danger-action:focus-visible { color: var(--surface); background: var(--review-color); }
.danger-action:disabled { border-color: var(--line); color: var(--text-muted); background: var(--surface-soft); }
.aina-usage-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 20px 18px; }
.aina-usage-metrics article { min-width: 0; display: grid; gap: 7px; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--surface-soft); }
.aina-usage-metrics span { color: var(--text-muted); font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.aina-usage-metrics strong { overflow: hidden; color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 24px; font-weight: 400; text-overflow: ellipsis; }
.aina-usage-toolbar { display: flex; justify-content: flex-end; padding: 18px 20px 0; }
.aina-usage-panel .tablewrap { margin-bottom: 20px; }
.aina-usage-panel > .inline-status,
.users-panel > .inline-status { margin-top: 18px; }
.aina-usage-table td:first-child { display: grid; gap: 3px; }
.aina-usage-table td:first-child strong { font-weight: 400; }
.aina-usage-table td:first-child small { color: var(--text-muted); }
.aina-usage-table th:not(:first-child), .aina-usage-table td:not(:first-child) { text-align: right; }
.admin-confirm-dialog { width: min(570px, calc(100% - 32px)); }
.admin-confirm-body { padding: 22px 24px 8px; }
.admin-confirm-body p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
@media (max-width: 760px) {
  .aina-usage-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 16px; }
  .user-actions { align-items: stretch; flex-direction: column; }
  .user-actions button { width: 100%; }
  .account-view > .account-panel + .account-panel { margin-top: 16px; }
  .account-view .account-panel > .panel-head { align-items: stretch; }
  .account-view .account-panel > .panel-head > button { width: 100%; }
  .profile-editor, .password-form, .account-content { padding: 18px 16px 20px; }
  .aina-usage-toolbar { padding: 16px 16px 0; }
  .aina-usage-toolbar button { width: 100%; }
}
@media (max-width: 440px) {
  .aina-usage-metrics { grid-template-columns: 1fr; }
}
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; max-height: calc(100vh - 210px); overflow-y: auto; padding: 8px 24px 20px; }
.user-form-grid label { margin: 12px 0; }
.user-password-field, .permission-fieldset, .user-options, .form-status { grid-column: 1 / -1; }
.user-options { display: flex; gap: 24px; padding: 8px 0; }
.permission-fieldset { display: grid; gap: 10px; margin: 8px 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.permission-fieldset legend { padding: 0 6px; color: var(--ink); font-size: 11px; }
.permission-fieldset .check { margin: 0; }
.permission-fieldset small { display: inline; margin-left: 5px; }
.form-status { min-height: 18px; margin: 6px 0 0; color: var(--review-color); font-size: 11px; }
.user-share-dialog { width: min(650px, calc(100% - 32px)); }
.user-share-body { padding: 22px 24px 8px; }
.user-share-body label { display: block; color: var(--ink); font-size: 12px; }
.user-share-body textarea { width: 100%; margin-top: 8px; padding: 15px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: var(--field-bg); font: 13px/1.55 'Questrial', Arial, sans-serif; }
.user-share-body textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 20%, transparent); }
.user-share-body .inline-status { min-height: 18px; margin: 8px 0 0; }

button {
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: var(--button-radius);
  color: var(--action-text);
  background: var(--action-bg);
}
button:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.primary-action {
  min-height: 45px;
  padding: 0 20px;
  color: var(--primary-text);
  background: var(--primary-bg);
  box-shadow: 0 9px 24px rgba(245, 206, 34, .24);
}
.secondary-action { color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); }

.dev-alert {
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1px solid var(--yellow);
  border-radius: 13px;
  color: var(--charcoal);
  background: var(--dev-alert-bg);
  font-size: 12px;
}
.dev-alert strong { color: var(--charcoal); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; margin-bottom: 16px; }
.metric {
  position: relative;
  min-height: 96px;
  padding: 17px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.metric::after { content: ''; position: absolute; right: -22px; bottom: -36px; width: 90px; height: 90px; border-radius: 50%; background: rgba(245,206,34,.15); }
.metric p { margin: 0 0 10px; color: var(--text-muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.metric div { display: flex; align-items: baseline; gap: 9px; }
.metric strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 30px; font-weight: 400; line-height: 1; }
.metric span { color: var(--ink); font-size: 11px; }

.main-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.proposal-panel { background: var(--proposal-bg); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 19px 20px 15px; }
.panel-head-actions { display: flex; align-items: center; gap: 10px; }
.panel-head.compact { padding-bottom: 2px; }
.panel h2 { margin: 0; font-size: 22px; }
.panel-head p { margin: 5px 0 0; color: var(--text-muted); font-size: 12px; }
.readonly-pill { padding: 6px 9px; border-radius: 999px; color: var(--charcoal); background: var(--yellow-soft); font-size: 10px; white-space: nowrap; }

.inline-status { margin: 0 20px 14px; padding: 11px 12px; border-radius: 10px; color: var(--ink); background: var(--surface-soft); font-size: 12px; }
.inline-status.is-loading { color: var(--ink); }
.success-message { margin: 12px 20px 0; padding: 10px 12px; border-radius: 9px; color: var(--charcoal); background: var(--yellow-soft); font-size: 12px; }

.proposal-tools {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 15px;
}
.proposal-filters { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.compact-field { margin: 0; color: var(--text-muted); font-size: 10px; }
.compact-field select {
  min-width: 170px;
  height: 36px;
  display: block;
  margin-top: 6px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: var(--surface-soft);
}
.compact-field select:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,206,34,.18); }
.compact-field input[type=search] { min-width: 240px; height: 36px; display: block; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: var(--surface-soft); }
.compact-field input[type=search]:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,206,34,.18); }
.supplier-filter-field { position: relative; }
.supplier-filter-dropdown { position: relative; min-width: clamp(250px, 32vw, 500px); margin-top: 6px; color: var(--ink); }
.supplier-filter-dropdown summary {
  height: 36px;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--surface-soft);
  cursor: pointer;
  list-style: none;
}
.supplier-filter-dropdown summary::-webkit-details-marker { display: none; }
.supplier-filter-dropdown summary::after { content: '⌄'; font-size: 14px; line-height: 1; transition: transform .18s ease; }
.supplier-filter-dropdown[open] summary { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,206,34,.18); }
.supplier-filter-dropdown[open] summary::after { transform: rotate(180deg); }
.supplier-filter-dropdown.is-disabled { opacity: .58; pointer-events: none; }
.supplier-filter-menu { position: absolute; z-index: 30; top: calc(100% + 5px); left: 0; width: 100%; max-height: 290px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 14px 32px rgba(33,37,41,.14); }
.supplier-filter-option { width: 100%; min-height: 35px; display: grid; grid-template-columns: 7px minmax(0,1fr); align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; color: var(--ink); background: transparent; font-size: 11px; text-align: left; }
.supplier-filter-option:hover:not(:disabled), .supplier-filter-option.is-selected { filter: none; transform: none; background: var(--surface-soft); }
.supplier-filter-dot { width: 7px; height: 7px; display: block; border-radius: 50%; box-shadow: none; opacity: 1; }
.supplier-filter-dot.is-review { background: var(--review-color); }
.supplier-filter-dot.is-ok { background: var(--ok-color); }
.supplier-filter-dot.is-neutral { visibility: hidden; }
.proposal-actions { flex-wrap: wrap; }
.proposal-actions button { white-space: nowrap; }
.print-heading { display: none; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 10px; color: var(--table-text); background: var(--table-bg); font-size: 10px; letter-spacing: .035em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid rgba(33, 37, 41, .12); vertical-align: middle; }
tbody tr:nth-child(even) { background: var(--surface-soft); }
.supplier-group td { padding: 0; color: var(--ink); background: var(--supplier-bg); text-align: left !important; }
.supplier-header { position: relative; min-height: 48px; overflow: hidden; background: var(--supplier-bg); }
.supplier-toggle {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto 22px;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.supplier-toggle:hover:not(:disabled) { filter: none; transform: none; }
.supplier-group.is-open .supplier-header { background: var(--supplier-active-bg); }
.supplier-group .supplier-header:hover { background: var(--supplier-hover-bg); }
.supplier-header:hover .supplier-toggle:not(:disabled) { color: var(--charcoal); background: transparent; }
.supplier-group.is-open td { border-top: 1px solid var(--supplier-active-frame); border-right: 1px solid var(--supplier-active-frame); border-left: 1px solid var(--supplier-active-frame); }
.supplier-group.is-open td:first-child { border-radius: 10px 10px 0 0; }
.supplier-group.is-open .supplier-header { box-shadow: inset 0 1px 0 var(--supplier-active-frame); }
.supplier-header::before { content: ''; position: absolute; z-index: 2; top: 0; bottom: 0; left: 0; width: 5px; pointer-events: none; }
.supplier-group.has-review .supplier-header::before { background: var(--review-color); }
.supplier-group.all-ok .supplier-header::before { background: var(--ok-color); }
.supplier-order-links { margin: 0 36px 8px auto; }
.supplier-group strong { font-weight: 400; }
.supplier-group-summary { color: var(--text-muted); font-size: 10px; text-align: right; }
.supplier-header:hover .supplier-group-summary { color: var(--charcoal); }
.supplier-chevron { font-size: 18px; line-height: 1; text-align: center; transition: transform .18s ease; }
.supplier-group.is-open .supplier-chevron { transform: rotate(180deg); }
.product-row td:first-child { font-weight: 400; }
.product-row.needs-review { background: color-mix(in srgb, var(--review-color) 11%, transparent); }
.product-row.stock-ok { background: color-mix(in srgb, var(--ok-color) 10%, transparent); }
.product-row.needs-review td:first-child { box-shadow: inset 5px 0 0 var(--review-color); }
.product-row.stock-ok td:first-child { box-shadow: inset 5px 0 0 var(--ok-color); }
.product-row.needs-review td.proposal { background: color-mix(in srgb, var(--review-color) 18%, transparent); }
.product-row.stock-ok td.proposal { background: color-mix(in srgb, var(--ok-color) 16%, transparent); }
.product-row.active-supplier td:first-child { border-left: 1px solid var(--supplier-active-frame); }
.product-row.active-supplier td:last-child { border-right: 1px solid var(--supplier-active-frame); }
.product-row.last-active-item td { border-bottom: 1px solid var(--supplier-active-frame); }
.product-row.last-active-item td:first-child { border-radius: 0 0 0 10px; }
.product-row.last-active-item td:last-child { border-radius: 0 0 10px 0; }
.proposal-tablewrap table { min-width: 940px; }
#tabla th:nth-child(n+2), #tabla td:nth-child(n+2) { text-align: right; }
td.proposal { color: var(--charcoal); background: var(--proposal-cell-bg); font-weight: 700; white-space: nowrap; }
.empty { padding: 34px; color: var(--text-muted); text-align: center !important; }
.manual-quantity { width: 90px; height: 35px; display: block; margin: 0 0 0 auto; padding: 0 9px; border: 1.5px solid var(--yellow); border-radius: 9px; outline: 0; color: var(--ink); background: var(--manual-field-bg); text-align: right; }
.manual-quantity:focus { box-shadow: 0 0 0 3px rgba(245,206,34,.25); }
.order-created-info, .supplier-order-links { width: fit-content; max-width: 100%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; padding: 4px 8px; border: 1px solid var(--pending-order-color); border-radius: 999px; color: var(--pending-order-color); background: color-mix(in srgb, var(--pending-order-color) 9%, var(--surface)); font-size: 10px; font-weight: 700; white-space: nowrap; text-align: right; }
.order-created-info { margin: 6px 0 0 auto; }
.order-created-info[hidden], .supplier-order-links[hidden] { display: none; }
.order-created-info .order-link, .supplier-order-links .order-link { color: var(--pending-order-color); }
.order-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ok-color); text-decoration: none; }
.order-link-check { color: var(--ok-color); font-weight: 800; }
.order-link:hover { text-decoration: underline; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; color: var(--text-muted); font-size: 11px; }
.panel-foot strong { color: var(--ink); font-weight: 400; }
.order-creation { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: var(--order-area-bg); }
.order-creation p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.order-creation button { min-width: 210px; }
.order-creation button:disabled { color: var(--text-muted); background: var(--surface); border: 1px solid var(--line); }

.calculation-panel { order: -1; padding-bottom: 20px; background: var(--calculation-bg); }
.calculation-panel form { display: grid; grid-template-columns: 1.25fr .55fr 1.7fr auto; align-items: end; gap: 14px; padding: 0 20px; }
label { display: block; margin: 15px 0; color: var(--ink); font-size: 11px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type=number] { width: 100%; height: 41px; display: block; margin-top: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: var(--field-bg); font-size: 14px; }
input[type=number]:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,206,34,.18); }
input[type=number].manual-quantity { color: var(--charcoal); background: var(--manual-field-bg); }
.check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; margin: 15px 0; }
.check { display: flex; align-items: flex-start; gap: 9px; margin: 0; color: var(--ink); line-height: 1.35; }
.check input { width: 15px; height: 15px; margin: 0; accent-color: var(--yellow); }
.save-action { min-width: 180px; margin-bottom: 15px; }

.categories-panel, .providers-panel, .odoo-panel { margin-top: 0; }
.button-group { display: flex; gap: 8px; flex-wrap: wrap; }
.categorias-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 8px; max-height: 260px; overflow: auto; margin: 0 20px 20px; padding: 14px; border-radius: 12px; background: var(--surface-soft); }
.categoria-option { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 9px; border: 1px solid transparent; border-radius: 9px; color: var(--ink); line-height: 1.25; }
.categoria-option:hover { border-color: var(--yellow); color: var(--charcoal); background: var(--yellow-soft); }
.categoria-option input { margin: 1px 0 0; accent-color: var(--yellow); }
.providers-panel .tablewrap { margin-bottom: 6px; }
.providers-panel table { min-width: 800px; }
.frequency-panel { overflow: hidden; }
.frequency-tools { padding-top: 16px; }
.frequency-company-table { overflow-x: visible; }
.frequency-company-table table { min-width: 0; table-layout: fixed; font-size: clamp(8px, .72vw, 11px); }
.frequency-company-table th,
.frequency-company-table td { padding: 10px 5px; overflow-wrap: anywhere; word-break: normal; }
.frequency-company-table th { white-space: normal; line-height: 1.2; }
.frequency-sort-button { width: 100%; min-height: 0; display: inline-flex; align-items: center; justify-content: flex-start; gap: 5px; padding: 0; border: 0; border-radius: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; line-height: inherit; text-align: left; text-transform: inherit; }
.frequency-sort-button::after { width: 10px; flex: 0 0 10px; color: color-mix(in srgb, var(--table-text) 55%, transparent); content: '↕'; font-size: 10px; }
.frequency-sort-button[data-direction="asc"]::after { color: var(--table-text); content: '↑'; }
.frequency-sort-button[data-direction="desc"]::after { color: var(--table-text); content: '↓'; }
.frequency-sort-button:hover { color: var(--table-text); background: transparent; transform: none; filter: none; }
.frequency-sort-button:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
.frequency-state { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; white-space: nowrap; }
.frequency-state.is-retrasado { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, transparent); }
.frequency-state.is-proximo { color: var(--charcoal); background: var(--yellow-soft); }
.frequency-state.is-en_plazo { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.frequency-state.is-sin_datos { color: var(--text-muted); background: var(--surface-soft); }
.frequency-groups { display: grid; gap: 10px; padding: 0 20px 20px; }
.frequency-groups[hidden] { display: none; }
.frequency-groups-empty { padding: 30px 12px; }
.frequency-company { overflow: hidden; border: 1px solid var(--line); border-left: 5px solid var(--ok-color); border-radius: 12px; background: var(--surface); }
.frequency-company.has-alert { border-left-color: var(--review-color); }
.frequency-company.has-warning { border-left-color: var(--yellow); }
.frequency-company > summary { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: center; gap: 18px; padding: 14px 16px; cursor: pointer; list-style: none; color: var(--ink); }
.frequency-company > summary::-webkit-details-marker { display: none; }
.frequency-company > summary::before { content: '›'; grid-column: 1; grid-row: 1; width: 16px; transform: translateX(-7px); color: var(--text-muted); font-size: 20px; transition: transform .15s ease; }
.frequency-company[open] > summary::before { transform: translateX(-7px) rotate(90deg); }
.frequency-company > summary > strong { grid-column: 1; grid-row: 1; padding-left: 17px; }
.frequency-company > summary:hover { background: var(--surface-soft); }
.frequency-company[open] > summary { border-bottom: 1px solid var(--line); }
.frequency-group-alert { min-width: 92px; text-align: right; font-weight: 700; color: var(--ok-color); }
.has-alert > summary .frequency-group-alert { color: var(--review-color); }
.has-warning > summary .frequency-group-alert { color: var(--charcoal); }
.frequency-company-table th:nth-child(1) { width: 24%; }
.frequency-company-table th:nth-child(2) { width: 6%; }
.frequency-company-table th:nth-child(3) { width: 10%; }
.frequency-company-table th:nth-child(4) { width: 10%; }
.frequency-company-table th:nth-child(5) { width: 12%; }
.frequency-company-table th:nth-child(6) { width: 10%; }
.frequency-company-table th:nth-child(7) { width: 10%; }
.frequency-company-table th:nth-child(8) { width: 10%; }
.frequency-company-table th:nth-child(9) { width: 8%; }
.frequency-product-retrasado td { background: color-mix(in srgb, var(--review-color) 10%, var(--surface)); }
.frequency-product-proximo td { background: color-mix(in srgb, var(--yellow) 15%, var(--surface)); }
.frequency-product-en_plazo td { background: color-mix(in srgb, var(--ok-color) 9%, var(--surface)); }
.frequency-product-sin_datos td { background: var(--surface); }
.frequency-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 20px 20px; }
.frequency-pagination button { width: 38px; min-height: 34px; padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--surface-soft); font-size: 19px; }
.frequency-pagination button:disabled { cursor: default; opacity: .38; }
.frequency-page-count { min-width: 210px; color: var(--text-muted); font-size: 11px; text-align: center; }
.frequency-report-dialog { width: min(760px, calc(100% - 32px)); }
.frequency-report-body { max-height: calc(100vh - 220px); overflow-y: auto; padding: 18px 24px 8px; }
.frequency-report-section { margin: 0 0 17px; }
.frequency-report-section h3 { margin: 0 0 8px; color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 17px; font-weight: 400; }
.frequency-report-box { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.frequency-report-choices .check + .check { margin-top: 9px; }
.frequency-report-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 16px; margin-top: 12px; }
.frequency-report-statuses { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0; }
.frequency-report-body .inline-status { margin: 4px 0 10px; }

.odoo-panel { border-top: 4px solid var(--yellow); }
.odoo-details { display: grid; grid-template-columns: .7fr 2fr repeat(3, 1fr); gap: 18px; margin: 4px 20px 16px; }
.odoo-details div { min-width: 0; }
.odoo-details dt { color: var(--text-muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.odoo-details dd { margin: 7px 0 0; overflow-wrap: anywhere; font-size: 13px; }
.odoo-url { min-width: 180px; }

.appearance-dialog {
  width: min(920px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(33,37,41,.28);
}
.appearance-dialog::backdrop { background: rgba(33,37,41,.72); }
.appearance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 24px 16px; border-bottom: 1px solid var(--line); }
.appearance-head h2 { margin: 0; font-size: 27px; }
.appearance-head p:last-child { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; }
.dialog-close { width: 38px; min-height: 38px; padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--surface-soft); font-size: 24px; }
.appearance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; max-height: calc(100vh - 210px); overflow-y: auto; padding: 8px 24px 16px; }
.appearance-grid label { margin: 12px 0; }
.appearance-grid select { width: 100%; height: 42px; display: block; margin-top: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-soft); }
.appearance-section { grid-column: 1 / -1; margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.appearance-section-head h3 { margin: 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 19px; font-weight: 400; }
.appearance-section-head p { margin: 5px 0 0; color: var(--text-muted); font-size: 11px; }
.appearance-color-grid { display: grid; grid-template-columns: repeat(4,minmax(120px,1fr)); gap: 10px 12px; margin-top: 12px; }
.appearance-color-grid label { margin: 0; }
.appearance-color-grid input[type=color] { width: 100%; height: 38px; display: block; margin-top: 6px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
.appearance-preview-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.appearance-preview-row input[type=number] { width: 100px; margin: 0; }
.appearance-status-ok, .appearance-status-warning, .appearance-status-review { padding: 8px 10px; border-radius: var(--button-radius); font-size: 11px; }
.appearance-status-ok { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.appearance-status-warning { color: var(--charcoal); background: color-mix(in srgb, var(--warning-color) 35%, transparent); }
.appearance-status-review { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, transparent); }
.appearance-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px 22px; border-top: 1px solid var(--line); }
.appearance-save-status { align-self: center; margin-right: auto; color: var(--text-muted); font-size: 11px; }

:root[data-density="compact"] .workspace { padding: 20px 22px 30px; }
:root[data-density="compact"] .metric { min-height: 78px; padding-block: 13px; }
:root[data-density="compact"] .panel-head { padding-block: 14px 11px; }
:root[data-density="compact"] td { padding-block: 9px; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 214px minmax(0,1fr); }
  .sidebar { padding-inline: 16px; }
  .brand img { width: 116px; height: auto; }
  .calculation-panel form { grid-template-columns: 1fr 1fr; }
  .check-list { align-self: center; }
  .save-action { width: 100%; }
  .odoo-details { grid-template-columns: repeat(3,1fr); }
  .odoo-url { grid-column: span 2; }
  .module-dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-dashboard-body { grid-template-columns: 1fr; }
  .delivery-workspace { grid-template-columns: 1fr; }
  .delivery-map { min-height: 520px; }
}

@media (max-width: 760px) {
  .app-shell { width: 100%; min-height: 100vh; display: block; margin: 0; border: 0; border-radius: 0; }
  .sidebar { position: static; width: 100%; height: auto; display: block; padding: 12px 15px; border-radius: 0; }
  .brand { width: 150px; min-height: 68px; margin: 0 auto; }
  .brand img { width: 112px; }
  .sidebar nav { margin-top: 10px; }
  .sidebar-identity { margin-top: 8px; }
  .workspace { padding: 22px 15px 32px; }
  .page-header { align-items: flex-end; }
  .module-page-header { align-items: stretch; flex-direction: column; }
  .module-view-selector { width: 100%; min-width: 0; }
  .page-subtitle { max-width: 420px; }
  .primary-action { padding: 0 13px; }
  .metrics { grid-template-columns: 1fr; }
  .module-dashboard-grid { gap: 16px; }
  .module-dashboard-heading { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 18px 17px 15px; }
  .module-dashboard-icon { width: 48px; height: 48px; border-radius: 14px; }
  .module-dashboard-icon svg { width: 25px; height: 25px; }
  .module-dashboard-title h2 { font-size: 24px; }
  .module-dashboard-heading-actions { width: 100%; grid-column: 1 / -1; }
  .module-access-state { grid-column: 2; justify-self: start; }
  .module-dashboard-status { padding-inline: 17px; }
  .module-dashboard-kpis { gap: 9px; padding: 15px 17px; }
  .module-dashboard-body { padding: 0 17px 17px; }
  .dashboard-urgent-block { margin: 0 17px 17px; }
  .dashboard-urgent-row { grid-template-columns: 1fr auto; }
  .dashboard-urgent-row .dashboard-urgent-product { grid-column: 1; }
  .dashboard-urgent-days { grid-column: 2; grid-row: 1 / span 2; }
  .panel-head { flex-direction: column; }
  .panel-head-actions { width: 100%; justify-content: space-between; }
  .proposal-tools { align-items: stretch; flex-direction: column; }
  .proposal-filters { align-items: stretch; flex-direction: column; }
  .compact-field select { width: 100%; }
  .compact-field input[type=search] { width: 100%; min-width: 0; }
  .frequency-company > summary { grid-template-columns: 1fr auto; gap: 5px 10px; }
  .frequency-company > summary > strong { grid-column: 1; }
  .frequency-company > summary > span:not(.frequency-group-alert) { grid-column: 1; padding-left: 17px; }
  .frequency-group-alert { grid-column: 2; grid-row: 1 / span 2; }
  .frequency-company-table table,
  .frequency-company-table tbody,
  .frequency-company-table tr,
  .frequency-company-table td { display: block; width: 100%; }
  .frequency-company-table thead { display: none; }
  .frequency-company-table tr { overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .frequency-company-table td { min-height: 36px; display: grid; grid-template-columns: minmax(112px, 42%) minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 11px; }
  .frequency-company-table td:last-child { border-bottom: 0; }
  .frequency-company-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
  .frequency-state { justify-self: start; }
  .frequency-report-options,
  .frequency-report-statuses { grid-template-columns: 1fr; }
  .supplier-filter-dropdown { width: 100%; min-width: 0; }
  .proposal-actions button { flex: 1; }
  .calculation-panel form { grid-template-columns: 1fr; }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
  .check-list { grid-template-columns: 1fr; }
  .save-action { margin-bottom: 0; }
  .panel-foot { align-items: flex-start; flex-direction: column; }
  .order-creation { align-items: stretch; flex-direction: column; }
  .order-creation button { width: 100%; }
  .odoo-details { grid-template-columns: 1fr 1fr; }
  .odoo-url { grid-column: span 2; }
  .appearance-grid { grid-template-columns: 1fr; }
  .appearance-color-grid { grid-template-columns: 1fr 1fr; }
  .appearance-actions { flex-wrap: wrap; }
  .appearance-save-status { width: 100%; }
  .auth-page { padding: 0; }
  .auth-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .auth-brand { min-height: 230px; padding: 30px; }
  .auth-brand img { width: 145px; }
  .auth-brand h1 { font-size: 28px; }
  .auth-card { padding: 34px 24px; }
  .user-form-grid { grid-template-columns: 1fr; }
  .user-password-field, .permission-fieldset, .user-options, .form-status { grid-column: auto; }
  .recovery-codes-list { grid-template-columns: 1fr 1fr; }
  .profile-editor { grid-template-columns: 1fr; justify-items: center; }
  .profile-editor-fields { width: 100%; justify-items: stretch; }
  .profile-actions button { flex: 1; }
  .password-form { grid-template-columns: 1fr; }
  .password-form .inline-status { grid-column: auto; }
  .password-form button { width: 100%; }
  .delivery-controls { grid-template-columns: 1fr; }
  .delivery-controls button { width: 100%; }
  .delivery-metrics { grid-template-columns: 1fr 1fr; }
  .delivery-route-list { max-height: none; }
  .delivery-map { min-height: 430px; }
  .delivery-stop { grid-template-columns: 20px 34px minmax(0, 1fr); }
  .delivery-stop-actions { grid-column: 3; justify-items: start; }
  .delivery-proof { justify-content: flex-start; }
  .delivery-client-controls { grid-template-columns: 1fr 1fr; }
  .delivery-client-metrics { grid-template-columns: 1fr 1fr; }
  .delivery-client-row { grid-template-columns: 1fr; gap: 9px; }
  .delivery-client-actions { justify-items: start; }
  .delivery-location-change dl { grid-template-columns: 1fr; }
  .delivery-location-address-options { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .module-dashboard-kpis { grid-template-columns: 1fr; }
  .module-dashboard:not(.is-expanded) .module-dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-priority-row { grid-template-columns: 5px minmax(0, 1fr) auto; }
  .dashboard-priority-state { grid-column: 2 / -1; justify-self: start; }
  .dashboard-trend-row { grid-template-columns: minmax(90px, .85fr) minmax(70px, 1fr) 47px; gap: 7px; padding-inline: 11px; }
  .dashboard-urgent-row { grid-template-columns: 1fr; }
  .dashboard-urgent-days { grid-column: 1; grid-row: auto; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@page { size: A4 landscape; margin: 10mm; }
@media print {
  body { background: #FFFFFF; }
  body.print-proposal .app-shell { width: 100%; min-height: 0; display: block; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  body.print-proposal .sidebar,
  body.print-proposal .page-header,
  body.print-proposal .dev-alert,
  body.print-proposal .metrics,
  body.print-proposal .calculation-panel,
  body.print-proposal .categories-panel,
  body.print-proposal .providers-panel,
  body.print-proposal .odoo-panel,
  body.print-proposal .proposal-panel > .panel-head,
  body.print-proposal .proposal-tools,
  body.print-proposal .inline-status,
  body.print-proposal .panel-foot,
  body.print-proposal .order-creation { display: none !important; }
  body.print-proposal .workspace { padding: 0; }
  body.print-proposal .main-grid { display: block; }
  body.print-proposal .proposal-panel { border: 0; border-radius: 0; }
  body.print-proposal .print-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 8mm; }
  body.print-proposal .print-heading img { width: 34mm; height: auto; }
  body.print-proposal .print-heading h2 { margin: 0; font-size: 21pt; }
  body.print-proposal .print-heading p { margin: 2mm 0 0; color: var(--charcoal); font-size: 9pt; }
  body.print-proposal .proposal-tablewrap { overflow: visible; }
  body.print-proposal .proposal-tablewrap table { min-width: 0; font-size: 7pt; }
  body.print-proposal th { padding: 2.2mm 1.5mm; font-size: 6.5pt; }
  body.print-proposal td { padding: 2mm 1.5mm; }
  body.print-proposal .supplier-group td { display: table-cell; }
  body.print-proposal .supplier-toggle { min-height: 0; display: flex; justify-content: space-between; padding: 2mm; color: var(--charcoal); background: var(--ivory); }
  body.print-proposal .supplier-chevron { display: none; }
  body.print-proposal .manual-quantity { width: 18mm; height: 7mm; padding: 0 1mm; border-color: var(--charcoal); box-shadow: none; font-size: 7pt; }
}

/* Navegación superior y espacio de trabajo a ancho completo */
:root[data-sidebar="ivory"] {
  --topbar-bg: var(--ivory);
  --topbar-text: var(--charcoal);
  --topbar-icon: var(--charcoal);
}
.app-shell {
  --topbar-height: 82px;
  width: 100%;
  min-height: 100vh;
  display: block;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  width: 100%;
  min-height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--topbar-text) 16%, transparent);
  border-radius: 0;
  color: var(--topbar-text);
  background: var(--topbar-bg);
  box-shadow: 0 4px 16px rgba(33,37,41,.08);
}
.topbar .brand {
  width: fit-content;
  min-height: 60px;
  justify-content: flex-start;
  padding: 0;
}
.topbar .brand img { width: 128px; height: 59px; }
.topbar-navigation { display: flex; align-items: center; justify-content: center; gap: 13px; }
.topbar-icon,
.topbar-profile,
.topbar-signout {
  border: 0;
  color: var(--topbar-icon);
  background: transparent;
  box-shadow: none;
}
.topbar-icon {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
}
.topbar-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar-action-icon { width: 25px; height: 25px; display: block; background: currentColor; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; transition: background-color .15s ease; }
.topbar-action-icon-system { -webkit-mask-image: url('/static/icon-system.png'); mask-image: url('/static/icon-system.png'); }
.topbar-action-icon-signout { -webkit-mask-image: url('/static/icon-signout.png'); mask-image: url('/static/icon-signout.png'); }
.topbar-icon:hover:not(:disabled),
.topbar-icon[aria-expanded="true"] { color: var(--topbar-active); background: transparent; transform: none; filter: none; }
.topbar-icon:focus-visible,
.topbar-profile:focus-visible,
.topbar-signout:focus-visible { outline: 2px solid var(--topbar-active); outline-offset: -3px; }
.topbar-icon:disabled { cursor: default; opacity: .38; }
.connection-dot { position: absolute; right: 7px; bottom: 7px; width: 9px; height: 9px; border: 2px solid var(--topbar-bg); border-radius: 50%; background: var(--warning-color); }
.odoo-indicator.is-connected .connection-dot { background: var(--ok-color); }
.odoo-indicator.is-disconnected .connection-dot { background: var(--review-color); }
.odoo-indicator.is-checking .connection-dot { background: var(--warning-color); }
.odoo-indicator:disabled { opacity: 1; }
.topbar-user { justify-self: end; display: flex; align-items: center; gap: 10px; }
.topbar-user form { margin: 0; }
.topbar-signout { width: 46px; min-width: 46px; height: 46px; min-height: 46px; display: grid; place-items: center; padding: 0; border-radius: 50%; }
.topbar-signout:hover { color: var(--topbar-active); background: transparent; transform: none; filter: none; }
.topbar-profile { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border-radius: 50%; }
.topbar-profile:hover { background: transparent; transform: none; filter: none; }
.profile-avatar-topbar { width: 42px; height: 42px; }
.topbar-menu-layer { position: sticky; top: var(--topbar-height); z-index: 70; height: 0; }
.topbar-menu-panel {
  position: absolute;
  top: 8px;
  left: 50%;
  width: min(720px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--topbar-menu-bg);
  box-shadow: 0 18px 45px rgba(33,37,41,.2);
  transform: translateX(-50%);
}
.topbar-menu-panel button {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
}
.topbar-menu-panel button:hover { border-color: var(--topbar-active); color: var(--ink); background: color-mix(in srgb, var(--topbar-active) 12%, var(--surface)); transform: none; filter: none; }
.topbar-menu-panel button span { font-size: 13px; }
.topbar-menu-panel button small { color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.workspace { width: min(1800px, 100%); min-width: 0; margin: 0 auto; padding: 30px clamp(18px, 3vw, 46px) 46px; }
.main-grid { grid-template-columns: 1fr; }

/* Navegación dentro del módulo de pedidos */
.module-local-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: calc(var(--button-radius) + 4px); background: var(--surface); box-shadow: 0 7px 20px rgba(33,37,41,.06); }
.module-local-nav-item { min-height: 44px; padding: 0 14px; border: 1px solid transparent; color: var(--ink); background: transparent; box-shadow: none; }
.module-local-nav-item:hover:not(:disabled) { border-color: var(--module-hover-border); color: var(--ink); background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface)); filter: none; transform: none; }
.module-local-nav-item.is-active { color: var(--primary-text); background: var(--primary-bg); }
.module-local-nav-item:focus-visible { outline: 2px solid var(--module-hover-border); outline-offset: 1px; }
.proposal-head-actions { flex-wrap: wrap; justify-content: flex-end; }
.proposal-head-actions .module-local-nav { box-shadow: none; }
.proposal-head-actions .module-local-nav-item { min-height: 42px; }

/* Cabeceras globales editables desde Atomic Design */
.module-dashboard-heading,
.module-dashboard-block-head {
  color: var(--section-header-text);
  background: var(--section-header-bg);
}
.module-dashboard-heading .eyebrow,
.module-dashboard-heading p,
.module-dashboard-block-head p { color: color-mix(in srgb, var(--section-header-text) 70%, transparent); }
.module-dashboard-block-head { margin: -1px -1px 0; padding: 13px 15px; border-radius: 12px 12px 0 0; }

/* Reglas de cálculo por proveedor */
.supplier-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.supplier-toggle { grid-template-columns: minmax(180px, 1fr) auto 22px; }
.supplier-settings {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
}
.supplier-settings svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.supplier-settings:hover { color: var(--charcoal); background: color-mix(in srgb, var(--yellow) 45%, transparent); transform: none; filter: none; }
.supplier-settings:disabled { visibility: hidden; }
.supplier-order-links { grid-column: 1 / -1; }
.supplier-group.has-warning .supplier-header::before { background: var(--warning-color); }
.product-row.status-warning td { background: color-mix(in srgb, var(--warning-color) 12%, var(--surface)); }
.product-row.status-warning td:first-child { box-shadow: inset 5px 0 0 var(--warning-color); }
.product-row.status-warning td.proposal { background: color-mix(in srgb, var(--warning-color) 22%, var(--surface)); }
.supplier-filter-dot.is-warning { background: var(--warning-color); }
.supplier-rule-dialog { width: min(720px, calc(100% - 30px)); }
.supplier-rule-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 22px 24px; background: var(--calculation-bg); }
.supplier-rule-body label { display: grid; align-content: start; gap: 7px; font-size: 12px; }
.supplier-rule-body input { width: 100%; }
.supplier-rule-body small { color: var(--text-muted); font-size: 10px; line-height: 1.4; }
.supplier-rule-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.rule-state { padding: 7px 10px; border-radius: 999px; font-size: 10px; }
.rule-state.is-review { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, transparent); }
.rule-state.is-warning { color: var(--charcoal); background: color-mix(in srgb, var(--warning-color) 35%, transparent); }
.rule-state.is-ok { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.supplier-rule-body .inline-status { grid-column: 1 / -1; }

/* Editor Atomic Design agrupado */
.appearance-control-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px 12px; margin-top: 12px; }
.appearance-control-grid label { margin: 0; }
.appearance-component-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.appearance-component-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.appearance-component-card h4 { margin: 0 0 10px; font-family: 'DM Serif Display', Georgia, serif; font-size: 16px; font-weight: 400; }
.appearance-component-card .appearance-color-grid { grid-template-columns: 1fr 1fr; margin-top: 0; }

@media (max-width: 760px) {
  .app-shell { --topbar-height: 68px; width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .topbar { min-height: var(--topbar-height); grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; padding: 6px 9px; border-radius: 0; }
  .topbar .brand { min-height: 52px; }
  .topbar .brand img { width: 96px; height: auto; }
  .topbar-navigation { gap: 2px; }
  .topbar-icon { width: 44px; height: 44px; }
  .topbar-icon svg { width: 21px; height: 21px; }
  .topbar-action-icon { width: 22px; height: 22px; }
  .topbar-signout { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .topbar-profile { width: 44px; height: 44px; }
  .profile-avatar-topbar { width: 38px; height: 38px; }
  .topbar-menu-layer { top: var(--topbar-height); }
  .topbar-menu-panel { top: 6px; width: calc(100vw - 18px); grid-template-columns: 1fr; }
  .workspace { padding: 22px 12px 34px; }
  .module-page-header { align-items: stretch; }
  .module-local-nav { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .module-local-nav-item { min-width: 0; padding-inline: 7px; font-size: 11px; }
  .proposal-head-actions { display: grid; grid-template-columns: 1fr; }
  .proposal-head-actions .primary-action { width: 100%; }
  .supplier-rule-body { grid-template-columns: 1fr; }
  .appearance-control-grid { grid-template-columns: 1fr 1fr; }
  .appearance-component-groups { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .topbar { grid-template-columns: minmax(72px, auto) minmax(44px, 1fr) auto; padding-inline: 6px; }
  .topbar .brand img { width: 76px; }
  .topbar-icon { width: 44px; height: 44px; }
  .topbar-icon svg { width: 20px; height: 20px; }
  .topbar-user { gap: 3px; }
  .appearance-control-grid { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .topbar-menu-layer { display: none !important; }
}

/* Dashboard · Frecuencia y evolución comercial */
.commercial-evolution-dashboard { min-width: 0; }
.commercial-evolution-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.commercial-evolution-settings {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--section-header-text);
  background: transparent;
}

/* Inicio · módulos compactos, máximo tres por fila */
.module-dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.module-dashboard { min-width: 0; }
.module-dashboard.is-expanded { grid-column: 1 / -1; }
.module-dashboard:not(.is-expanded) {
  height: 348px;
}
.module-dashboard:not(.is-expanded) .module-dashboard-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.module-dashboard.has-drag-handle .module-dashboard-heading {
  grid-template-columns: 32px 58px minmax(0, 1fr) auto;
}
.module-dashboard-drag-handle {
  z-index: 5;
  width: 32px;
  min-width: 32px;
  height: 38px;
  min-height: 38px;
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-auto-rows: 4px;
  place-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--section-header-text);
  background: transparent;
  cursor: grab;
  touch-action: none;
}
.module-dashboard-drag-handle:hover,
.module-dashboard-drag-handle:focus-visible { color: var(--section-header-text); background: color-mix(in srgb, var(--section-header-text) 13%, transparent); box-shadow: none; transform: none; }
.module-dashboard-drag-handle:active { cursor: grabbing; }
.module-dashboard-drag-handle span { width: 4px; height: 4px; display: block; border-radius: 50%; background: currentColor; }
.module-dashboard-placeholder { min-width: 0; border: 2px dashed var(--module-hover-border); border-radius: var(--radius); background: color-mix(in srgb, var(--module-hover-border) 8%, transparent); }
.module-dashboard.is-swap-target { outline: 3px solid var(--module-hover-border); outline-offset: 3px; }
.module-dashboard.is-reordering { z-index: 2000; box-shadow: 0 20px 50px rgba(33, 37, 41, .25); pointer-events: none; opacity: .97; }
.module-dashboard:not(.is-expanded) .module-dashboard-heading {
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 92px;
  padding: 14px 16px;
}
.module-dashboard.has-drag-handle:not(.is-expanded) .module-dashboard-heading {
  grid-template-columns: 32px 46px minmax(0, 1fr) auto;
}
.module-dashboard:not(.is-expanded) .module-dashboard-heading-actions { min-width: 0; }
.module-dashboard:not(.is-expanded) .module-access-state { max-width: 118px; white-space: normal; text-align: center; }
.module-dashboard:not(.is-expanded) .module-dashboard-title h2 { font-size: clamp(19px, 1.6vw, 25px); }
.module-dashboard:not(.is-expanded) .module-dashboard-kpis {
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(92px, 1fr);
  gap: 9px;
  padding: 12px 14px 15px;
}
.module-dashboard:not(.is-expanded) .module-dashboard-kpi { min-height: 92px; padding: 12px; }
.module-dashboard:not(.is-expanded) .module-dashboard-kpi span { min-height: 27px; }
.module-dashboard:not(.is-expanded) .module-dashboard-kpi strong { font-size: 24px; }

/* Edición de clientes · campos fluidos sin solapamientos */
.delivery-client-controls {
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  align-items: end;
}
.delivery-client-controls label,
.delivery-client-controls input,
.delivery-client-controls select { min-width: 0; }
.delivery-client-controls input,
.delivery-client-controls select { max-width: 100%; }
.delivery-client-row {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr) minmax(126px, .45fr);
}
.delivery-client-identity,
.delivery-client-addresses,
.delivery-client-actions { min-width: 0; overflow: hidden; }
.delivery-client-addresses span,
.delivery-client-addresses small { overflow-wrap: anywhere; }
.delivery-client-actions { width: 100%; }
.delivery-client-state { max-width: 100%; white-space: normal; text-align: center; }

@media (max-width: 1199px) {
  .module-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .module-dashboard-grid { grid-template-columns: 1fr; }
  .module-dashboard:not(.is-expanded) .module-dashboard-heading { grid-template-columns: 46px minmax(0, 1fr); }
  .module-dashboard.has-drag-handle:not(.is-expanded) .module-dashboard-heading { grid-template-columns: 32px 46px minmax(0, 1fr); }
  .module-dashboard:not(.is-expanded) .module-dashboard-heading-actions { grid-column: 1 / -1; }
  .delivery-client-controls { grid-template-columns: 1fr; }
  .delivery-client-row { grid-template-columns: 1fr; }
  .delivery-client-actions { justify-items: start; overflow: visible; }
}
.commercial-evolution-settings .topbar-action-icon { width: 23px; height: 23px; }

/* Simulador de facturación · solo lectura */
.billing-simulation-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.billing-simulation-panel { margin-top: 20px; }
.billing-simulation-tools { padding-top: 18px; padding-bottom: 18px; }
.billing-simulation-tools .proposal-filters { grid-template-columns: minmax(210px, .7fr) minmax(170px, .45fr) minmax(260px, 1fr); gap: 16px; }
.billing-search { min-width: 0; }
.billing-simulation-panel #billing-message { margin: 0 16px 16px; line-height: 1.5; }
.billing-simulation-list { display: grid; gap: 14px; padding: 0 16px 18px; }
.billing-client-group { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.billing-client-group > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; min-height: 74px; padding: 15px 20px; color: var(--section-header-text); background: var(--section-header-bg); cursor: pointer; }
.billing-client-group > summary::marker { color: var(--section-header-text); }
.billing-client-group > summary > div { min-width: 0; display: grid; gap: 6px; }
.billing-client-group > summary > div:last-child { justify-items: end; text-align: right; }
.billing-client-group > summary strong { overflow-wrap: anywhere; font-size: 14px; line-height: 1.35; }
.billing-client-group > summary span { font-size: 11px; line-height: 1.4; opacity: .9; }
.billing-client-group > summary span.is-review { color: color-mix(in srgb, var(--review-color) 72%, white); }
.billing-client-group > summary span.is-correct { color: color-mix(in srgb, var(--ok-color) 68%, white); }
.billing-client-content { display: grid; gap: 14px; padding: 14px; background: var(--proposal-bg); }
.billing-simulation-item { overflow: hidden; border: 1px solid var(--line); border-left: 6px solid var(--ok-color); border-radius: calc(var(--radius) - 4px); background: var(--surface); }
.billing-simulation-item.is-revisar { border-left-color: var(--review-color); }
.billing-simulation-item > header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 15px 17px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.billing-simulation-identity { min-width: 0; display: grid; gap: 6px; }
.billing-simulation-identity small { color: var(--text-muted); font-size: 10px; line-height: 1.3; letter-spacing: .08em; }
.billing-simulation-identity strong { overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; }
.billing-simulation-identity span { overflow-wrap: anywhere; color: var(--text-muted); font-size: 11px; line-height: 1.45; }
.billing-simulation-total { display: grid; justify-items: end; gap: 5px; white-space: nowrap; }
.billing-simulation-total strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 21px; font-weight: 400; }
.billing-simulation-total small { color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.billing-simulation-state { min-width: 88px; padding: 7px 10px; border-radius: 999px; color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 13%, var(--surface)); font-size: 10px; font-weight: 700; text-align: center; }
.billing-simulation-state.is-revisar { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, var(--surface)); }
.billing-simulation-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; margin: 0; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.billing-simulation-meta > div { min-width: 0; padding: 0 14px; border-right: 1px solid var(--line); }
.billing-simulation-meta > div:first-child { padding-left: 0; }
.billing-simulation-meta > div:last-child { padding-right: 0; border-right: 0; }
.billing-simulation-meta dt { margin-bottom: 6px; color: var(--text-muted); font-size: 10px; line-height: 1.35; text-transform: uppercase; }
.billing-simulation-meta dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; }
.billing-simulation-reasons { display: grid; gap: 7px; margin: 0; padding: 14px 22px 14px 38px; color: var(--review-color); background: color-mix(in srgb, var(--review-color) 7%, var(--surface)); font-size: 11px; line-height: 1.45; }
.billing-simulation-correct { margin: 0; padding: 13px 17px; color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 7%, var(--surface)); font-size: 11px; line-height: 1.45; }
.billing-simulation-orders summary { padding: 13px 17px; color: var(--ink); background: var(--surface); font-size: 11px; line-height: 1.4; font-weight: 700; cursor: pointer; }
.billing-simulation-orders > div { display: grid; border-top: 1px solid var(--line); }
.billing-simulation-orders a { min-width: 0; display: grid; grid-template-columns: minmax(130px, .3fr) minmax(0, 1fr); gap: 14px; padding: 10px 17px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.billing-simulation-orders a:last-child { border-bottom: 0; }
.billing-simulation-orders a:hover { background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface)); }
.billing-simulation-orders a strong { font-size: 10px; }
.billing-simulation-orders a span { overflow-wrap: anywhere; color: var(--text-muted); font-size: 10px; }

@media (max-width: 900px) {
  .billing-simulation-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-simulation-tools .proposal-filters { grid-template-columns: 1fr 1fr; }
  .billing-search { grid-column: 1 / -1; }
  .billing-simulation-item > header { grid-template-columns: minmax(0, 1fr) auto; }
  .billing-simulation-state { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 620px) {
  .billing-simulation-tools .proposal-filters, .billing-simulation-metrics { grid-template-columns: 1fr; }
  .billing-search { grid-column: auto; }
  .billing-simulation-list { padding: 10px; }
  .billing-client-group > summary { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .billing-client-group > summary > div:last-child { justify-items: start; text-align: left; }
  .billing-client-content { padding: 10px; }
  .billing-simulation-item > header { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .billing-simulation-total { justify-items: start; }
  .billing-simulation-meta { grid-template-columns: 1fr; padding: 4px 14px; }
  .billing-simulation-meta > div { padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .billing-simulation-meta > div:last-child { border-bottom: 0; }
  .billing-simulation-orders a { grid-template-columns: 1fr; gap: 4px; }
}
.commercial-evolution-settings:hover { border-color: var(--section-header-text); color: var(--section-header-text); background: transparent; transform: none; filter: none; }
.commercial-evolution-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 36px; }
.commercial-evolution-status.is-loading::before,
.commercial-evolution-empty.is-loading::before {
  width: 8px;
  height: 8px;
  display: inline-block;
  flex: 0 0 auto;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--yellow);
  content: '';
  animation: commercial-evolution-pulse 1.1s ease-in-out infinite;
}
.commercial-evolution-retry { min-height: 30px; padding: 5px 10px; border: 1px solid currentColor; color: inherit; background: transparent; font-size: 10px; }
.commercial-evolution-retry:hover { color: var(--ink); background: color-mix(in srgb, var(--review-color) 9%, var(--surface)); transform: none; filter: none; }
.commercial-evolution-kpis > article { cursor: default; }
.commercial-evolution-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.commercial-evolution-body { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 14px; padding: 0 24px 24px; }
.commercial-evolution-module-overview {
  min-width: 0;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(33, 37, 41, .05);
}
.commercial-evolution-module-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.commercial-evolution-module-overview .module-dashboard-kpi:hover {
  border-color: var(--module-hover-border);
  background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface));
  transform: none;
  filter: none;
}
.commercial-evolution-module-overview .module-dashboard-kpi:focus-visible { outline: 2px solid var(--module-hover-border); outline-offset: -2px; }
.commercial-evolution-module-body { padding-top: 0; }
.commercial-evolution-priority,
.commercial-evolution-rankings,
.commercial-evolution-rank-card { min-width: 0; }
.commercial-evolution-priority,
.commercial-evolution-rankings { height: 100%; overflow: hidden; }
.commercial-evolution-priority-list,
.commercial-evolution-rank-list { min-height: 108px; }
.commercial-evolution-priority-row {
  width: 100%;
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  align-items: stretch;
  gap: 11px;
  padding: 10px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.commercial-evolution-priority-row:last-child { border-bottom: 0; }
.commercial-evolution-priority-row:is(button):hover,
.commercial-evolution-rank-row:is(button):hover { border-color: var(--module-hover-border); background: color-mix(in srgb, var(--module-hover-border) 9%, var(--surface)); transform: none; filter: none; }
.commercial-evolution-priority-row:is(button):focus-visible,
.commercial-evolution-rank-row:is(button):focus-visible,
.commercial-evolution-switch button:focus-visible,
.commercial-evolution-settings:focus-visible { outline: 2px solid var(--module-hover-border); outline-offset: -2px; }
.commercial-evolution-priority-mark { width: 5px; align-self: stretch; border-radius: 999px; background: var(--review-color); }
.commercial-evolution-priority-copy { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.commercial-evolution-priority-copy strong,
.commercial-evolution-priority-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commercial-evolution-priority-copy strong { font-size: 11px; font-weight: 700; }
.commercial-evolution-priority-copy > span { margin-top: 2px; font-size: 10px; }
.commercial-evolution-priority-copy small { margin-top: 4px; color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.commercial-evolution-priority-delay { align-self: center; display: grid; justify-items: end; min-width: 82px; }
.commercial-evolution-priority-delay strong { color: var(--review-color); font-family: 'DM Serif Display', Georgia, serif; font-size: 17px; font-weight: 400; }
.commercial-evolution-priority-delay small { color: var(--text-muted); font-size: 10px; }
.commercial-evolution-priority-risk { margin-top: 4px; color: var(--ink); font-size: 10px; white-space: nowrap; }
.commercial-evolution-rankings-head,
.commercial-evolution-module-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.commercial-evolution-rankings-head,
.commercial-evolution-module-head,
.commercial-evolution-rank-card > header { color: var(--section-header-text); background: var(--section-header-bg); }
.commercial-evolution-rankings-head h3,
.commercial-evolution-module-head h2 { margin: 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.commercial-evolution-rankings-head p,
.commercial-evolution-module-head p,
.commercial-evolution-rank-card > header p { margin: 4px 0 0; color: color-mix(in srgb, var(--section-header-text) 72%, transparent); font-size: 10px; }
.commercial-evolution-switch { flex: 0 0 auto; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); }
.commercial-evolution-switch button { min-width: 82px; min-height: 34px; padding: 6px 11px; border: 0; border-radius: 999px; color: var(--text-muted); background: transparent; font-size: 10px; }
.commercial-evolution-switch button:hover { color: var(--ink); background: color-mix(in srgb, var(--module-hover-border) 8%, transparent); transform: none; filter: none; }
.commercial-evolution-switch button.is-active { color: var(--charcoal); background: var(--yellow); box-shadow: 0 2px 8px rgba(33, 37, 41, .12); }
.commercial-evolution-open-month { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-bottom: 1px dashed var(--warning-color); background: color-mix(in srgb, var(--warning-color) 10%, var(--surface)); }
.commercial-evolution-open-month[hidden] { display: none; }
.commercial-evolution-open-month > div { display: flex; align-items: baseline; gap: 10px; }
.commercial-evolution-open-month span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.commercial-evolution-open-month strong { color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.commercial-evolution-open-month small { color: var(--text-muted); font-size: 9px; text-align: right; }
.commercial-evolution-rank-grid,
.commercial-evolution-module-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 12px 8px; }
.commercial-evolution-rank-grid { min-height: calc(100% - 118px); padding-bottom: 12px; }
.commercial-evolution-rank-grid .commercial-evolution-rank-card { height: 100%; }
.commercial-evolution-rank-card { overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--radius) - 7px); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.commercial-evolution-rank-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 43px; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.commercial-evolution-rank-card > header h3,
.commercial-evolution-rank-card > header h4 { margin: 0; font-family: 'DM Serif Display', Georgia, serif; font-size: 15px; font-weight: 400; }
.commercial-evolution-rank-card > header p { margin-top: 3px; }
.commercial-evolution-trend-mark { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; font-size: 14px; }
.commercial-evolution-trend-mark.is-growing { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 12%, transparent); }
.commercial-evolution-trend-mark.is-falling { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 12%, transparent); }
.commercial-evolution-rank-row {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  grid-template-rows: auto 4px;
  align-items: center;
  gap: 5px 8px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.commercial-evolution-rank-row:last-child { border-bottom: 0; }
.commercial-evolution-rank-position { width: 22px; height: 22px; display: grid; place-items: center; grid-row: 1; border-radius: 50%; color: var(--text-muted); background: var(--surface-soft); font-size: 10px; }
.commercial-evolution-rank-copy { min-width: 0; }
.commercial-evolution-rank-copy strong,
.commercial-evolution-rank-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commercial-evolution-rank-copy strong { font-size: 10px; font-weight: 600; }
.commercial-evolution-rank-copy small { margin-top: 3px; color: var(--text-muted); font-size: 10px; }
.commercial-evolution-rank-value { color: var(--ok-color); font-size: 10px; white-space: nowrap; }
.commercial-evolution-rank-row.is-falling .commercial-evolution-rank-value { color: var(--review-color); }
.commercial-evolution-rank-track { height: 4px; display: block; grid-column: 2 / -1; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.commercial-evolution-rank-track span { display: block; height: 100%; border-radius: inherit; background: var(--ok-color); }
.commercial-evolution-rank-row.is-falling .commercial-evolution-rank-track span { background: var(--review-color); }
.commercial-evolution-empty { display: flex; align-items: center; min-height: 58px; line-height: 1.45; }

/* Vista completa del módulo: los cuatro rankings comparten los datos del Dashboard. */
.commercial-evolution-module-rankings { margin-bottom: 22px; overflow: hidden; }
.commercial-evolution-module-head { padding: 20px 22px; }
.commercial-evolution-module-head h2 { font-size: 23px; }
.commercial-evolution-module-grid { gap: 14px; padding: 18px 22px 22px; }
.commercial-evolution-module-rankings .commercial-evolution-rank-card > header { min-height: 58px; padding: 12px 14px; }
.commercial-evolution-module-rankings .commercial-evolution-rank-card > header h3 { font-size: 18px; }
.commercial-evolution-module-rankings .commercial-evolution-rank-row { min-height: 60px; padding: 10px 13px; }
.commercial-evolution-module-rankings .commercial-evolution-rank-copy strong { font-size: 11px; }
.commercial-evolution-module-rankings .commercial-evolution-rank-copy small { font-size: 10px; }

/* Reglas comerciales administrables. */
.commercial-evolution-rules-dialog { width: min(900px, calc(100vw - 32px)); }
.commercial-evolution-rules-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; padding: 18px 26px 24px; }
.commercial-evolution-rules-body label { min-width: 0; color: var(--ink); font-size: 11px; }
.commercial-evolution-rules-body input,
.commercial-evolution-rules-body select { width: 100%; height: 43px; display: block; margin-top: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--button-radius); outline: 0; color: var(--ink); background: var(--field-bg); }
.commercial-evolution-rules-body input:focus,
.commercial-evolution-rules-body select:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 20%, transparent); }
.commercial-evolution-rules-body small { display: block; margin-top: 5px; color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.commercial-evolution-rules-body .inline-status { grid-column: 1 / -1; }

@keyframes commercial-evolution-pulse {
  0%, 100% { opacity: .35; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 1199px) {
  .commercial-evolution-body { grid-template-columns: 1fr; }
  .commercial-evolution-module-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .commercial-evolution-heading-actions { width: 100%; justify-content: space-between; grid-column: 1 / -1; }
  .commercial-evolution-body { padding: 0 17px 17px; }
  .commercial-evolution-rankings-head,
  .commercial-evolution-module-head { align-items: stretch; flex-direction: column; }
  .commercial-evolution-switch { width: 100%; }
  .commercial-evolution-switch button { min-width: 0; }
  .commercial-evolution-rank-grid,
  .commercial-evolution-module-grid { grid-template-columns: 1fr; }
  .commercial-evolution-module-head { padding: 17px; }
  .commercial-evolution-module-grid { padding: 14px 17px 17px; }
  .commercial-evolution-rules-body { grid-template-columns: 1fr; padding-inline: 18px; }
  .commercial-evolution-rules-body .inline-status { grid-column: 1; }
}

@media (max-width: 440px) {
  .commercial-evolution-kpis { grid-template-columns: 1fr; }
  .commercial-evolution-module-kpis { grid-template-columns: 1fr; }
  .commercial-evolution-priority-row { grid-template-columns: 5px minmax(0, 1fr); }
  .commercial-evolution-priority-delay { grid-column: 2; justify-items: start; }
  .commercial-evolution-rank-row { grid-template-columns: 23px minmax(0, 1fr); }
  .commercial-evolution-rank-value { display: none; }
  .commercial-evolution-rank-track { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .commercial-evolution-status.is-loading::before,
  .commercial-evolution-empty.is-loading::before { animation: none; }
}

/* Navegación y fichas comerciales */
.topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
.topbar-navigation { justify-self: end; }
.page-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.page-back-button { width: 43px; min-width: 43px; height: 43px; min-height: 43px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid transparent; color: var(--section-header-text); background: transparent; }
.page-back-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-back-button:hover, .page-back-button:focus-visible { border-color: color-mix(in srgb, currentColor 48%, transparent); background: transparent; transform: none; filter: none; }
.account-view .page-header,
.account-view .account-panel { width: min(860px, 100%); margin-right: auto; margin-left: auto; }
.module-dashboard-heading.is-clickable { cursor: pointer; }
.module-dashboard-heading.is-clickable:hover { background: color-mix(in srgb, var(--module-hover-border) 7%, var(--section-header-bg)); }
.module-dashboard-heading.is-clickable:focus-visible { outline: 3px solid var(--module-hover-border); outline-offset: -4px; }

.supplier-settings-icon { width: 20px; height: 20px; display: block; background: currentColor; -webkit-mask: url('/static/icon-system.png') center / contain no-repeat; mask: url('/static/icon-system.png') center / contain no-repeat; }

.frequency-company-table th:nth-child(1) { width: 18%; }
.frequency-company-table th:nth-child(2) { width: 5%; }
.frequency-company-table th:nth-child(3) { width: 8%; }
.frequency-company-table th:nth-child(4) { width: 8%; }
.frequency-company-table th:nth-child(5) { width: 10%; }
.frequency-company-table th:nth-child(6) { width: 8%; }
.frequency-company-table th:nth-child(7) { width: 8%; }
.frequency-company-table th:nth-child(8) { width: 8%; }
.frequency-company-table th:nth-child(9) { width: 12%; }
.frequency-company-table th:nth-child(10) { width: 9%; }
.frequency-company-table th:nth-child(11) { width: 6%; }
.frequency-state-with-reviewer { display: inline-flex; align-items: center; gap: 6px; }
.frequency-state.is-revisado { color: var(--text-muted); background: var(--surface-soft); }
.frequency-product-revisado td { color: var(--text-muted); background: var(--surface); }
.frequency-reviewer-avatar { width: 24px; height: 24px; border-width: 2px; }
.frequency-reviewer-avatar .profile-avatar-fallback { font-size: 9px; }
.frequency-review-check { display: inline-grid; place-items: center; margin: 0; cursor: pointer; }
.frequency-review-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--ok-color); }
.frequency-review-confirm-dialog { width: min(560px, calc(100% - 32px)); }
.frequency-review-confirm-body { padding: 22px 24px 8px; color: var(--ink); line-height: 1.55; }

.client-detail-metrics { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.client-detail-receivables { grid-column: span 2; transition: border-color .2s ease, background-color .2s ease; }
.client-detail-receivables.is-alert { border-color: var(--review-color); background: color-mix(in srgb, var(--review-color) 13%, var(--surface)); }
.client-detail-receivables.is-alert p,
.client-detail-receivables.is-alert strong,
.client-detail-receivables.is-alert span { color: var(--review-color); }
.client-detail-receivables.is-clear { border-color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 13%, var(--surface)); }
.client-detail-receivables.is-clear p,
.client-detail-receivables.is-clear strong,
.client-detail-receivables.is-clear span { color: var(--ok-color); }
.client-detail-page-header { padding: 22px 24px; border-radius: var(--radius); color: var(--section-header-text); background: var(--section-header-bg); }
.client-detail-page-header .eyebrow,
.client-detail-page-header .page-subtitle { color: color-mix(in srgb, var(--section-header-text) 78%, transparent); }
.client-detail-header-actions { align-self: center; display: grid; grid-template-columns: minmax(150px, auto) 43px 43px; align-items: end; justify-content: end; gap: 10px; }
.client-detail-header-actions label { display: grid; gap: 5px; color: var(--section-header-text); font-size: 9px; letter-spacing: .06em; text-align: right; text-transform: uppercase; }
.client-detail-header-actions select { min-width: 150px; height: 43px; padding: 0 36px 0 12px; border: 1px solid var(--line); border-radius: var(--button-radius); outline: 0; color: var(--ink); background: var(--field-bg); font: 12px 'Questrial', Arial, sans-serif; letter-spacing: 0; text-transform: none; cursor: pointer; }
.client-detail-header-actions select:hover { border-color: var(--module-hover-border); }
.client-detail-header-actions select:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 20%, transparent); }
.client-detail-header-icon { width: 43px; min-width: 43px; height: 43px; padding: 0; display: inline-grid; place-items: center; border: 1px solid transparent; color: var(--section-header-text); background: transparent; }
.client-detail-header-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.client-detail-header-icon:hover, .client-detail-header-icon:focus-visible { border-color: color-mix(in srgb, currentColor 48%, transparent); background: transparent; transform: none; filter: none; }
.client-detail-header-icon:disabled { opacity: .48; cursor: wait; }
.client-detail-page-header .page-back-button { color: var(--section-header-text); background: transparent; }
.client-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.client-detail-grid .panel { margin: 0; }
.client-detail-grid .panel-head { color: var(--section-header-text); background: var(--section-header-bg); }
.client-detail-grid .panel-head h2 { color: var(--section-header-text); }
.client-detail-grid .panel-head p { color: color-mix(in srgb, var(--section-header-text) 78%, transparent); }
.client-detail-documents { grid-column: 1 / -1; }
.client-detail-pagination { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center; gap: 12px; padding: 14px 20px 20px; border-top: 1px solid var(--line); }
.client-detail-pagination span { color: var(--text-muted); font-size: 10px; text-align: center; }
.client-detail-pagination button { min-width: 118px; }
.client-detail-definition { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 20px; }
.client-detail-definition div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 8px); background: var(--surface-soft); }
.client-detail-definition dt { color: var(--text-muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.client-detail-definition dd { margin: 6px 0 0; color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 17px; }
.client-detail-trend { min-height: 270px; overflow-x: auto; padding: 20px; }
.client-detail-trend.is-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(54px, 1fr); align-items: end; gap: 3px; }
.client-detail-trend-column { min-width: 54px; height: 225px; display: grid; grid-template-rows: 36px minmax(0, 1fr) 26px; align-items: end; justify-items: center; gap: 5px; }
.client-detail-trend-column span { max-width: 86px; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.client-detail-trend-column i { width: min(42px, 88%); min-height: 3px; border-radius: 7px 7px 2px 2px; background: var(--yellow); }
.client-detail-trend-column.is-open-month i { border: 2px dashed var(--warning-color); background: color-mix(in srgb, var(--warning-color) 28%, var(--surface)); }
.client-detail-trend-column.is-open-month span,
.client-detail-trend-column.is-open-month small { color: var(--warning-color); }
.client-detail-trend-column small { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.client-detail-chart-switch { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px 20px; }
.client-detail-chart-switch button { min-width: 86px; min-height: 36px; padding: 7px 13px; border: 1px solid var(--line); color: var(--ink); background: var(--surface-soft); font-size: 11px; }
.client-detail-chart-switch button:hover, .client-detail-chart-switch button.is-active { border-color: var(--yellow); color: var(--charcoal); background: var(--yellow); transform: none; filter: none; }
.client-detail-trend.is-line { min-height: 270px; }
.client-detail-trend.is-line svg { display: block; min-width: 100%; height: 245px; }
.client-detail-line-grid { stroke: var(--line); stroke-width: 1; }
.client-detail-line-path { fill: none; stroke: var(--yellow); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.client-detail-line-path.is-open-month { stroke: var(--warning-color); stroke-dasharray: 9 8; }
.client-detail-line-point { fill: var(--surface); stroke: var(--yellow); stroke-width: 4; }
.client-detail-line-point.is-open-month { stroke: var(--warning-color); }
.client-detail-line-value, .client-detail-line-month { fill: var(--ink); font: 700 11px 'Questrial', Arial, sans-serif; text-anchor: middle; }
.client-detail-line-month { fill: var(--text-muted); font-weight: 400; }
.client-detail-trend.is-circle { display: block; }
.client-detail-donut-layout { min-width: 520px; display: grid; grid-template-columns: 220px minmax(260px, 1fr); align-items: center; gap: 28px; }
.client-detail-donut { position: relative; width: 210px; height: 210px; display: grid; place-items: center; border-radius: 50%; }
.client-detail-donut::after { position: absolute; inset: 48px; border-radius: 50%; background: var(--surface); content: ''; }
.client-detail-donut > div { position: relative; z-index: 1; max-width: 108px; text-align: center; }
.client-detail-donut small, .client-detail-donut strong { display: block; }
.client-detail-donut small { color: var(--text-muted); font-size: 10px; }
.client-detail-donut strong { margin-top: 5px; color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.client-detail-donut-legend { max-height: 220px; overflow-y: auto; }
.client-detail-donut-legend > div { display: grid; grid-template-columns: 10px minmax(70px, 1fr) auto; align-items: center; gap: 9px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.client-detail-donut-legend > div.is-open-month { padding-left: 7px; border-left: 2px dashed var(--warning-color); }
.client-detail-donut-legend i { width: 9px; height: 9px; border-radius: 50%; }
.client-detail-donut-legend span { color: var(--text-muted); font-size: 11px; }
.client-detail-donut-legend strong { color: var(--ink); font-size: 11px; }

/* Confirmación común para cualquier escritura en Odoo */
.odoo-write-confirm-dialog { width: min(620px, calc(100vw - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface); }
.odoo-write-confirm-dialog::backdrop { background: rgba(33, 37, 41, .62); backdrop-filter: blur(2px); }
.odoo-write-confirm-dialog > form { display: grid; grid-template-rows: auto 1fr auto; }
.odoo-write-confirm-body { display: grid; gap: 14px; padding: 22px; }
.odoo-write-confirm-warning { display: grid; gap: 6px; padding: 15px 16px; border: 1px solid var(--warning-color); border-radius: var(--button-radius); background: color-mix(in srgb, var(--warning-color) 12%, var(--surface)); }
.odoo-write-confirm-warning strong { color: var(--ink); font-size: 13px; }
.odoo-write-confirm-warning span { color: var(--ink); font-size: 11px; line-height: 1.5; }
.odoo-write-confirm-details { display: grid; gap: 8px; margin: 0; padding: 0 0 0 20px; color: var(--ink); font-size: 11px; line-height: 1.45; }
.odoo-write-confirm-details[hidden] { display: none; }
.odoo-write-confirm-details li::marker { color: var(--warning-color); }
.odoo-write-confirm-body > p { margin: 0; color: var(--text-muted); font-size: 10px; }
.client-detail-list { display: grid; padding: 0 20px 20px; }
.client-detail-list-row { min-width: 0; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.client-detail-list-row:last-child { border-bottom: 0; }
.client-detail-list-row > div { min-width: 0; }
.client-detail-list-row strong,
.client-detail-list-row small { display: block; }
.client-detail-list-row strong { font-size: 11px; }
.client-detail-list-row small { margin-top: 4px; color: var(--text-muted); font-size: 9px; line-height: 1.4; }
.client-detail-list-row b { flex: 0 0 auto; font-family: 'DM Serif Display', Georgia, serif; font-size: 16px; font-weight: 400; }
.client-detail-list-row.is-retrasado { border-left: 4px solid var(--review-color); padding-left: 10px; }
.client-detail-list-row.is-proximo { border-left: 4px solid var(--warning-color); padding-left: 10px; }
.client-detail-alert-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.client-detail-review-check { display: inline-flex; grid-template-columns: none; gap: 5px; color: var(--text-muted); font-size: 9px; white-space: nowrap; }
.client-detail-product-value { flex: 0 0 auto; display: grid; justify-items: end; gap: 3px; text-align: right; }
.client-detail-product-value strong { color: var(--ink); font-size: 11px; }
.client-detail-product-value b { color: var(--text-muted); font-size: 14px; }
.client-detail-document:hover { color: var(--ink); background: var(--surface-soft); }
.client-detail-document.is-refund b { color: var(--review-color); }
.client-detail-document-meta { display: flex !important; flex-wrap: wrap; align-items: center; gap: 7px; }
.client-detail-payment-state { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 9px; border-radius: 999px; font-weight: 700; line-height: 1; }
.client-detail-payment-state.is-paid { color: var(--ok-color); background: color-mix(in srgb, var(--ok-color) 14%, transparent); }
.client-detail-payment-state.is-pending { color: var(--review-color); background: color-mix(in srgb, var(--review-color) 13%, transparent); }
.client-detail-payment-state.is-neutral { color: var(--text-muted); background: var(--surface-soft); }
.client-detail-empty { margin: 0; padding: 24px 0; }

/* Cabeceras globales: un único color de fondo y texto para toda la app. */
.app-view > .page-header,
.panel > .panel-head,
.appearance-dialog .appearance-head,
.appearance-section > .appearance-section-head {
  color: var(--section-header-text);
  background: var(--section-header-bg);
}
.app-view > .page-header { padding: 22px 24px; border-radius: var(--radius); }
.app-view > .page-header { align-items: center; }
.app-view > .page-header > div:first-child,
.panel > .panel-head > div:first-child { min-width: 0; }
.panel > .panel-head { align-items: center; }
.panel > .panel-head .panel-head-actions,
.panel > .panel-head > .button-group,
.appearance-dialog .appearance-head { align-items: center; }
.panel > .panel-head > button,
.panel > .panel-head-actions > button,
.appearance-dialog .appearance-head > button { flex: 0 0 auto; }
.panel > .panel-head,
.appearance-dialog .appearance-head { border-radius: var(--radius) var(--radius) 0 0; }
.appearance-section > .appearance-section-head { margin: -16px -16px 14px; padding: 14px 16px 12px; border-radius: 13px 13px 0 0; }
.app-view > .page-header h1,
.app-view > .page-header h2,
.panel > .panel-head h2,
.panel > .panel-head h3,
.appearance-dialog .appearance-head h2,
.appearance-section > .appearance-section-head h3 { color: var(--section-header-text); }
.app-view > .page-header .eyebrow,
.app-view > .page-header .page-subtitle,
.panel > .panel-head p,
.appearance-dialog .appearance-head p:last-child,
.appearance-section > .appearance-section-head p { color: color-mix(in srgb, var(--section-header-text) 78%, transparent); }
.app-view > .page-header .page-back-button,
.panel > .panel-head .page-back-button { color: var(--section-header-text); background: transparent; }

/* Las vistas con cuatro indicadores mantienen una cuadrícula completa en escritorio.
   Esta regla debe permanecer después de la cuadrícula genérica de tres columnas. */
.metrics.delivery-metrics,
.metrics.delivery-client-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1199px) {
  .client-detail-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar-navigation { gap: 2px; }
  .page-header:not(.module-page-header) { align-items: stretch; flex-direction: column; }
  .page-header-actions { justify-content: stretch; }
  .page-header-actions .page-back-button { width: 43px; }
  .client-detail-metrics { grid-template-columns: 1fr 1fr; }
  .client-detail-header-actions { width: 100%; grid-template-columns: minmax(0, 1fr) 43px 43px; align-items: end; justify-content: stretch; }
  .client-detail-header-actions label,
  .client-detail-header-actions select { width: 100%; min-width: 0; }
  .client-detail-alert-actions { align-items: flex-end; flex-direction: column; }
  .client-detail-grid { grid-template-columns: 1fr; }
  .client-detail-documents { grid-column: 1; }
  .metrics.delivery-metrics,
  .metrics.delivery-client-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Asistente global de consultas · usa los mismos tokens del sistema visual. */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.topbar { grid-template-columns: minmax(180px, 1fr) minmax(220px, 620px) minmax(180px, 1fr); }
.topbar .brand { grid-column: 1; justify-self: start; }
.assistant-quick-search { grid-column: 2; width: 100%; min-width: 0; position: relative; justify-self: stretch; }
.topbar-actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 8px; }
.topbar-actions .topbar-navigation, .topbar-actions .topbar-user { justify-self: auto; }
.topbar-admin-switchers { display: flex; align-items: center; gap: 6px; }
.odoo-write-mode { min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid color-mix(in srgb, var(--ok-color) 72%, transparent); border-radius: 999px; color: var(--topbar-text); background: color-mix(in srgb, var(--ok-color) 24%, transparent); font-size: 10px; font-weight: 700; white-space: nowrap; }
.odoo-write-mode svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.odoo-write-mode.is-enabled { border-color: color-mix(in srgb, var(--review-color) 82%, transparent); background: color-mix(in srgb, var(--review-color) 34%, transparent); }
.odoo-write-mode:hover { color: var(--topbar-text); background: color-mix(in srgb, var(--topbar-text) 16%, transparent); transform: none; filter: none; }
body[data-odoo-write-enabled="false"] #create-orders,
body[data-odoo-write-enabled="false"] #my-delivery-signature-save,
body[data-odoo-write-enabled="false"] #my-delivery-validate,
body[data-odoo-write-enabled="false"] #collection-submit { pointer-events: none; opacity: .42; }
.user-simulator { display: block; margin: 0; }
.user-simulator select { width: 148px; height: 38px; min-height: 38px; padding: 0 25px 0 11px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--topbar-text) 28%, transparent); border-radius: 999px; color: var(--topbar-text); background-color: color-mix(in srgb, var(--topbar-text) 10%, transparent); font-size: 10px; font-weight: 700; text-overflow: ellipsis; }
.user-simulator select:focus-visible { outline: 2px solid var(--topbar-active); outline-offset: 2px; }
.dev-environment-stripe { position: sticky; top: var(--topbar-height); z-index: 79; width: 100%; height: 12px; flex: 0 0 12px; background: var(--review-color); box-shadow: 0 1px 4px color-mix(in srgb, var(--review-color) 38%, transparent); }
.is-dev-environment .topbar-menu-layer { top: calc(var(--topbar-height) + 12px); }
.user-simulation-banner { position: sticky; top: var(--topbar-height); z-index: 78; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 7px 18px; border-bottom: 1px solid color-mix(in srgb, var(--yellow) 60%, var(--line)); color: var(--charcoal); background: var(--yellow-soft); font-size: 11px; text-align: center; }
.is-dev-environment .user-simulation-banner { top: calc(var(--topbar-height) + 12px); }
.user-simulation-banner button { min-height: 28px; padding: 4px 11px; border: 1px solid color-mix(in srgb, var(--charcoal) 28%, transparent); border-radius: 999px; color: var(--charcoal); background: transparent; font-size: 10px; }
.user-simulation-banner button:hover { color: var(--charcoal); background: color-mix(in srgb, var(--charcoal) 8%, transparent); transform: none; filter: none; }
.is-user-simulating .topbar-menu-layer { top: calc(var(--topbar-height) + 42px); }
.is-dev-environment.is-user-simulating .topbar-menu-layer { top: calc(var(--topbar-height) + 54px); }
.assistant-quick-search input { width: 100%; height: 44px; padding: 0 48px 0 16px; border: 1px solid color-mix(in srgb, var(--topbar-text) 25%, transparent); border-radius: 999px; outline: 0; color: var(--topbar-text); background: color-mix(in srgb, var(--topbar-text) 10%, transparent); }
.assistant-quick-search input::placeholder { color: color-mix(in srgb, var(--topbar-text) 66%, transparent); }
.assistant-quick-search input:focus { border-color: var(--topbar-active); box-shadow: 0 0 0 3px color-mix(in srgb, var(--topbar-active) 20%, transparent); }
.assistant-quick-search button { position: absolute; top: 3px; right: 4px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--topbar-icon); background: transparent; }
.assistant-quick-search button:hover { color: var(--charcoal); background: var(--topbar-active); transform: none; filter: none; }
.assistant-quick-search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.assistant-window { position: fixed; z-index: 300; top: 102px; right: 24px; width: min(560px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 126px)); min-width: 340px; min-height: 360px; overflow: hidden; resize: both; grid-template-rows: auto minmax(0, 1fr) auto auto auto; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.assistant-window:not([hidden]) { display: grid; }
.assistant-window-head { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px 12px 18px; color: var(--section-header-text); background: var(--section-header-bg); cursor: move; touch-action: none; user-select: none; }
.assistant-window-head > div:first-child { min-width: 0; display: flex; align-items: center; gap: 11px; }
.assistant-avatar-wrap { position: relative; width: 52px; height: 52px; flex: 0 0 52px; }
.assistant-avatar { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 30%; border: 2px solid var(--topbar-active); border-radius: 50%; }
.assistant-avatar-wrap .assistant-readonly-dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--section-header-bg); }
.assistant-window-head h2 { margin: 0; font-size: 20px; font-weight: 400; }
.assistant-window-head p { margin: 3px 0 0; font-size: 10px; opacity: .72; }
.assistant-readonly-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--ok-color); }
.assistant-window-actions { display: flex; align-items: center; gap: 4px; }
.assistant-window-actions button { width: 36px; height: 36px; padding: 0; border: 1px solid transparent; color: var(--section-header-text); background: transparent; font-size: 23px; line-height: 1; }
.assistant-window-actions button:hover { border-color: color-mix(in srgb, var(--section-header-text) 40%, transparent); background: transparent; transform: none; filter: none; }
.assistant-window-actions button:disabled { cursor: default; opacity: .35; }
.assistant-window-actions svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.assistant-messages { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 16px; background: var(--proposal-bg); }
.assistant-message { max-width: 88%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; background: var(--surface-soft); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message.is-user { align-self: flex-end; border-color: color-mix(in srgb, var(--yellow) 60%, var(--line)); border-radius: 14px 14px 4px 14px; color: var(--charcoal); background: var(--yellow-soft); }
.assistant-message.is-error { color: var(--review-color); border-color: color-mix(in srgb, var(--review-color) 45%, var(--line)); }
.assistant-message.is-loading { color: var(--text-muted); }
.assistant-suggestions { display: flex; gap: 7px; overflow-x: auto; padding: 0 14px 10px; background: var(--proposal-bg); }
.assistant-suggestions:empty { display: none; }
.assistant-suggestions button { flex: 0 0 auto; min-height: 32px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); font-size: 10px; }
.assistant-suggestions button:hover { border-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 9%, var(--surface)); transform: none; filter: none; }
.assistant-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.assistant-chat-form textarea { width: 100%; min-height: 46px; max-height: 120px; resize: vertical; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--button-radius); outline: 0; color: var(--ink); background: var(--field-bg); font: inherit; font-size: 12px; line-height: 1.4; }
.assistant-chat-form textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 20%, transparent); }
.assistant-chat-form button { min-height: 46px; }
.assistant-window-footer { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 14px; border-top: 1px solid var(--line); color: var(--text-muted); background: var(--surface-soft); font-size: 9px; }
.assistant-window.is-minimized { width: min(420px, calc(100vw - 32px)); height: auto !important; min-height: 0; resize: none; }
.assistant-window.is-minimized .assistant-messages, .assistant-window.is-minimized .assistant-suggestions, .assistant-window.is-minimized .assistant-chat-form, .assistant-window.is-minimized .assistant-window-footer { display: none; }

@media (max-width: 1200px) {
  .topbar { grid-template-columns: minmax(120px, 1fr) minmax(180px, 420px) minmax(120px, 1fr); gap: 10px; }
  .user-simulator select { width: 112px; }
}
@media (max-width: 900px) {
  .topbar { grid-template-columns: minmax(150px, 1fr) minmax(180px, 420px) minmax(150px, 1fr); gap: 10px; }
  .topbar-actions { gap: 3px; }
  .user-simulator select { width: 112px; padding-left: 8px; }
  .odoo-write-mode span { display: none; }
  .odoo-write-mode { width: 38px; justify-content: center; padding: 0; }
}
@media (max-width: 760px) {
  .app-shell { --topbar-height: 122px; }
  .app-shell:not(.has-assistant-search) { --topbar-height: 68px; }
  .topbar { grid-template-columns: minmax(76px, 1fr) auto; grid-template-rows: 58px 46px; gap: 4px 6px; padding: 5px 9px 9px; }
  .app-shell:not(.has-assistant-search) .topbar { grid-template-rows: 58px; padding-bottom: 5px; }
  .topbar .brand { grid-column: 1; grid-row: 1; }
  .topbar-actions { grid-column: 2; grid-row: 1; gap: 1px; }
  .topbar-actions .topbar-navigation, .topbar-actions .topbar-user { gap: 1px; }
  .topbar-admin-switchers { gap: 2px; }
  .user-simulator select { width: 82px; height: 34px; min-height: 34px; padding-left: 7px; }
  .odoo-write-mode { width: 34px; min-height: 34px; }
  .topbar-actions .topbar-icon { width: 38px; height: 38px; }
  .topbar-actions .topbar-profile { width: 38px; height: 38px; }
  .topbar-actions .profile-avatar-topbar { width: 34px; height: 34px; }
  .topbar-actions .topbar-signout { width: 38px; min-width: 38px; height: 38px; min-height: 38px; }
  .assistant-quick-search { grid-column: 1 / -1; grid-row: 2; }
  .assistant-quick-search input { height: 42px; }
  .user-simulation-banner { min-height: 54px; align-items: stretch; flex-direction: column; gap: 5px; padding: 7px 12px; }
  .user-simulation-banner button { align-self: center; }
  .is-user-simulating .topbar-menu-layer { top: calc(var(--topbar-height) + 54px); }
  .is-dev-environment.is-user-simulating .topbar-menu-layer { top: calc(var(--topbar-height) + 66px); }
  .assistant-window { inset: auto 8px 8px 8px; width: auto; height: min(72dvh, 650px); min-width: 0; min-height: 340px; resize: none; border-radius: 16px; }
  .assistant-window-head { gap: 8px; padding: 8px 9px; cursor: default; touch-action: auto; }
  .assistant-avatar-wrap { width: 40px; height: 40px; flex-basis: 40px; }
  .assistant-window-actions { gap: 1px; }
  .assistant-window-actions button { width: 31px; height: 31px; }
}

@media print {
  body.aina-printing > * { display: none !important; }
  body.aina-printing > #assistant-window { position: static; width: 100%; height: auto; min-width: 0; min-height: 0; display: block !important; overflow: visible; resize: none; border: 0; box-shadow: none; }
  body.aina-printing .assistant-window-head { color: #000; background: #fff; cursor: default; }
  body.aina-printing .assistant-window-actions,
  body.aina-printing .assistant-suggestions,
  body.aina-printing .assistant-chat-form,
  body.aina-printing .assistant-window-footer { display: none !important; }
  body.aina-printing .assistant-messages { display: flex; overflow: visible; padding: 16px 0; background: #fff; }
  body.aina-printing .assistant-message { max-width: 100%; color: #000; border-color: #bbb; background: #fff; }
}

/* Mis entregas · flujo operativo conectado con Odoo */
.metrics.my-deliveries-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.my-deliveries-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 280px)); align-items: start; gap: 14px; padding: 18px 22px 0; }
.my-deliveries-filter label { min-width: 0; display: grid; gap: 7px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.my-deliveries-filter label > small { color: var(--text-muted); font-size: 9px; line-height: 1.35; text-transform: none; }
.my-deliveries-filter input, .my-deliveries-filter select { width: 100%; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); background: var(--field-bg); }
.my-deliveries-controls .inline-status { margin: 14px 22px 20px; }
.my-deliveries-list { display: grid; }
.my-delivery-responsible-heading { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; color: var(--section-header-text); background: var(--section-header-bg); }
.my-delivery-responsible-heading strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 17px; font-weight: 400; }
.my-delivery-responsible-heading span { font-size: 10px; }
.my-delivery-row { width: 100%; min-height: 78px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 13px 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--surface); text-align: left; }
.my-delivery-row:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.my-delivery-row:hover, .my-delivery-row:focus-visible { z-index: 1; outline: 2px solid var(--module-hover-border); outline-offset: -2px; background: var(--surface-soft); transform: none; filter: none; }
.my-delivery-row.is-done { border-left: 5px solid var(--ok-color); }
.my-delivery-row:not(.is-done) { border-left: 5px solid var(--warning-color); }
.my-delivery-order { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--charcoal); background: var(--yellow); font-family: 'DM Serif Display', Georgia, serif; font-size: 20px; }
.my-delivery-copy { min-width: 0; display: grid; gap: 4px; }
.my-delivery-copy strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.my-delivery-copy span, .my-delivery-copy small { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.my-delivery-dialog { width: min(1120px, calc(100vw - 28px)); max-height: calc(100vh - 28px); }
.my-delivery-dialog > form { max-height: calc(100vh - 28px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.my-delivery-dialog .appearance-head { position: sticky; top: 0; z-index: 4; }
.my-delivery-body { min-height: 0; overflow-y: auto; padding: 20px 24px; background: var(--surface); }
.my-delivery-section { margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.my-delivery-section:first-of-type { margin-top: 0; }
.my-delivery-section > summary { min-height: 56px; display: grid; grid-template-columns: minmax(0, 1fr) auto 22px; align-items: center; gap: 12px; padding: 13px 17px; color: var(--section-header-text); background: var(--section-header-bg); cursor: pointer; list-style: none; }
.my-delivery-section > summary::-webkit-details-marker { display: none; }
.my-delivery-section > summary::after { content: ''; width: 9px; height: 9px; justify-self: center; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.my-delivery-section[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.my-delivery-section > summary > span { font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; }
.my-delivery-section > summary > small { color: color-mix(in srgb, var(--section-header-text) 78%, transparent); font-size: 10px; text-align: right; }
.my-delivery-lines { overflow: hidden; }
.my-delivery-line { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) 140px 180px; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.my-delivery-line:last-child { border-bottom: 0; }
.my-delivery-product { min-width: 0; display: grid; gap: 4px; }
.my-delivery-product strong { overflow-wrap: anywhere; font-size: 12px; }
.my-delivery-product small { display: none; color: var(--text-muted); font-size: 11px; font-weight: 400; }
.my-delivery-line > span:nth-child(2) { color: var(--text-muted); font-size: 11px; text-align: right; }
.my-delivery-line input { width: 100%; min-width: 0; height: 42px; padding: 0 8px; border: 0; color: var(--ink); background: #fff; text-align: center; }
.my-delivery-quantity { min-width: 0; display: grid; grid-template-columns: 40px minmax(64px, 1fr) 40px; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: var(--button-radius); background: #fff; }
.my-delivery-quantity-button { min-width: 0; min-height: 42px; padding: 0; border: 0; border-radius: 0; color: var(--ink); background: var(--surface-soft); font-size: 22px; line-height: 1; }
.my-delivery-quantity-button:first-child { border-right: 1px solid var(--line); }
.my-delivery-quantity-button:last-child { border-left: 1px solid var(--line); }
.my-delivery-quantity-button:hover:not(:disabled), .my-delivery-quantity-button:focus-visible { color: var(--charcoal); background: var(--yellow); transform: none; filter: none; }
.my-delivery-quantity-button:disabled { cursor: not-allowed; opacity: .45; }
.my-delivery-line-head { min-height: 44px; color: var(--section-header-text); background: var(--section-header-bg); font-size: 10px; text-transform: uppercase; }
.my-delivery-line-head > span { color: inherit !important; font-size: 10px !important; text-align: left !important; }
.my-delivery-line-head > span:not(:first-child) { text-align: right !important; }
.my-delivery-signature-content { padding: 18px; }
.my-delivery-signature-content > p { margin: 0 0 10px; color: var(--text-muted); font-size: 11px; }
.my-delivery-signature-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.my-delivery-signature-content > .inline-status { margin: 12px 0 0; }
.my-delivery-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding: 18px; }
.my-delivery-form-grid > label:not(.check) { min-width: 0; display: grid; gap: 7px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.my-delivery-form-grid select, .my-delivery-form-grid textarea, .my-delivery-form-grid input[type='file'] { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); background: var(--field-bg); font: 12px 'Questrial', Arial, sans-serif; }
.my-delivery-form-grid small { color: var(--text-muted); font-size: 9px; text-transform: none; }
.my-delivery-comment-field { grid-column: 1 / -1; }
.my-delivery-backorder { grid-column: 1 / -1; }
#my-delivery-signature { width: 100%; height: 170px; display: block; margin: 0 0 12px; border: 1px dashed var(--line); border-radius: var(--button-radius); background: #fff; touch-action: none; }
#my-delivery-signature-clear { margin: 0; }
.my-delivery-final-check { margin: 20px 0 0; padding: 16px; border: 1px solid var(--yellow); border-radius: var(--button-radius); background: color-mix(in srgb, var(--yellow) 13%, var(--surface)); }
.my-delivery-body > .inline-status { margin-top: 14px; }
.my-delivery-share { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.my-delivery-share a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.my-delivery-actions { position: sticky; bottom: 0; z-index: 4; }

/* Cobros de clientes · conciliación nativa en Odoo */
.my-deliveries-view > .metrics,
.my-deliveries-view > .panel { margin-bottom: 18px; }
.my-deliveries-collection-actions { display: grid; grid-template-columns: minmax(220px, 1fr); gap: 10px; width: min(440px, 100%); margin: 0 0 18px auto; }
.my-deliveries-collection-actions button { width: 100%; min-height: 46px; }
.collection-tool-dialog { width: min(980px, calc(100vw - 28px)); max-height: calc(100vh - 28px); }
.collection-tool-shell { max-height: calc(100vh - 28px); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.collection-tool-dialog .appearance-head { position: sticky; top: 0; z-index: 4; }
.collection-tool-body { min-height: 0; overflow-y: auto; background: var(--surface); }
.collection-client-search { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px; padding: 18px 20px 16px; }
.collection-client-search label { min-width: 0; display: grid; gap: 7px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.collection-client-search input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); background: var(--field-bg); }
.collection-tool-body > .inline-status { margin: 0 20px 14px; }
.collection-client-results { display: grid; border-top: 1px solid var(--line); }
.collection-client-result { min-height: 62px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 11px 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--surface); text-align: left; }
.collection-client-result:last-child { border-bottom: 0; }
.collection-client-result:hover, .collection-client-result:focus-visible { background: var(--surface-soft); transform: none; filter: none; }
.collection-client-result > span:first-child { min-width: 0; display: grid; gap: 4px; }
.collection-client-result strong { font-size: 13px; }
.collection-client-result small { overflow-wrap: anywhere; color: var(--text-muted); font-size: 10px; }
.collection-client-result > span:last-child { font-size: 28px; }
.collection-dialog { width: min(920px, calc(100vw - 28px)); max-height: calc(100vh - 28px); }
.collection-dialog > form { max-height: calc(100vh - 28px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.collection-dialog .appearance-head { position: sticky; top: 0; z-index: 4; }
.collection-body { min-height: 0; overflow-y: auto; padding: 20px 24px; background: var(--surface); }
.collection-body > .inline-status { margin: 0 0 14px; }
.collection-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; padding: 0; border: 0; }
.collection-methods legend { width: 100%; margin-bottom: 9px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.collection-methods label { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--surface); cursor: pointer; }
.collection-methods label:has(input:checked) { border-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 13%, var(--surface)); }
.collection-methods label:has(input:disabled) { cursor: not-allowed; opacity: .45; }
.collection-methods input { width: 20px; height: 20px; accent-color: var(--yellow); }
.collection-methods label > span { display: grid; gap: 3px; }
.collection-methods strong { font-size: 13px; }
.collection-methods small { color: var(--text-muted); font-size: 10px; }
.collection-invoices { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.collection-section-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; color: var(--section-header-text); background: var(--section-header-bg); }
.collection-section-head h3, .collection-section-head p { margin: 0; }
.collection-section-head h3 { color: inherit; font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; font-weight: 400; }
.collection-section-head p { margin-top: 3px; color: color-mix(in srgb, var(--section-header-text) 75%, transparent); font-size: 10px; }
.collection-invoice-list { display: grid; }
.collection-invoice { min-height: 66px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.collection-invoice:last-child { border-bottom: 0; }
.collection-invoice.is-current { box-shadow: inset 5px 0 0 var(--yellow); }
.collection-invoice.is-overdue:not(.is-current) { box-shadow: inset 5px 0 0 var(--danger-color); }
.collection-invoice > input { width: 20px; height: 20px; accent-color: var(--yellow); }
.collection-invoice-copy { min-width: 0; display: grid; gap: 5px; }
.collection-invoice-copy > span { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.collection-invoice-copy strong { font-size: 13px; }
.collection-invoice-copy > small { color: var(--text-muted); font-size: 10px; }
.collection-invoice-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.collection-invoice-badges small { padding: 3px 7px; border-radius: 999px; color: var(--charcoal); background: var(--yellow); font-size: 8px; }
.collection-invoice.is-overdue .collection-invoice-badges small:last-child { color: var(--danger-color); background: color-mix(in srgb, var(--danger-color) 12%, var(--surface)); }
.collection-invoice-amount { color: var(--ink); font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; white-space: nowrap; }
.collection-total { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 14px 16px; border-radius: var(--button-radius); color: var(--charcoal); background: var(--yellow); }
.collection-total span { font-size: 11px; text-transform: uppercase; }
.collection-total strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 24px; }
.collection-actions { position: sticky; bottom: 0; z-index: 4; }
.collection-report-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 20px 0; }
.collection-report-filters { display: grid; grid-template-columns: repeat(2, minmax(170px, 1fr)); gap: 12px; padding: 18px 20px 16px; }
.collection-report-filters label { min-width: 0; display: grid; gap: 7px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.collection-report-filters input, .collection-report-filters select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); background: var(--field-bg); }
.collection-report-body > .inline-status { margin: 0 20px 16px; }
.collection-report-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 20px 18px; }
.collection-report-summary article { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--surface-soft); }
.collection-report-summary article.is-total { border-color: var(--yellow); color: var(--charcoal); background: var(--yellow); }
.collection-report-summary span { font-size: 10px; letter-spacing: .03em; text-transform: uppercase; }
.collection-report-summary strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 22px; font-weight: 400; white-space: nowrap; }
.collection-report-groups { display: grid; gap: 18px; padding: 0 20px 20px; }
.collection-report-method { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.collection-report-method-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 17px; color: var(--section-header-text); background: var(--section-header-bg); }
.collection-report-method-head h3 { margin: 0; color: inherit; font-family: 'DM Serif Display', Georgia, serif; font-size: 20px; font-weight: 400; }
.collection-report-method-head > strong { font-family: 'DM Serif Display', Georgia, serif; font-size: 20px; font-weight: 400; }
.collection-report-journal { border-top: 1px solid var(--line); }
.collection-report-journal-head { min-height: 56px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 10px 16px; color: var(--charcoal); background: color-mix(in srgb, var(--yellow) 28%, var(--surface)); }
.collection-report-journal-head > div { min-width: 0; display: grid; gap: 3px; }
.collection-report-journal-head strong { font-size: 12px; }
.collection-report-journal-head small { overflow: hidden; color: color-mix(in srgb, var(--charcoal) 72%, transparent); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.collection-report-journal-head > strong { text-align: right; white-space: nowrap; }
.collection-report-tablewrap { overflow-x: auto; }
.collection-report-tablewrap table { width: 100%; min-width: 900px; border-collapse: collapse; }
.collection-report-tablewrap th { padding: 10px 12px; color: var(--table-text); background: var(--table-bg); font-size: 9px; text-align: left; text-transform: uppercase; }
.collection-report-tablewrap td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 11px; vertical-align: middle; }
.collection-report-tablewrap tr:last-child td { border-bottom: 0; }
.collection-report-tablewrap tbody tr:nth-child(even) td { background: var(--surface-soft); }
.collection-report-tablewrap td:last-child, .collection-report-tablewrap th:last-child { text-align: right; white-space: nowrap; }
.collection-report-tablewrap a { color: var(--ink); font-weight: 700; text-decoration-color: var(--yellow); text-underline-offset: 3px; }
.collection-report-print-frame { position: fixed; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }

@media (max-width: 760px) {
  .my-deliveries-view { min-width: 0; }
  .my-deliveries-view > .module-page-header { align-items: center; gap: 12px; padding: 16px; }
  .my-deliveries-view > .module-page-header h1 { font-size: clamp(25px, 8vw, 34px); }
  .my-deliveries-view > .module-page-header .page-subtitle { display: none; }
  .my-deliveries-view > .dev-alert { margin-bottom: 14px; padding: 12px 14px; font-size: 11px; }
  .my-deliveries-controls .panel-head { align-items: stretch; padding: 16px; }
  .my-deliveries-controls .panel-head > button { width: 100%; min-height: 48px; }
  .my-deliveries-filter { grid-template-columns: 1fr; gap: 12px; padding: 14px 16px 0; }
  .my-deliveries-filter input, .my-deliveries-filter select { height: 48px; font-size: 16px; }
  .my-deliveries-controls .inline-status { margin: 12px 16px 16px; padding: 12px; }
  .metrics.my-deliveries-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics.my-deliveries-metrics .metric { min-width: 0; }
  .my-deliveries-list-panel > .panel-head { padding: 16px; }
  .my-delivery-responsible-heading { min-height: 50px; padding: 11px 15px; }
  .my-delivery-row { grid-template-columns: 42px minmax(0, 1fr); gap: 10px 12px; min-height: 92px; padding: 14px; touch-action: manipulation; }
  .my-delivery-row .delivery-state { grid-column: 2; justify-self: start; }
  .my-delivery-order { width: 40px; height: 40px; font-size: 19px; }
  .my-delivery-copy strong, .my-delivery-copy span, .my-delivery-copy small { white-space: normal; }
  .my-delivery-copy strong { font-size: 14px; line-height: 1.2; }
  .my-delivery-copy span, .my-delivery-copy small { font-size: 11px; line-height: 1.3; }
  .my-delivery-dialog { inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; }
  .my-delivery-dialog > form { width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; }
  .my-delivery-dialog .appearance-head { min-height: 74px; align-items: center; padding: max(14px, env(safe-area-inset-top)) 16px 14px; }
  .my-delivery-dialog .appearance-head h2 { font-size: 25px; }
  .my-delivery-dialog .appearance-head p:last-child { overflow: hidden; max-width: 70vw; text-overflow: ellipsis; white-space: nowrap; }
  .my-delivery-dialog .page-back-button { min-width: 48px; width: 48px; height: 48px; }
  .my-delivery-body { padding: 12px 12px 24px; overscroll-behavior: contain; }
  .my-delivery-section { margin-top: 12px; border-radius: 14px; }
  .my-delivery-section > summary { min-height: 60px; grid-template-columns: minmax(0, 1fr) 22px; padding: 14px 16px; touch-action: manipulation; }
  .my-delivery-section > summary > span { font-size: 19px; }
  .my-delivery-section > summary > small { display: none; }
  .my-delivery-line-head { display: none; }
  .my-delivery-line { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; }
  .my-delivery-line > span:nth-child(2) { display: none; }
  .my-delivery-product strong { font-size: 14px; line-height: 1.3; }
  .my-delivery-product small { display: block; }
  .my-delivery-quantity { width: 100%; grid-template-columns: 52px minmax(70px, 1fr) 52px; }
  .my-delivery-quantity-button { min-height: 50px; font-size: 26px; touch-action: manipulation; }
  .my-delivery-line input { height: 50px; font-size: 18px; font-weight: 700; }
  .my-delivery-form-grid { grid-template-columns: 1fr; padding: 14px; }
  .my-delivery-comment-field, .my-delivery-backorder { grid-column: 1; }
  .my-delivery-form-grid select, .my-delivery-form-grid textarea, .my-delivery-form-grid input[type='file'] { min-height: 48px; font-size: 16px; }
  .my-delivery-form-grid textarea { min-height: 112px; }
  .my-delivery-form-grid .check { min-height: 48px; align-items: flex-start; }
  .my-delivery-signature-content { padding: 14px; }
  #my-delivery-signature { height: 210px; }
  .my-delivery-signature-actions { display: grid; grid-template-columns: 1fr; }
  .my-delivery-signature-actions button { width: 100%; min-height: 48px; }
  .my-delivery-final-check { min-height: 58px; margin-top: 14px; padding: 14px; align-items: flex-start; }
  .my-delivery-share { display: grid; grid-template-columns: 1fr; }
  .my-delivery-share a { width: 100%; min-height: 48px; }
  .my-delivery-actions { display: grid; grid-template-columns: minmax(100px, .65fr) minmax(0, 1.35fr); gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }
  .my-delivery-actions button { width: 100%; min-width: 0; min-height: 50px; padding-inline: 10px; }
  .my-deliveries-collection-actions { width: 100%; margin-bottom: 14px; }
  .my-deliveries-collection-actions button { min-height: 50px; }
  .collection-tool-dialog { inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; }
  .collection-tool-shell { width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; }
  .collection-tool-dialog .appearance-head { min-height: 74px; align-items: center; padding: max(14px, env(safe-area-inset-top)) 16px 14px; }
  .collection-tool-dialog .appearance-head h2 { font-size: 25px; }
  .collection-tool-dialog .appearance-head p:last-child { overflow: hidden; max-width: 70vw; text-overflow: ellipsis; white-space: nowrap; }
  .collection-tool-dialog .page-back-button { min-width: 48px; width: 48px; height: 48px; }
  .collection-client-search { grid-template-columns: 1fr; padding: 16px; }
  .collection-client-search input { min-height: 48px; font-size: 16px; }
  .collection-client-search button { width: 100%; min-height: 48px; }
  .collection-tool-body > .inline-status { margin-inline: 16px; }
  .collection-client-result { min-height: 72px; padding: 13px 16px; touch-action: manipulation; }
  .collection-dialog { inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; }
  .collection-dialog > form { width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; }
  .collection-dialog .appearance-head { min-height: 74px; align-items: center; padding: max(14px, env(safe-area-inset-top)) 16px 14px; }
  .collection-dialog .appearance-head h2 { font-size: 25px; }
  .collection-dialog .appearance-head p:last-child { overflow: hidden; max-width: 70vw; text-overflow: ellipsis; white-space: nowrap; }
  .collection-dialog .page-back-button { min-width: 48px; width: 48px; height: 48px; }
  .collection-body { padding: 12px 12px 24px; overscroll-behavior: contain; }
  .collection-methods { grid-template-columns: 1fr 1fr; gap: 8px; }
  .collection-methods label { min-height: 76px; padding: 11px; touch-action: manipulation; }
  .collection-section-head { align-items: stretch; flex-direction: column; }
  .collection-section-head button { width: 100%; min-height: 44px; }
  .collection-invoice { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; min-height: 84px; padding: 14px; touch-action: manipulation; }
  .collection-invoice-amount { grid-column: 2; font-size: 20px; }
  .collection-actions { display: grid; grid-template-columns: minmax(88px, .6fr) minmax(0, 1.4fr); gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }
  .collection-actions button { width: 100%; min-width: 0; min-height: 50px; padding-inline: 9px; }
  .collection-report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 16px 0; }
  .collection-report-actions .primary-action { grid-column: 1 / -1; }
  .collection-report-actions button { width: 100%; min-height: 46px; }
  .collection-report-filters { grid-template-columns: 1fr; padding: 16px; }
  .collection-report-filters input, .collection-report-filters select { min-height: 48px; font-size: 16px; }
  .collection-report-body > .inline-status { margin-inline: 16px; }
  .collection-report-summary { grid-template-columns: 1fr; padding-inline: 16px; }
  .collection-report-groups { padding-inline: 12px; }
  .collection-report-journal-head { grid-template-columns: 1fr; gap: 6px; }
  .collection-report-journal-head > strong { text-align: left; }
  .collection-report-tablewrap { overflow: visible; }
  .collection-report-tablewrap table, .collection-report-tablewrap tbody, .collection-report-tablewrap tr, .collection-report-tablewrap td { display: block; width: 100%; min-width: 0; }
  .collection-report-tablewrap thead { display: none; }
  .collection-report-tablewrap tr { border-bottom: 1px solid var(--line); }
  .collection-report-tablewrap tr:last-child { border-bottom: 0; }
  .collection-report-tablewrap td { min-height: 38px; display: grid; grid-template-columns: minmax(88px, 34%) minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); background: var(--surface) !important; overflow-wrap: anywhere; }
  .collection-report-tablewrap td::before { content: attr(data-label); color: var(--text-muted); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
  .collection-report-tablewrap td:last-child { border-bottom: 0; text-align: left; }
}

@media (max-width: 440px) {
  .metrics.my-deliveries-metrics { gap: 8px; }
  .metrics.my-deliveries-metrics .metric { min-height: 108px; padding: 12px; }
  .my-delivery-actions { grid-template-columns: 92px minmax(0, 1fr); }
  .my-delivery-actions button { font-size: 11px; }
  .client-detail-metrics,
  .client-detail-definition { grid-template-columns: 1fr; }
  .client-detail-receivables { grid-column: span 1; }
  .client-detail-pagination { grid-template-columns: 1fr 1fr; }
  .client-detail-pagination span { grid-column: 1 / -1; grid-row: 1; }
  .client-detail-pagination button { width: 100%; min-width: 0; }
}
