@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --ink: #10283d;
  --muted: #4f6275;
  --line: #cbd6e0;
  --surface: #ffffff;
  --canvas: #e8eef4;
  --navy: #102f4b;
  --blue: #176276;
  --teal: #c6e3df;
  --amber: #d88934;
  --amber-soft: #fff3e5;
  --red: #b95648;
  --green: #2c806c;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }

.sidebar { background: var(--navy); color: #eef5f7; display: flex; flex-direction: column; padding: 25px 16px 18px; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; padding: 0 9px 32px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; background: #e0f1ec; color: var(--navy); font: 800 20px 'Manrope', sans-serif; }
.brand strong { display: block; font: 800 17px 'Manrope', sans-serif; letter-spacing: -.3px; }
.brand small { display: block; margin-top: 2px; color: #adc0cb; font-size: 9px; letter-spacing: 1.7px; }
.nav { display: grid; gap: 7px; }
.nav-item { border: 0; background: transparent; color: #b9cbd4; padding: 12px 13px; border-radius: 9px; text-align: left; display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; transition: .15s ease; }
.nav-item span { width: 18px; color: #8fb0b9; font-size: 17px; text-align: center; }
.nav-item:hover { background: #214665; color: white; }
.nav-item.active { color: #fff; background: #2c536e; box-shadow: inset 3px 0 #9bd1c7; }
.nav-item.active span { color: #b3e4da; }
.sidebar-bottom { margin-top: auto; padding: 14px 9px 4px; border-top: 1px solid #34536b; }
.source-state { display: flex; align-items: center; gap: 8px; color: #c4d3db; font-size: 11px; margin-bottom: 15px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d9a14d; box-shadow: 0 0 0 3px #ffffff17; }
.status-dot.ready { background: #7ed0a4; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 700; padding: 6px 0; }
.sidebar .text-button { color: #b3d8da; }

.main-content { min-width: 0; padding: 0 34px 26px; }
.topbar { min-height: 92px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.eyebrow { color: #8090a0; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; margin: 0 0 5px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font: 700 22px 'Manrope', sans-serif; letter-spacing: -.5px; }
.top-actions { display: flex; align-items: center; gap: 11px; }
.date-control { display: grid; gap: 4px; font-size: 10px; color: var(--muted); }
.date-control input { width: 146px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; padding: 7px 9px; font-size: 12px; }
.button { border-radius: 8px; padding: 10px 14px; font-size: 11px; font-weight: 700; transition: .15s ease; }
.button-outline { border: 1px solid #cfd9e1; color: var(--navy); background: white; }
.button-outline:hover { border-color: var(--blue); background: #f7fbfb; }
.view { display: none; padding-top: 26px; }
.view.active { display: block; }
.intro-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 18px; }
.intro-row h2 { font: 700 17px 'Manrope', sans-serif; margin: 0 0 4px; letter-spacing: -.3px; }
.intro-row p { color: var(--muted); font-size: 11px; margin: 0; }
.period-pill, .result-count { background: #e8f0f3; color: #4f697b; border-radius: 999px; padding: 7px 11px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.notice { margin-top: 15px; border-radius: 8px; padding: 10px 13px; background: #fff4df; color: #795a2b; font-size: 12px; }
.notice.error { background: #fff0ed; color: #954c40; }
.notice.success { background: #e9f6ef; color: #286d58; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 15px; }
.kpi-card { min-height: 109px; padding: 16px 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); display: flex; flex-direction: column; align-items: flex-start; }
.kpi-label { color: var(--muted); font-size: 10px; font-weight: 600; }
.kpi-card strong { margin-top: 10px; font: 800 23px 'Manrope', sans-serif; letter-spacing: -.7px; color: #183a54; }
.kpi-card small { margin-top: 3px; color: #99a4b1; font-size: 9px; }
.kpi-priority { background: #fffbf4; border-color: #f2e1ca; }
.kpi-priority strong { color: #a96b27; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(400px, .92fr); gap: 14px; margin-bottom: 15px; }
.inventory-dashboard-grid { display: flex; flex-direction: column; gap: 15px; }
.inventory-dashboard-grid > .panel { width: 100%; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 17px 18px; box-shadow: 0 2px 8px #18375005; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.panel-heading h3 { font: 700 13px 'Manrope', sans-serif; letter-spacing: -.2px; margin: 0 0 3px; }
.panel-heading p { color: #8a98a6; font-size: 10px; margin: 0; }
.legend { color: #8593a0; font-size: 9px; display: flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.table-scroll { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { color: #8593a0; text-transform: uppercase; font-size: 8px; font-weight: 700; letter-spacing: .65px; padding: 9px 8px; border-bottom: 1px solid var(--line); }
td { padding: 9px 8px; border-bottom: 1px solid #edf1f4; color: #435669; font-size: 10px; }
tbody tr:last-child td { border-bottom: 0; }
.summary-table td:not(:first-child), .summary-table th:not(:first-child) { text-align: right; }
.age-name { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: #3b5063; }
.age-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6fb4a8; }
.age-dot.warm { background: #d9a34e; }
.age-dot.hot { background: #c46d58; }
.bar-cell { width: 78px; }
.bar-track { height: 5px; width: 65px; background: #edf1f3; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: #83bcb3; }
.bar-fill.warm { background: #ddb56e; }
.bar-fill.hot { background: #ca7967; }
.matrix-table { min-width: 470px; }
.matrix-table th, .matrix-table td { text-align: center; padding: 9px 6px; }
.matrix-table th:first-child, .matrix-table td:first-child { text-align: left; }
.matrix-cell { cursor: pointer; border: 1px solid white; border-radius: 4px; font-weight: 700; transition: transform .12s ease, outline .12s ease; }
.matrix-cell:hover, .matrix-cell.selected { outline: 2px solid var(--blue); transform: translateY(-1px); }
.panel-footnote { color: #98a4af; font-size: 9px; margin: 10px 0 0; }
.priority-panel { margin-bottom: 5px; }
.data-table .sku-cell { white-space: normal; min-width: 205px; }
.sku-code { display: block; color: #1d526b; font-size: 10px; font-weight: 700; }
.sku-code-link { width: fit-content; padding: 0; border: 0; background: none; text-align: left; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.sku-code-link:hover, .sku-code-link:focus-visible { color: #0b765f; }
.sku-desc { display: block; color: #8996a3; font-size: 9px; margin-top: 3px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 7px; color: #607987; background: #edf3f4; font-size: 9px; font-weight: 600; }
.badge.priority { background: #fff1df; color: #976023; }
.badge.critical { background: #fceae7; color: #a65347; }
.action-copy { color: #597181; font-size: 9px; white-space: normal; min-width: 140px; max-width: 190px; }
.add-button { border: 1px solid #d1e4e2; background: #f5fbfa; color: #347b76; border-radius: 6px; padding: 6px 8px; font-size: 9px; font-weight: 700; }
.add-button:hover { background: #e8f5f3; }
.add-button:disabled { color: #a8b1b8; border-color: #edf0f1; background: #f7f8f9; cursor: not-allowed; }

.filters-panel { display: flex; align-items: flex-end; gap: 13px; padding: 13px; margin-bottom: 12px; }
.filters-panel label { display: grid; gap: 5px; min-width: 140px; color: #8794a0; font-size: 9px; }
.filters-panel select, .search-field input { border: 1px solid var(--line); border-radius: 7px; background: white; color: #3f5364; padding: 9px 10px; font-size: 10px; min-height: 35px; }
.search-field { flex: 1; min-width: 190px !important; position: relative; }
.search-field > span { position: absolute; left: 10px; top: 7px; font-size: 17px; color: #90a0ac; }
.search-field input { padding-left: 31px; width: 100%; }
.filters-panel .check-filter { display: flex; align-items: center; gap: 6px; min-width: auto; height: 35px; color: #627688; font-size: 10px; white-space: nowrap; }
.check-filter input { accent-color: #347b76; }
.list-panel { padding: 0; }
.full-table { min-width: 970px; }
.full-table th { position: sticky; top: 0; background: #fff; z-index: 1; }
.full-table td { padding-top: 10px; padding-bottom: 10px; }
.empty-state { padding: 38px 15px; text-align: center; font-size: 12px; color: #8493a0; }
.sim-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); gap: 15px; }
.basket-panel, .sim-panel { min-height: 330px; }
.basket-items { display: grid; gap: 8px; min-height: 140px; align-content: start; }
.basket-empty { color: #99a5b0; font-size: 11px; padding: 38px 5px; text-align: center; }
.basket-line { display: grid; grid-template-columns: minmax(0,1fr) 68px 86px 22px; align-items: center; gap: 10px; padding: 9px; border: 1px solid #edf0f3; border-radius: 8px; }
.basket-line strong { display: block; font-size: 10px; color: #31536a; }
.basket-line small { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8a97a3; font-size: 9px; margin-top: 3px; }
.basket-line input { width: 58px; border: 1px solid var(--line); border-radius: 5px; padding: 5px; font-size: 10px; }
.basket-line .line-total { color: #53697a; font-size: 10px; text-align: right; }
.remove-item { border: 0; background: transparent; color: #b46e62; font-size: 15px; }
.basket-total { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; display: flex; justify-content: space-between; color: #748492; font-size: 10px; }
.basket-total strong { font: 700 15px 'Manrope', sans-serif; color: #274b62; }
.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 13px; }
.tier-grid label { display: grid; gap: 6px; color: #82909d; font-size: 9px; }
.tier-grid label div, .floor-control div { position: relative; }
.tier-grid input, .floor-control input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 24px 8px 9px; color: #294d62; font-weight: 700; font-size: 12px; }
.tier-grid b, .floor-control b { position: absolute; right: 9px; top: 8px; color: #8b9aa5; font-size: 10px; }
.floor-control { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: 14px; padding: 11px 0 13px; border-top: 1px solid #edf0f2; color: #758695; font-size: 10px; }
.sim-result { background: #f4f8f8; border-radius: 9px; padding: 12px; }
.sim-discount { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid #e1ebeb; color: #768b91; font-size: 10px; }
.sim-discount strong { color: #26756e; font: 800 20px 'Manrope', sans-serif; }
.sim-metrics { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px 16px; padding-top: 10px; }
.sim-metrics span { display: block; color: #8b999f; font-size: 9px; margin-bottom: 4px; }
.sim-metrics strong { color: #3b5666; font-size: 12px; }
.sim-note { color: #96a1a9; font-size: 9px; line-height: 1.5; margin: 11px 0 0; }
.app-footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 13px 2px 0; display: flex; justify-content: space-between; gap: 12px; color: #9aa5ae; font-size: 9px; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 195px minmax(0,1fr); }
  .main-content { padding-inline: 22px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .matrix-table { min-width: 100%; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { min-height: 0; padding: 12px 14px; flex-direction: row; align-items: center; justify-content: space-between; }
  .brand { padding: 0; }
  .brand-mark { width: 32px; height: 32px; }
  .nav { display: flex; gap: 3px; }
  .nav-item { padding: 8px 9px; font-size: 10px; }
  .nav-item span { display: none; }
  .sidebar-bottom { display: none; }
  .main-content { padding: 0 13px 20px; }
  .topbar { align-items: flex-start; padding: 17px 0; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .date-control { flex: 1; }
  .date-control input { width: 100%; max-width: 190px; }
  .view { padding-top: 18px; }
  .intro-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .kpi-card { min-height: 96px; padding: 12px; }
  .kpi-card strong { font-size: 19px; }
  .panel { padding: 13px; }
  .dashboard-grid { display: block; }
  .dashboard-grid > .panel + .panel { margin-top: 11px; }
  .filters-panel { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .filters-panel .search-field { grid-column: 1 / -1; }
  .filters-panel label { min-width: 0; }
  .filters-panel .check-filter { grid-column: 1 / -1; }
  .sim-grid { grid-template-columns: 1fr; }
  .app-footer { flex-direction: column; }
}

/* Legibilidad y separación visual */
body { font-size: 16px; }
.main-content { color: #10283d; }
.topbar, .app-footer { border-color: #c2cfdb; }
.eyebrow, .panel-heading p, .legend, th,
.kpi-label, .kpi-card small, .intro-row p, .panel-footnote,
.sku-desc, .filters-panel label, .search-field > span,
.basket-line small, .basket-empty, .floor-control,
.sim-discount, .sim-metrics span, .sim-note {
  color: #53677b;
}
.eyebrow { font-size: 11px; }
h1 { font-size: 25px; }
.intro-row h2 { font-size: 20px; }
.intro-row p { font-size: 14px; }
.nav-item { font-size: 15px; }
.source-state { font-size: 13px; }
.date-control { font-size: 12px; color: #455b70; }
.date-control input { font-size: 14px; border-color: #aebdca; }
.button { font-size: 13px; }
.button-outline { border-color: #aebdca; }
.period-pill, .result-count { font-size: 12px; color: #304e67; background: #dbe6ee; }
.notice { font-size: 14px; }
.kpi-card, .panel { border-color: #c5d1dc; box-shadow: 0 3px 10px #142f4712; }
.kpi-card { background: #fff; }
.kpi-label { font-size: 13px; }
.kpi-card strong { font-size: 26px; }
.kpi-card small { font-size: 11px; }
.panel-heading h3 { font-size: 16px; }
.panel-heading p { font-size: 12px; }
.legend { font-size: 11px; }
th { font-size: 10px; color: #455b70; }
td { font-size: 12px; color: #2f455a; }
.age-name { color: #263f55; }
.panel-footnote { font-size: 11px; }
.sku-code { font-size: 12px; }
.sku-desc { font-size: 11px; }
.badge { font-size: 11px; color: #334f63; background: #dce7ea; }
.action-copy { font-size: 11px; color: #3e586d; }
.add-button { font-size: 11px; border-color: #9fc6c1; background: #e7f3f1; color: #155c55; }
.filters-panel { background: #f8fafc; border-color: #b9c8d5; }
.filters-panel label { font-size: 12px; color: #40576c; }
.filters-panel select, .search-field input { font-size: 13px; border-color: #aebdca; color: #20394f; }
.filters-panel .check-filter { font-size: 12px; color: #40576c; }
.full-table th { background: #edf3f7; }
.full-table tbody tr:nth-child(even) { background: #f4f7fa; }
.full-table tbody tr:hover { background: #e7f0f4; }
.empty-state { font-size: 14px; color: #52677b; }
.basket-line { border-color: #c8d4de; background: #fbfcfd; }
.basket-line strong { font-size: 12px; color: #203f57; }
.basket-line small { font-size: 11px; }
.basket-line input { font-size: 12px; border-color: #aebdca; }
.basket-line .line-total { font-size: 12px; }
.basket-empty { font-size: 13px; }
.basket-total { color: #4f6477; font-size: 12px; }
.tier-grid label { font-size: 11px; color: #4b6074; }
.tier-grid input, .floor-control input { font-size: 14px; border-color: #aebdca; }
.sim-result { background: #e7f0f1; border: 1px solid #c2d7d8; }
.sim-discount { font-size: 12px; color: #405e63; }
.sim-metrics span { font-size: 11px; }
.sim-metrics strong { font-size: 14px; color: #29475b; }
.sim-note { font-size: 11px; line-height: 1.55; }
.app-footer { color: #586d80; font-size: 11px; }
.load-more-wrap { display: flex; justify-content: center; padding: 14px; }
.load-more-wrap button { font-size: 13px; }
.rotation-visual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 12px; margin: 4px 0 16px; padding: 0; background: transparent; }
.pie-card { min-width: 0; padding: 12px 10px; border: 1px solid #cbd7e1; border-radius: 10px; background: #f1f6f8; }
.pie-card-heading { min-height: 42px; margin: 0 4px 5px; }
.pie-card-heading h4 { margin: 0 0 3px; color: #183a54; font: 700 12px 'Manrope', sans-serif; }
.pie-card-heading p { margin: 0; color: #586d80; font-size: 10px; }
.pie-card-body { display: grid; grid-template-columns: minmax(105px, .85fr) minmax(120px, 1.15fr); align-items: center; gap: 2px; }
.pie-wrap { width: 150px; max-width: 100%; margin: 0 auto; }
#rotationPie { display: block; width: 100%; overflow: visible; }
#rotationPricePie { display: block; width: 100%; overflow: visible; }
.pie-slice { cursor: pointer; stroke: #fff; stroke-width: 2; transition: opacity .15s, transform .15s; transform-origin: 120px 120px; }
.pie-slice:hover, .pie-slice:focus { opacity: .82; stroke: #173f59; stroke-width: 4; outline: none; }
.pie-hole, .pie-total, .pie-caption { pointer-events: none; }
.pie-total { font: 800 22px 'Manrope', sans-serif; fill: #17364e; }
.pie-total-money { font-size: 17px; }
.pie-caption { font: 600 11px 'DM Sans', sans-serif; fill: #586d80; }
.rotation-legend { display: grid; grid-template-columns: 1fr; gap: 4px; }
.legend-item { display: flex; align-items: center; gap: 7px; min-width: 0; border: 0; border-radius: 6px; padding: 5px 6px; background: transparent; color: #30485f; text-align: left; font: 500 10px 'DM Sans', sans-serif; cursor: pointer; }
.legend-item:hover, .legend-item:focus { background: #dfeaf0; outline: 2px solid #97b6c4; }
.legend-item i { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--legend-color); }
.legend-item span { flex: 1; }
.legend-item strong { font-size: 10px; color: #183a54; white-space: nowrap; }
.legend-item .legend-share { min-width: 43px; color: #345f72; font-size: 10px; font-weight: 700; text-align: right; white-space: nowrap; }
.date-control input { width: 146px; font-size: 14px; letter-spacing: .3px; }
.code-rotation-panel { padding: 20px; }
.code-picker { display: grid; gap: 7px; max-width: 480px; color: #29475b; font-size: 12px; font-weight: 700; }
.code-picker input { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid #9aabba; border-radius: 8px; background: #fff; color: #183a54; font: 600 15px 'DM Sans', sans-serif; }
.code-picker input:focus { outline: 3px solid #c5dce2; border-color: #398c89; }
.code-rotation-empty { min-height: 100px; margin-top: 18px; padding: 28px 14px; border: 1px dashed #b4c3cf; border-radius: 9px; background: #f4f7fa; color: #586d80; text-align: center; }
.code-product-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 24px 0 14px; padding-bottom: 14px; border-bottom: 1px solid #d4dee7; }
.code-product-heading h3 { margin: 3px 0 4px; color: #183a54; font: 800 21px 'Manrope', sans-serif; }
.code-product-heading p { max-width: 740px; margin: 0; color: #586d80; font-size: 13px; line-height: 1.5; }
.code-rotation-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.code-rotation-kpis article { display: grid; gap: 6px; padding: 13px 15px; border: 1px solid #ccd8e2; border-radius: 9px; background: #f3f7f9; }
.code-rotation-kpis span { color: #586d80; font-size: 11px; font-weight: 600; }
.code-rotation-kpis strong { color: #183a54; font: 800 21px 'Manrope', sans-serif; }
.code-rotation-table th:last-child, .code-rotation-table td:last-child { width: 35%; }
.rotation-share-track { height: 9px; min-width: 60px; overflow: hidden; border-radius: 8px; background: #e4ebf0; }
.rotation-share-fill { height: 100%; border-radius: inherit; background: #398c89; }
.code-rotation-panel .panel-footnote { margin: 12px 0 0; }
@media (max-width: 760px) {
  .rotation-visual { grid-template-columns: 1fr; gap: 9px; }
  .pie-card-body { grid-template-columns: minmax(140px, .8fr) minmax(150px, 1.2fr); }
  .pie-wrap { width: 180px; }
  .rotation-legend { grid-template-columns: 1fr; }
  .code-rotation-panel { padding: 14px; }
  .code-rotation-kpis { grid-template-columns: 1fr; }
  .code-product-heading { flex-direction: column; }
}
