:root {
  color-scheme: light;
  --background: #f7f7f2;
  --surface: #fff;
  --ink: #202923;
  --muted: #5b665e;
  --line: #e3e6de;
  --sidebar: #1e2923;
  --accent: #e9b568;
  --green: #2c694c;
  --green-bg: #e9f3ec;
  --amber: #77551b;
  --amber-bg: #fcf1dc;
  --radius: 9px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
:focus-visible { outline: 2px solid #577c60; outline-offset: 2px; }
a { color: #286449; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3.1vw, 2.45rem); font-weight: 720; letter-spacing: -.055em; line-height: 1.15; }
h2 { font-size: 1.04rem; font-weight: 700; letter-spacing: -.014em; }
svg { display: block; width: 18px; height: 18px; flex: 0 0 auto; }
[hidden] { display: none !important; }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 233px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); color: #ebf0e8; min-width: 0; display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; height: 100dvh; padding: 24px 17px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 5px 8px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 11px; background: #344339; color: #e9bc7b; }
.brand-mark svg { width: 31px; height: 31px; }
.brand strong { display: block; font-size: 1.42rem; font-weight: 730; letter-spacing: -.045em; line-height: 1.05; }
.brand small { display: block; color: #afbbb1; margin-top: 4px; font-size: .77rem; }
.sidebar nav { display: grid; gap: 5px; margin-top: 37px; }
.nav-link { display: flex; align-items: center; min-height: 43px; gap: 11px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; color: #c7d0c7; text-decoration: none; font-size: .875rem; white-space: nowrap; }
.nav-link:hover { background: #28362e; color: #fff; }
.nav-link[aria-current="page"] { border-color: #4c513e; background: #343e32; color: #f2c589; font-weight: 650; }
.sidebar-bottom { margin-top: auto; padding: 14px 9px 0; border-top: 1px solid #3a4840; color: #b6c2b7; font-size: .8rem; line-height: 1.5; }
.sidebar-bottom p { margin: 8px 0 3px 14px; }
.offline-state { display: flex; align-items: center; gap: 8px; color: #e1ebe1; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #86b895; flex: 0 0 auto; }
.dot.pending { background: #e7b566; }
.workspace { min-width: 0; }
.topbar { min-height: 65px; background: #fff; border-bottom: 1px solid var(--line); padding: 8px clamp(19px, 3.1vw, 45px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .875rem; }
.breadcrumb svg { width: 13px; height: 13px; color: #839084; }
.breadcrumb strong { font-weight: 630; color: var(--ink); }
.top-actions, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-actions { flex-wrap: nowrap; }
.main { max-width: 1580px; margin: 0 auto; padding: 30px clamp(19px, 3.1vw, 45px) 32px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 23px; }
.heading p { color: var(--muted); margin-top: 8px; font-size: .9rem; line-height: 1.45; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-weight: 620; font-size: .865rem; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #a9b4a7; background: #f3f5ef; }
.btn.primary { background: var(--accent); border-color: #dba658; color: #302313; min-height: 41px; padding-inline: 14px; }
.btn.primary:hover { background: #f3c482; border-color: #d19e55; }
.btn.subtle { border-color: transparent; background: transparent; }
.btn.subtle:hover { background: #eef1e9; }
.btn.danger { color: #9a3831; }
.btn[disabled] { opacity: .55; cursor: wait; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); }
.icon-btn:hover { background: #eef2ea; color: var(--ink); }
.connection { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: .82rem; padding-right: 7px; white-space: nowrap; }
.connection .dot { background: #59976d; }
.connection .dot.pending { background: #b78229; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.metric-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: #edf1e9; color: #4e6b56; flex: 0 0 auto; }
.metric-icon.alert { background: #f9efd9; color: #8e672c; }
.metric strong { display: block; font-size: 1.2rem; font-weight: 710; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric span:last-child { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 11px; margin-bottom: 12px; min-height: 37px; background: #eef0e8; color: #4f6052; border: 1px solid #e0e5d8; border-radius: 7px; font-size: .82rem; }
.notice > span { display: flex; align-items: center; gap: 8px; }
.notice svg { width: 15px; height: 15px; }
.text-btn { border: none; background: none; padding: 4px 0; color: #335941; font-size: .82rem; font-weight: 680; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel + .panel { margin-top: 15px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; position: relative; flex: 1 1 205px; min-width: 0; }
.search > svg { position: absolute; left: 11px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.search input { width: 100%; min-width: 0; padding-left: 34px; }
input, select, textarea { min-height: 36px; border: 1px solid #dce1d8; background: #fff; border-radius: 6px; color: var(--ink); padding: 7px 9px; font-size: .875rem; }
select { appearance: none; padding-right: 25px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235b665e' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-position: right 7px center; background-repeat: no-repeat; background-size: 13px; }
.filters select { min-width: 0; max-width: 190px; }
input::placeholder, textarea::placeholder { color: #68746b; opacity: 1; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .875rem; }
th { color: #526056; background: #f5f7f2; padding: 11px 12px; font-size: .78rem; font-weight: 660; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid #edf0e9; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 15px; }
th:last-child, td:last-child { padding-right: 15px; }
tr:hover td { background-color: #f9faf6; }
td strong { font-weight: 680; }
.desc { color: var(--muted); display: block; font-size: .77rem; line-height: 1.38; margin-top: 3px; }
.material { min-width: 195px; }
.supplier-cell { min-width: 130px; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money { display: inline-flex; align-items: center; justify-content: end; gap: 4px; font-weight: 680; font-variant-numeric: tabular-nums; }
.money.best { color: #206044; background: var(--green-bg); border-radius: 5px; padding: 3px 6px; }
.money.best svg { width: 12px; height: 12px; }
.money.unknown, .muted { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 5px; font-size: .75rem; line-height: 1.28; white-space: nowrap; background: #eef1eb; color: #465449; }
.chip.available { color: #286146; background: #e9f3ec; }
.chip.order, .chip.old { color: var(--amber); background: var(--amber-bg); }
.chip.out { color: #953e3b; background: #faece9; }
.chip .dot { background: currentColor; width: 5px; height: 5px; }
.date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.date-cell .chip { margin-top: 3px; }
.row-actions { text-align: right; white-space: nowrap; }
.table-footer { min-height: 38px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.table-footer > span:last-child { display: flex; align-items: center; gap: 5px; }
.table-footer svg { color: var(--green); width: 14px; height: 14px; }
.empty { padding: 33px 16px; text-align: center; color: var(--muted); line-height: 1.5; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.settings { display: grid; gap: 12px; max-width: 900px; }
.settings .panel { padding: 16px; margin: 0; }
.settings h2 { margin-bottom: 7px; }
.settings p { color: var(--muted); font-size: .875rem; line-height: 1.5; margin-bottom: 10px; }
.settings .grid { margin: 12px 0; }
.settings .grid:last-child { margin-bottom: 0; }
dialog { width: min(650px, calc(100vw - 22px)); max-height: calc(100dvh - 24px); padding: 0; color: var(--ink); border: 1px solid #d0d9ce; border-radius: 12px; background: white; box-shadow: 0 14px 48px #18271e38; }
dialog.wide { width: min(1280px, calc(100vw - 22px)); }
dialog::backdrop { background: #1a2b2280; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.24rem; }
.dialog-head p, .help { margin-top: 4px; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.dialog-body { padding: 15px 17px; }
.dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 17px; border-top: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.grid label, label.field { display: grid; gap: 4px; min-width: 0; font-weight: 610; font-size: .84rem; }
.grid input, .grid textarea, .grid select { width: 100%; min-width: 0; font-weight: 400; }
.grid .full { grid-column: 1 / -1; }
.grid h3 { font-size: .92rem; margin-top: 4px; }
.grid textarea { resize: vertical; min-height: 65px; }
.form-error { margin-top: 9px; font-size: .87rem; color: #94382f; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: .87rem; }
.switch input { min-height: 0; width: 17px; height: 17px; }
.details { display: grid; grid-template-columns: minmax(110px, .5fr) 1fr; gap: 8px 13px; font-size: .87rem; margin: 0; }
.details dt { font-weight: 640; }
.details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet { margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; max-height: 48dvh; }
.sheet table { width: max-content; min-width: 100%; }
.sheet th { position: sticky; top: 0; z-index: 1; }
.sheet th, .sheet td { padding: 4px 5px; }
.sheet input { width: 103px; min-height: 35px; padding: 5px 7px; }
.sheet [data-column="supplier"], .sheet [data-column="name"], .sheet [data-column="address"] { width: 170px; }
.sheet [data-column="date"], .sheet [data-column="availability"], .sheet [data-column="presentation"] { width: 126px; }
.sheet .icon-btn { width: 29px; }
.sheet-tools { margin-top: 10px; }
.toast { position: fixed; z-index: 5; bottom: 15px; right: 16px; max-width: calc(100vw - 32px); border-radius: 8px; padding: 11px 15px; background: #25362c; color: white; font-size: .9rem; box-shadow: 0 4px 22px #24362929; }
.toast.error { background: #80342d; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1060px) {
  .shell { grid-template-columns: 193px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .compare-table { min-width: 735px; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 11px 12px 0; }
  .sidebar nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 11px; gap: 4px; padding-bottom: 8px; }
  .brand { padding: 0 4px; gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark svg { width: 27px; height: 27px; }
  .brand strong { font-size: 1.24rem; }
  .brand small { margin-top: 2px; }
  .nav-link { justify-content: center; gap: 5px; padding: 4px 3px; min-height: 40px; font-size: .77rem; white-space: normal; }
  .nav-link svg { width: 15px; height: 15px; }
  .nav-link .long-label { display: none; }
  .sidebar-bottom { display: none; }
  .topbar { min-height: 51px; padding: 6px 13px; }
  .main { padding: 20px 13px 22px; }
  .heading { margin-bottom: 15px; }
  .heading p { margin-top: 5px; }
  .filters select { flex: 1 1 123px; max-width: none; }
  .filters .search { flex-basis: 100%; }
  .metrics { margin-bottom: 14px; gap: 6px; }
  .metric { padding: 8px; gap: 7px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-icon svg { width: 15px; height: 15px; }
}
@media (max-width: 470px) {
  .breadcrumb > :not(strong) { display: none; }
  .connection { padding-right: 0; font-size: .75rem; }
  .heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .metric { align-items: flex-start; flex-direction: column; }
  .metric strong { font-size: 1.1rem; }
  .metric span:last-child { font-size: .71rem; }
  .notice { align-items: flex-start; padding-block: 7px; }
  .notice .text-btn { flex: 0 0 93px; text-align: right; }
  .filters { gap: 6px; padding: 8px; }
  .dialog-body, .dialog-head, .dialog-foot { padding-inline: 12px; }
  dialog input, dialog select, dialog textarea { font-size: 1rem; }
}
.inline-edit { display: inline-flex; align-items: center; gap: 2px; }
.inline-price { width: 91px; }
.inline-edit .icon-btn { width: 26px; }
.inline-edit .icon-btn svg { width: 15px; }
.link-name { border: 0; background: none; text-align: left; padding: 0; font-weight: 680; }
.link-name:hover { text-decoration: underline; }
.import-preview > .field, .import-preview > .grid { margin-top: 13px; }
.settings .panel p:last-child { margin-bottom: 0; }
@media (max-width: 560px) {
  .compare-table { min-width: 0; }
  .compare-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .compare-table tbody, .compare-table { display: block; }
  .compare-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 9px;
    row-gap: 5px;
    padding: 10px 12px;
    border-top: 1px solid #edf0e9;
  }
  .compare-table tr:first-child { border-top: 0; }
  .compare-table td { border: 0; padding: 0; min-width: 0; }
  .compare-table td:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
  .compare-table td:nth-child(2) { grid-area: 3 / 1; }
  .compare-table td:nth-child(3) { grid-area: 2 / 1 / 3 / 3; font-size: .82rem; }
  .compare-table td:nth-child(4) { grid-area: 1 / 3; }
  .compare-table td:nth-child(5) { grid-area: 2 / 3; justify-self: end; }
  .compare-table td:nth-child(6) { grid-area: 3 / 2; font-size: .75rem; }
  .compare-table td:nth-child(7) { grid-area: 3 / 3; }
  .compare-table .icon-btn { width: 34px; height: 34px; }
  .compare-table .chip { max-width: 100%; white-space: normal; }
  .compare-table .desc { overflow-wrap: anywhere; }
  .compare-table .money { font-size: .9rem; }
}
@media (min-width: 1090px) {
  .filters:has(select[aria-label="Orden"]) { flex-wrap: nowrap; }
  .filters:has(select[aria-label="Orden"]) .search { flex-basis: 160px; }
  .filters select[aria-label="Categoría"] { width: 115px; }
  .filters select[aria-label="Proveedor"] { width: 126px; }
  .filters select[aria-label="Disponibilidad"] { width: 135px; }
  .filters select[aria-label="Vigencia"] { width: 109px; }
  .filters select[aria-label="Orden"] { width: 128px; }
  .compare-table th, .compare-table td { padding-inline: 9px; }
  .compare-table .material { min-width: 180px; }
  .compare-table .supplier-cell { min-width: 112px; }
}
