/* Capa visual mínima. Mantiene intactos los flujos y reduce el ruido de las capas históricas. */
:root {
  --bg: #f4f5f2;
  --paper: #ffffff;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #252824;
  --muted: #687069;
  --line: #e1e5df;
  --brand: #26777a;
  --brand-dark: #185f62;
  --accent: #8b6a43;
  --green: #5f7a49;
  --soft: #f0f4f1;
  --warn: #fff4d8;
  --danger: #9b453d;
  --radius-control: 7px;
  --radius-card: 10px;
  --shadow-sm: none;
  --shadow: none;
}

body {
  background: var(--bg) !important;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

body > header {
  min-height: 58px;
  padding: 6px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

body > header > div {
  gap: 8px;
}

.brand-logo {
  width: 78px;
  max-height: 48px;
}

.install-app-btn {
  display: none !important;
}

body > header nav {
  gap: 2px;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

body > header nav button,
.global-search-open,
.install-app-btn {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
}

body > header nav button:hover,
.global-search-open:hover {
  background: var(--soft);
  box-shadow: none;
  color: var(--text);
  transform: none;
}

body > header nav .tab.active {
  background: var(--soft);
  box-shadow: none;
  color: var(--brand-dark);
}

main {
  width: min(1180px, calc(100vw - 36px));
  margin: 20px auto 56px;
  padding-bottom: 64px;
}

.view > .title-row,
.title-row {
  min-height: 42px;
  margin-bottom: 12px;
  padding: 0;
}

.view > .title-row::before,
.view > .title-row > div:first-child::after {
  display: none;
}

.view > .title-row > div:first-child,
.title-row > div:first-child {
  min-width: 0;
  padding: 0;
  background: transparent;
  clip-path: none;
  filter: none;
  box-shadow: none;
}

.view > .title-row h2,
.title-row h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 680;
  letter-spacing: -.02em;
  line-height: 1.1;
  text-shadow: none;
}

.eyebrow,
.view > .title-row .eyebrow {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .08em;
}

.card,
.kpi,
.section-entry-card,
.home-card,
details.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: none;
}

.card,
.home-card {
  padding: 14px;
}

.home-card,
.home-card-strong,
#finances .section-entry-card,
#finances .grid.two .card {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.home-card:hover,
.card:hover {
  border-color: #cdd4cd;
  box-shadow: none;
  transform: none;
}

.home-grid {
  gap: 10px;
}

.daily-focus-card {
  grid-column: span 8;
  min-height: 0;
}

.home-mps-card {
  grid-column: span 4;
}

.public-sales-card,
.work-hours-card {
  grid-column: span 6;
}

.home-card h3,
.section-head h3,
.card > h3 {
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 680;
}

.daily-focus-head {
  align-items: start;
}

.weekly-sales-goal strong {
  font-size: 18px;
}

.weekly-sales-track {
  height: 4px;
  background: #e8ebe6;
}

.weekly-sales-track i,
.mps-bar-track i,
.public-sale-bar,
.work-hour-bar {
  background: var(--brand);
  background-image: none;
  box-shadow: none;
  animation: none;
}

.daily-action-list {
  grid-template-columns: 1fr;
}

.daily-action {
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #fafbf9;
  box-shadow: none;
}

.daily-action:hover {
  border-color: #bdcbc5;
  background: var(--soft);
}

.daily-action-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
}

.home-metrics,
.public-sales-score {
  gap: 0;
}

.home-metrics span,
.public-sales-score > span,
.mps-month-metrics span,
.product-sheet-stock div,
.product-sheet-metric {
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.public-sales-score > span:nth-child(n+3) {
  display: none;
}

.public-sales-nudge {
  padding: 7px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.public-sales-nudge span {
  display: none;
}

button,
.file-btn {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  box-shadow: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
}

button:hover,
.file-btn:hover {
  border-color: #c5cdc5;
  background: #f8faf7;
  box-shadow: none;
  filter: none;
  transform: none;
}

button:active,
.file-btn:active {
  transform: translateY(1px);
}

.primary,
.primary:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

input,
select,
textarea {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  box-shadow: none;
  font-size: 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(38, 119, 122, .13);
  border-color: rgba(38, 119, 122, .45);
  background: #fff;
}

.list,
.compact-list {
  gap: 0;
}

.row,
.row.compact-row {
  min-height: 36px;
  padding: 7px 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.row:last-child {
  border-bottom: 0;
}

.row:hover,
.row:focus-within {
  background: #fafbf9;
  box-shadow: none;
  transform: none;
}

.row.warn {
  background: #fffaf0;
}

.pill {
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  background: var(--soft);
  font-size: 10px;
  font-weight: 650;
}

.operation-hub {
  gap: 5px;
}

.operation-hub button {
  min-height: 54px;
  padding: 8px;
  border-radius: 8px;
  box-shadow: none;
}

.operation-hub button::before {
  width: 24px;
  height: 24px;
  background: transparent;
}

.operation-hub button small {
  color: var(--muted);
  font-size: 9px;
}

#finances.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#finances > .title-row,
#finances > .section-entry-card,
#finances > .daily-close-card,
#finances > .finance-movement-card,
#finances > .finance-history-details {
  grid-column: 1 / -1;
  margin: 0;
}

#finances > .disclosure-card {
  align-self: start;
  margin: 0;
  padding: 0;
}

.disclosure-card > summary.section-head {
  min-height: 52px;
  margin: 0;
  padding: 9px 11px;
}

.disclosure-card:not([open]) > summary small,
.disclosure-card:not([open]) > summary .eyebrow {
  display: none;
}

.disclosure-card[open] > :not(summary) {
  margin-inline: 12px;
}

.daily-close-metrics,
.cash-ledger-summary,
.monthly-finance-metrics {
  gap: 0;
}

.daily-close-metrics div,
.cash-ledger-summary div,
.monthly-finance-metrics div {
  padding: 8px 9px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.daily-close-metrics div:last-child,
.cash-ledger-summary div:last-child,
.monthly-finance-metrics div:last-child {
  border-right: 0;
}

.workspace-tabs,
.mps-section-nav {
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f5;
  box-shadow: none;
}

.workspace-tabs button,
.mps-section-nav button {
  min-height: 34px;
}

.form-notice,
.app-update-notice,
.storage-notice {
  border: 1px solid #d6e3dd;
  border-radius: 8px;
  background: #f2f8f5;
}

details.card > summary,
details.card summary {
  font-weight: 650;
}

.card.mps-work-timer {
  bottom: 12px;
  border: 1px solid #ccd6d0;
  border-radius: 9px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 4px 16px rgba(33, 42, 35, .10);
}

.quick-add {
  right: 16px;
  bottom: 16px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(38, 68, 51, .14);
  font-size: 21px;
}

.productivity-overlay {
  background: rgba(32, 36, 32, .24);
  backdrop-filter: blur(2px);
}

.product-sheet,
.global-search-dialog,
.quick-add-menu,
.confirm-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 14px 40px rgba(31, 38, 32, .14);
}

.view.active.view-entering,
.view.active.view-entering > * {
  animation-timing-function: ease-out !important;
}

@keyframes minimal-section-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.view.active.view-entering {
  animation: minimal-section-in .2s ease-out both !important;
}

.view.active.view-entering > * {
  animation: none !important;
}

@media (max-width: 900px) {
  .daily-focus-card,
  .home-mps-card,
  .public-sales-card,
  .work-hours-card {
    grid-column: span 6;
  }
}

@media (max-width: 600px) {
  body > header {
    min-height: 54px;
    padding: 5px 10px;
  }

  .brand-logo {
    width: 68px;
    max-height: 43px;
  }

  main {
    width: calc(100vw - 20px);
    margin-top: 12px;
  }

  .daily-focus-card,
  .home-mps-card,
  .public-sales-card,
  .work-hours-card {
    grid-column: 1 / -1;
  }

  .view > .title-row h2,
  .title-row h2 {
    font-size: 22px;
  }

  .card,
  .home-card {
    padding: 12px;
  }

  .operation-hub button {
    min-height: 50px;
  }

  #finances.active {
    grid-template-columns: 1fr;
  }

  #finances > * {
    grid-column: 1 !important;
  }

  .card.mps-work-timer {
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .view.active.view-entering {
    animation: none !important;
  }
}

/* Segunda pasada: foco, densidad y consistencia. */
:root {
  --content-width: 1120px;
  --surface-subtle: #f8faf7;
  --line-strong: #cfd6cf;
  --focus-ring: rgba(38, 119, 122, .18);
}

body > header {
  min-height: 54px;
  padding-block: 4px;
}

.brand-logo {
  width: 70px;
  max-height: 44px;
}

main {
  width: min(var(--content-width), calc(100vw - 32px));
  margin-top: 16px;
}

.view > .title-row {
  min-height: 34px;
  margin-bottom: 10px;
}

.view > .title-row .eyebrow {
  display: none;
}

.view > .title-row h2,
.title-row h2 {
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 700;
}

.title-actions {
  gap: 6px;
}

.title-actions .back-link {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.title-actions .back-link:hover {
  background: var(--soft);
  color: var(--text);
}

.card,
.home-card {
  padding: 12px;
}

.card + .card,
.card + details.card,
details.card + .card,
.view > .grid,
.view > .list {
  margin-top: 9px;
}

.section-head {
  min-height: 32px;
  margin-bottom: 9px;
}

.section-head h3,
.card > h3,
.home-card h3 {
  font-size: 15px;
}

.section-head p.muted,
.form-intro > span,
.card > .muted {
  max-width: 68ch;
  font-size: 11px;
}

.section-entry-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.section-entry-card > .section-head {
  display: none;
}

.operation-hub {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.operation-hub button {
  display: flex;
  grid-template-columns: none;
  grid-template-rows: none;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 48px;
  padding: 7px 9px;
  border-color: var(--line);
  background: var(--paper);
}

.operation-hub button::before {
  display: none;
}

.operation-hub button span {
  font-size: 12px;
}

.operation-hub button small {
  display: block;
  width: 100%;
  font-size: 9px;
  line-height: 1.2;
}

.daily-close-card .section-head,
.daily-close-card .title-actions {
  align-items: center;
}

.daily-close-card .title-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
}

.daily-close-card .title-actions input {
  width: 145px;
}

form.card,
#saleForm,
#purchaseForm,
#mpsLoadForm {
  max-width: 960px;
}

.form {
  gap: 9px 10px;
}

.form label,
.mini-form label,
.mps-load-fields label,
.flow-options-grid label {
  gap: 4px;
  color: #4e574f;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .01em;
}

.form-intro {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.form-intro .eyebrow {
  display: none;
}

.form-intro h3 {
  margin: 0 0 2px;
  font-size: 16px;
}

input,
select,
textarea {
  min-height: 34px;
}

textarea {
  resize: vertical;
}

button:focus-visible,
.file-btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.flow-options,
.purchase-advanced-options,
.mps-work-optional,
.price-advanced-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.flow-options > summary,
.purchase-advanced-options > summary,
.mps-work-optional > summary,
.price-advanced-option > summary {
  min-height: 34px;
  padding: 8px 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.flow-options[open] > summary,
.purchase-advanced-options[open] > summary,
.mps-work-optional[open] > summary,
.price-advanced-option[open] > summary {
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.flow-options-grid,
.purchase-advanced-grid,
.mps-work-optional-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
  padding: 10px;
}

.mps-load-options {
  margin: 8px 0;
}

.mps-load-core {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mps-load-mode {
  margin: 0;
  padding: 8px;
  border-color: var(--line);
}

.mps-load-mode label {
  padding: 7px;
  background: var(--paper);
}

.form-actions {
  min-height: 40px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.form-actions > strong,
.purchase-total-box {
  font-size: 18px;
}

.form-notice,
.app-update-notice,
.storage-notice {
  padding: 8px 10px;
  border-left: 3px solid var(--brand);
  font-size: 11px;
}

.form-notice.warn,
.storage-notice {
  border-left-color: #c38b2d;
}

.form-notice.bad,
.form-notice.error {
  border-left-color: var(--danger);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

table thead th,
th {
  padding: 6px 7px;
  border-bottom: 1px solid var(--line-strong);
  background: #f6f8f5;
  color: #5a635b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .035em;
  white-space: nowrap;
}

td {
  padding: 5px 7px;
  border-bottom: 1px solid #edf0eb;
  line-height: 1.2;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background-color .12s ease;
}

tbody tr:hover,
tbody tr:focus-within {
  background: var(--surface-subtle);
}

tbody tr td:last-child button,
.row-actions .icon-action,
.sale-card-actions .icon-action {
  opacity: .42;
  transition: opacity .12s ease, background-color .12s ease;
}

tbody tr:hover td:last-child button,
tbody tr:focus-within td:last-child button,
.row:hover .row-actions .icon-action,
.row:focus-within .row-actions .icon-action,
.sale-card:hover .sale-card-actions .icon-action,
.sale-card:focus-within .sale-card-actions .icon-action {
  opacity: 1;
}

.row,
.row.compact-row {
  min-height: 34px;
  padding: 6px 4px;
}

.row > div:first-child strong,
.sale-card strong {
  line-height: 1.2;
}

.row small,
.sale-card small {
  color: var(--muted);
  font-size: 10px;
}

.workspace-tabs,
.mps-section-nav {
  width: fit-content;
  max-width: 100%;
}

.workspace-tabs button,
.mps-section-nav button {
  min-height: 30px;
  padding: 5px 9px;
}

.mps-section-nav button::before {
  display: none;
}

.mps-section-nav button.active,
.mps-section-nav button.active:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.mps-load-table thead th {
  background: #f6f8f5;
  color: #5a635b;
}

.mps-load-form > .section-head .eyebrow,
.mps-section-heading .eyebrow {
  display: none;
}

.daily-focus-card {
  grid-column: span 7;
}

.home-mps-card {
  grid-column: span 5;
}

.daily-action {
  min-height: 42px;
}

.daily-action b {
  font-size: 10px;
}

#inventory.active {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#inventory > .title-row { order: 0; margin-bottom: 1px; }
#inventory > .product-state-card { order: 1; }
#inventory > .bag-stock-card { order: 2; }
#inventory > .guided-stock-card { order: 3; }
#inventory > .stock-adjustment-details { order: 4; }

#inventory > * {
  margin-top: 0;
  margin-bottom: 0;
}

.product-state-table tbody tr,
.product-state-table tbody tr:nth-child(odd),
.product-state-table tbody tr:nth-child(even) {
  background: var(--paper) !important;
}

.product-state-table tbody tr:hover,
.product-state-table tbody tr:focus-within {
  background: var(--surface-subtle) !important;
}

.card.mps-work-timer {
  width: min(410px, calc(100vw - 24px));
  min-height: 42px;
  padding: 5px 8px;
  transform: translateX(-50%) !important;
  transition: none;
}

.card.mps-work-timer:hover,
.card.mps-work-timer:focus-within {
  transform: translateX(-50%) !important;
}

.mps-work-timer-main {
  justify-content: space-between;
}

.mps-work-timer-clock {
  min-width: 8ch;
  text-align: center;
}

.mps-work-timer-status {
  min-width: 5.5em;
}

.mps-work-timer-actions button,
.mps-work-timer-actions button:hover,
.mps-work-timer-actions button:focus-visible,
.mps-work-timer-actions button:active {
  transform: none;
}

@media (max-width: 900px) {
  .operation-hub {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .daily-focus-card,
  .home-mps-card {
    grid-column: span 6;
  }
}

@media (max-width: 600px) {
  main {
    width: calc(100vw - 16px);
  }

  .operation-hub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-options-grid,
  .purchase-advanced-grid,
  .mps-work-optional-fields,
  .mps-load-core {
    grid-template-columns: 1fr;
  }

  tbody tr td:last-child button,
  .row-actions .icon-action,
  .sale-card-actions .icon-action {
    opacity: 1;
  }

  .table-wrap {
    border-radius: 6px;
  }

  .card.mps-work-timer {
    width: min(350px, calc(100vw - 18px));
  }

  .workspace-tabs,
  .mps-section-nav {
    width: 100%;
    overflow-x: auto;
  }
}
