:root {
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
  background: #f3f5fa;
  color: #17233b;
  --muted: #505f76;
  --line: #dbe2ef;
  --blue: #1745b5;
  --blue-hover: #103591;
  --blue-light: #e4edff;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #5279da; outline-offset: 3px; }
main:focus { outline: none; }
.masthead, main, .footer { width: min(100% - 2rem, 680px); margin-inline: auto; }
.masthead {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.14rem; letter-spacing: -.045em; }
.brand span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--blue); color: #fff; }
.connection { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; }
.connection::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3a8950; }
.connection.offline::before { background: #a7681d; }
main { padding-block: clamp(22px, 5vw, 46px) 28px; }
h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.065em; line-height: 1.06; }
p { line-height: 1.55; }
.intro { margin: .6rem 0 1.35rem; color: var(--muted); }
.home-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
#cambiar-usuario[hidden] { display: none; }
.quiet, .back {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  gap: 5px; padding: 0 .65rem; border: 0; background: transparent; color: var(--blue);
  font-size: .85rem; font-weight: 650;
}
.quiet:hover, .back:hover { text-decoration: underline; }
.back {
  min-height: 48px; padding-inline: 1rem; margin: 0 0 1rem;
  border: 1px solid #c5d4f3; border-radius: 10px;
  background: var(--blue-light); font-size: 1rem; gap: .5rem;
}
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(9px, 2.5vw, 16px); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  min-height: 146px; padding: clamp(12px, 3vw, 23px); background: #fff;
  border: 1px solid var(--line); border-radius: 18px;
}
.tile:hover { border-color: #7897dc; }
.tile.featured { background: var(--blue); color: #fff; border-color: var(--blue); }
.tile.featured:hover { background: var(--blue-hover); }
.tile-icon {
  display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 14px;
  border-radius: 11px; background: var(--blue-light); color: var(--blue);
}
.featured .tile-icon { background: #fff; }
.tile-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.arrow { position: absolute; top: 13px; right: 15px; color: var(--muted); }
.featured .arrow { color: #fff; }
.tile strong { font-size: clamp(1.05rem, 3.5vw, 1.35rem); letter-spacing: -.025em; }
small { display: block; margin-top: .25rem; color: var(--muted); line-height: 1.35; }
.featured small { color: var(--blue-light); }
.summary {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px;
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  color: var(--muted); font-size: .82rem;
}
.summary strong { margin-left: 5px; color: var(--blue); }
.login { max-width: 460px; margin-inline: auto; }
label { display: block; margin-bottom: .4rem; font-weight: 650; }
input, select {
  width: 100%; min-height: 46px; padding: .65rem .75rem; border-radius: 9px;
  border: 1px solid #aeb9cc; color: inherit; background: white;
}
#acceso input { margin-bottom: 1rem; }
.primary {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 46px; padding: .7rem 1rem; border: 0; border-radius: 10px;
  background: var(--blue); color: #fff; font-weight: 650;
}
.primary:hover { background: var(--blue-hover); }
form .primary { width: 100%; }
.hint, .empty { color: var(--muted); }
.hint { font-size: .88rem; }
.feedback, .confirmation { font-size: .9rem; margin: .75rem 0; }
.feedback:empty, .confirmation:empty { display: none; }
.confirmation { color: var(--blue); }
.list, fieldset { padding: 0; margin: 1rem 0; border: 0; }
.row, .order, .panel {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .8rem; margin-bottom: .5rem;
}
.row, .order summary, .total {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.row .quiet { flex-shrink: 0; }
.row input { width: 4.8rem; flex-shrink: 0; }
legend { margin-bottom: .55rem; font-weight: 650; }
.total { margin-block: 1rem; font-weight: 700; }
.order { padding: .95rem; }
.order:last-of-type { margin-bottom: 1rem; }
.order summary { cursor: pointer; }
.order-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.order-header button { flex-shrink: 0; }
.order-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: .35rem;
  margin-bottom: .85rem; padding: .3rem;
  border: 1px solid var(--line); border-radius: 12px; background: white;
}
.order-tabs a {
  display: grid; place-items: center; min-height: 44px; padding: .35rem;
  border-radius: 8px; color: var(--blue); font-weight: 650; text-align: center;
}
.order-tabs a[aria-current] { background: var(--blue); color: white; }
.order-pending { background: #fff7e6; border-color: #e9cc93; }
.order-archived { background: #eaf3ff; border-color: #baccf1; }
.order-header + details > summary { padding-block: .45rem; font-size: .85rem; color: var(--blue); }
.order summary > span::before { content: "▸ "; color: var(--blue); }
.order[open] summary > span::before { content: "▾ "; }
.line { min-width: 0; }
.line { margin-block: .3rem; padding: 0 .6rem; }
.line summary { min-height: 44px; gap: .5rem; font-size: .8rem; }
.line-name { min-width: 0; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.line-quantity { flex-shrink: 0; color: var(--blue); font-weight: 700; }
.line-editor { padding-bottom: .45rem; }
.line small { margin: 0 0 .25rem; }
.line label { font-size: .85rem; margin-bottom: 0; }
.line-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.line-fields input, .export input { margin-top: .25rem; }
.line-fields input { padding-block: .35rem; }
.line-actions { display: flex; justify-content: space-between; gap: .5rem; }
.reason-toggle { padding-inline: 0; }
.order-save {
  position: sticky; bottom: 0; z-index: 1;
  padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom, 0px));
  background: #f3f5fa; border-top: 1px solid var(--line);
}
.order-save > div { display: flex; align-items: center; gap: .4rem; }
.article-result { display: flex; width: 100%; justify-content: flex-start; text-align: left; }
.sync-receive { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.article-picker {
  position: fixed; inset: var(--picker-top, 0px) 0 auto; margin: 0 auto;
  width: min(100%, 42rem); max-width: 100%; height: var(--picker-height, 100dvh);
  max-height: none; padding: 0; border: 0; background: white; color: inherit;
}
.article-picker[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.article-picker::backdrop { background: rgb(0 0 0 / .35); }
.picker-header {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  padding: .35rem .75rem .65rem; border-bottom: 1px solid var(--line);
}
.picker-header input { grid-column: 1 / -1; font-size: 16px; }
.picker-header .sale-warning { grid-column: 1 / -1; margin: .35rem 0 0; color: #9b2c22; font-weight: 650; }
.picker-header .sale-warning:empty { display: none; }
.picker-results { overflow-y: auto; overscroll-behavior: contain; padding: 0 .75rem; }
.picker-results button + button { border-top: 1px solid var(--line); }
.customer-label { margin: 0 0 .4rem; font-weight: 650; }
.customer-choice, .selected-customer {
  display: block; width: 100%; min-height: 46px; padding: .65rem .75rem;
  border: 1px solid #aeb9cc; border-radius: 9px; background: white; color: inherit; text-align: left;
}
.customer-choice { background: var(--blue-light); color: var(--blue); font-weight: 650; }
.customer-result {
  display: flex; width: 100%; flex-direction: column; align-items: flex-start;
  gap: .15rem; padding: .55rem .5rem; text-align: left;
}
.customer-result small { margin: 0; }
.zone-filter { display: block; margin: .5rem 0; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.zone-filter summary { padding: .55rem .75rem; cursor: pointer; min-height: 44px; box-sizing: border-box; }
.zone-filter summary span { color: var(--muted); margin-right: .6rem; }
.zone-filter summary strong { font-size: 14px; font-weight: 600; }
.zone-options { max-height: 34dvh; overflow-y: auto; border-top: 1px solid var(--line); padding: .25rem; }
.zone-options button { display: block; width: 100%; min-height: 44px; padding: .55rem .65rem; border: 0; border-radius: 6px; background: white; color: inherit; font: inherit; text-align: left; }
.zone-options button[aria-pressed="true"] { color: var(--blue); background: var(--blue-light); font-weight: 600; }
.zone-options button:focus-visible, .zone-filter summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.picker-header .zone-filter { grid-column: 1 / -1; }
.zone-filter[hidden] { display: none; }
.customer-list { max-height: 55dvh; padding: 0; margin-top: .6rem; }
.customer-browsing .masthead, .compact-screen .masthead { min-height: 52px; }
.compact-screen main { padding-block: .5rem 1rem; }
.compact-screen .order-tabs { margin-block: .5rem; }
.compact-screen .sync-receive { margin-top: .75rem; padding-top: .75rem; }
.compact-screen .footer { display: none; }
.customer-browsing main { display: flex; flex-direction: column; height: calc(100dvh - 52px); padding-block: .5rem; }
.customer-browsing main > :not(.customer-list) { flex-shrink: 0; }
.customer-list-heading { display: flex; align-items: center; gap: .85rem; margin-bottom: .5rem; }
.customer-list-heading .back { margin: 0; min-height: 44px; font-size: .85rem; padding-inline: .75rem; }
.customer-list-heading h1 { font-size: 1.4rem; letter-spacing: -.035em; }
.customer-browsing .customer-list { flex: 1; min-height: 0; max-height: none; margin-top: .25rem; }
.customer-browsing .footer { display: none; }
.customer-actions { display: grid; grid-template-columns: repeat(3, minmax(0, max-content)); gap: .5rem; margin-bottom: 1rem; }
.customer-actions .back { margin: 0; }
.customer-actions > * { text-align: center; padding-inline: .65rem; }
@media (max-width: 430px) {
  .customer-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
  .customer-actions > * { font-size: .8rem; padding-inline: .25rem; }
}
.customer-details { background: white; border: 1px solid var(--line); border-radius: 10px; padding: .3rem .85rem; }
.customer-details > div { display: grid; grid-template-columns: 42% 1fr; gap: .6rem; padding: .55rem 0; overflow-wrap: anywhere; }
.customer-details > div + div { border-top: 1px solid var(--line); }
.customer-details dt { color: var(--muted); font-size: .85rem; }
.customer-details dd { margin: 0; }
#form-vendedor input { margin-bottom: .65rem; }
#form-vendedor input[type="checkbox"] { width: auto; min-height: auto; margin-right: .4rem; }
.account-movements { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 10px; }
.account-movements table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: .85rem; }
.account-movements :is(th, td) { padding: .55rem .65rem; text-align: left; }
.account-movements th { background: var(--blue-light); }
.account-movements td { border-top: 1px solid var(--line); }
.account-movements :is(th, td):nth-last-child(-n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.export { display: grid; gap: .5rem; max-width: 22rem; }
.panel { display: flex; align-items: center; gap: 13px; padding: 1rem; }
.count { font-size: 1.75rem; color: var(--blue); }
.footer { border-top: 1px solid var(--line); padding-block: 16px; color: var(--muted); font-size: .78rem; }
.footer span { margin-inline: .22rem; }
