@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:wght@700;800&display=swap");

:root {
  --bg: #f6eddf;
  --panel: #fffdf8;
  --soft: #eadccb;
  --brand: #a14f33;
  --brand-dark: #73351f;
  --ink: #3b1c13;
  --text: #523428;
  --muted: #8a6b5c;
  --line: #a45a42;
  --shadow: 0 20px 50px rgba(80, 52, 35, 0.16);
  --small-shadow: 5px 7px 8px rgba(47, 34, 24, 0.27);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: #d8d8d8;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  align-items: center;
  background: rgba(246, 237, 223, 0.96);
  box-shadow: 0 6px 22px rgba(70, 48, 32, 0.13);
  display: grid;
  grid-template-columns: 250px 1fr 210px 42px;
  height: 66px;
  left: 0;
  padding: 0 76px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.login-logo {
  color: var(--brand);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 45px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
}

.brand-logo {
  align-items: center;
  display: flex;
}

.brand-logo img {
  height: auto;
  width: 160px;
}

.nav {
  align-items: center;
  display: flex;
  gap: 34px;
  justify-content: center;
}

.nav a {
  color: var(--brand-dark);
  font-size: 15px;
  padding: 25px 0 20px;
  position: relative;
}

.nav a.active {
  color: var(--brand);
  font-weight: 700;
}

.nav a.active::after {
  background: var(--brand);
  border-radius: 3px;
  bottom: 6px;
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  right: 0;
}

.admin {
  color: var(--brand-dark);
  line-height: 1.15;
  text-align: center;
}

.admin strong {
  display: block;
  font-size: 14px;
}

.admin span {
  font-size: 11px;
}

.logout {
  align-items: center;
  display: flex;
  justify-content: center;
}

.logout img {
  height: 18px;
  width: 18px;
}

.page-shell {
  background: var(--bg);
  min-height: calc(100vh - 66px);
  padding: 24px 68px 72px;
}

.page-heading h1,
.title-actions h1 {
  color: var(--ink);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 38px;
  letter-spacing: -1px;
  margin: 0 0 32px;
}

.title-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.primary {
  align-items: center;   /* sin esto el texto se pega arriba cuando se fija una altura */
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 8px 12px rgba(99, 54, 35, 0.22);
  color: #fffdf8;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  min-width: 162px;
  padding: 14px 26px;
}

.ghost-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--brand-dark);
  border-radius: 10px;
  color: var(--brand-dark);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  min-width: 130px;
  padding: 13px 24px;
  text-decoration: none;   /* también se usa como enlace (p. ej. "Limpiar") */
}

.primary.wide {
  width: 100%;
}

.add-button {
  margin-right: 82px;
}

.metrics-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 50px;
}

.metric-card {
  align-items: center;
  background: var(--soft);
  border-radius: 12px;
  box-shadow: var(--small-shadow);
  display: flex;
  flex-direction: column;
  height: 164px;
  justify-content: center;
}

.metric-card img {
  height: 36px;
  margin-bottom: 26px;
  object-fit: contain;
  width: 36px;
}

.metric-card span {
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.metric-card strong {
  color: var(--brand);
  font-size: 28px;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.panel,
.alerts-panel,
.form-card,
.report-card {
  background: rgba(255, 253, 248, 0.72);
  border-radius: 14px;
  box-shadow: var(--small-shadow);
}

.panel {
  padding: 22px 28px;
}

.panel h2,
.alerts-panel h2 {
  color: var(--ink);
  font-size: 23px;
  margin: 0;
}

.chart-panel,
.orders-panel {
  min-height: 350px;
}

.bar-chart {
  align-items: flex-end;
  display: flex;
  gap: 34px;
  height: 270px;
  padding: 36px 0 0 0;
}

.bar-wrap {
  align-items: center;
  display: flex;
  flex: 1;
  flex-direction: column;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  background: linear-gradient(180deg, #d4ad88 0%, #7d6653 100%);
  border: 1.5px solid #1f1712;
  border-radius: 8px 8px 0 0;
  display: block;
  max-height: 230px;
  width: 52px;
}

.bar-wrap small {
  color: var(--muted);
  margin-top: 16px;
}

.panel-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 34px;
}

.panel-head h2 {
  color: var(--brand);
}

.search {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #a99a8f;
  border-radius: 20px;
  display: flex;
  height: 28px;
  padding: 0 12px;
  width: 210px;
}

.search span {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  margin-right: 6px;
}

.search input {
  background: transparent;
  border: 0;
  color: var(--muted);
  outline: 0;
  width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th {
  color: var(--brand);
  font-size: 11px;
  letter-spacing: 1px;
  text-align: left;
  text-transform: uppercase;
}

td {
  color: var(--brand);
  font-size: 13px;
  padding: 25px 0;
}

.mini-table tbody tr + tr {
  border-top: 2px solid #2d211b;
}

.data-table thead {
  border-bottom: 2px solid var(--line);
}

.data-table td {
  color: var(--text);
  font-size: 14px;
  padding: 20px 0;
}

.ok {
  color: #00a65a !important;
  font-weight: 800;
}

.process {
  color: var(--brand-dark) !important;
  font-weight: 800;
}

.muted {
  color: #917c70 !important;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 30px;
  justify-content: flex-end;
  margin-top: 22px;
}

.large-panel {
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 1120px;
  min-height: 510px;
  padding: 48px 76px;
}

.large-panel .panel-head h2,
.inventory-panel .panel-head h2 {
  color: var(--brand-dark);
}

.actions-cell {
  align-items: center;
  display: flex;
  gap: 16px;
}

.actions-cell a,
.actions-cell button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--brand);
  cursor: pointer;
  display: inline-flex;
  font-size: 20px;
  justify-content: center;
  padding: 0;
}

.actions-cell img {
  height: 18px;
  object-fit: contain;
  width: 18px;
}

.form-card {
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  min-height: 530px;
  padding: 50px 58px;
}

.user-card {
  max-width: 820px;
}

.product-card {
  max-width: 850px;
}

.form-title {
  align-items: center;
  display: flex;
  gap: 20px;
  margin: 0 0 48px;
}

.form-title img {
  height: 42px;
  object-fit: contain;
  width: 42px;
}

.form-title h2 {
  color: #1f1b18;
  font-size: 27px;
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 28px 140px;
  grid-template-columns: 1fr 1fr;
}

.form-grid.compact {
  gap: 28px 80px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label,
.form-grid span {
  color: #3d332d;
  font-size: 13px;
  font-weight: 600;
}

.form-grid input,
.form-grid select {
  background: #fffdf8;
  border: 1px solid #97918c;
  border-radius: 24px;
  color: #26211e;
  height: 46px;
  outline: 0;
  padding: 0 28px;
}

.date-input {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #97918c;
  border-radius: 12px;
  box-shadow: var(--small-shadow);
  display: flex;
  height: 46px;
  padding: 0 14px 0 20px;
}

.date-input input {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  height: auto;
  padding: 0;
}

.date-input img {
  height: 18px;
  object-fit: contain;
  width: 18px;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 48px;
  justify-content: flex-end;
  margin-top: 70px;
}

.form-actions a {
  color: var(--brand-dark);
}

.report-card {
  border: 1px solid #cac3bb;
  box-shadow: none;
  margin: 0 auto;
  max-width: 700px;
  min-height: 614px;
  padding: 32px 42px;
}

.report-card h2 {
  color: var(--brand-dark);
  font-size: 28px;
  margin: 0;
}

.subtle {
  color: var(--text);
  display: block;
  font-size: 13px;
  margin-bottom: 30px;
}

.report-types {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 28px;
}

.report-type {
  align-items: center;
  background: #fffdf8;
  border: 0;
  border-radius: 10px;
  box-shadow: var(--small-shadow);
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 0 16px;
  grid-template-columns: 36px 1fr;
  min-height: 60px;
  padding: 12px 18px;
  text-align: left;
}

.report-type.selected {
  border: 2px solid #54e983;
}

.report-type[aria-pressed="true"] {
  transform: translateY(-1px);
}

.report-type img {
  grid-row: span 2;
  max-height: 28px;
  max-width: 28px;
}

.report-type strong {
  color: var(--brand-dark);
  font-size: 15px;
}

.report-type small {
  color: var(--muted);
  font-size: 10px;
}

.report-summary {
  background: rgba(255, 253, 248, 0.7);
  border-left: 4px solid #54e983;
  border-radius: 10px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  margin: -6px 0 20px;
  padding: 12px 14px;
}

.report-card h3 {
  color: #55433b;
  font-size: 14px;
  margin: 22px 0 12px;
}

.section-icon-title {
  align-items: center;
  display: flex;
  gap: 8px;
}

.section-icon-title img {
  height: 16px;
  object-fit: contain;
  width: 16px;
}

.export-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.file-button {
  align-items: center;
  background: #eee7dd;
  border: 0;
  border-radius: 10px;
  box-shadow: var(--small-shadow);
  color: var(--brand-dark);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  height: 58px;
  justify-content: center;
  width: 82px;
}

.file-button img {
  height: 38px;
  object-fit: contain;
}

.export-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 14px 0 0;
  text-align: center;
}

.alerts-panel {
  border: 1px solid #c7beb3;
  box-shadow: none;
  margin: 0 auto 54px;
  max-width: 960px;
  padding: 28px 42px 52px;
}

.alerts-panel h2 {
  color: red;
  font-size: 16px;
  margin-bottom: 22px;
}

.alert-row {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #c9c0b8;
  border-radius: 28px;
  box-shadow: 0 4px 6px rgba(77, 61, 50, 0.16);
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 16px 22px;
}

.alert-row strong {
  color: var(--brand-dark);
  display: block;
  font-size: 16px;
}

.alert-row span {
  color: var(--muted);
}

.alert-row b {
  color: #d60000;
}

.inventory-panel {
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 980px;
  min-height: 520px;
  padding: 36px;
}

.product-search {
  border-color: #c98663;
  height: 36px;
  width: 280px;
}

.login-body {
  background: var(--bg);
}

.login-shell {
  min-height: 100vh;
}

.login-page {
  align-items: center;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 84px;
}

.login-logo {
  font-size: 104px;
  margin-bottom: 70px;
}

.login-logo-img {
  height: auto;
  margin-bottom: 70px;
  width: 420px;
}

.login-card {
  background: var(--panel);
  border-radius: 22px;
  min-height: 450px;
  padding: 38px;
  width: 380px;
}

.login-card h1 {
  color: #1e2b3c;
  font-size: 14px;
  margin: 0;
  text-align: center;
}

.login-line {
  background: #1f1b18;
  height: 3px;
  margin: 20px auto 48px;
  width: 150px;
}

.divider-label {
  align-items: center;
  color: #1e2b3c;
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 36px;
}

.divider-label span {
  background: #a06e5d;
  height: 1px;
  width: 92px;
}

.divider-label strong {
  font-size: 13px;
}

.input-icon {
  align-items: center;
  background: #f0f0f1;
  border-radius: 10px;
  display: flex;
  gap: 12px;
  height: 52px;
  margin-bottom: 26px;
  padding: 0 12px;
}

.input-icon img {
  height: 18px;
  object-fit: contain;
  opacity: 0.7;
  width: 18px;
}

.input-icon input {
  background: transparent;
  border: 0;
  color: #728094;
  outline: 0;
  width: 100%;
}

.confirm-overlay {
  align-items: center;
  background: rgba(38, 24, 16, 0.34);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 99;
}

.confirm-overlay.visible {
  display: flex;
}

.confirm-card {
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
  max-width: 430px;
  padding: 34px;
  text-align: center;
  width: 100%;
}

.confirm-card h2 {
  color: var(--ink);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 32px;
  margin: 0 0 12px;
}

.confirm-card p {
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 28px;
}

.confirm-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

@media (max-width: 1000px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 18px 24px;
    row-gap: 12px;
  }

  .nav {
    flex-wrap: wrap;
    gap: 18px;
  }

  .page-shell {
    padding: 28px 24px;
  }

  .metrics-grid,
  .dashboard-grid,
  .report-types,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .add-button {
    margin-right: 0;
  }
}

/* ==========================================================================
   Componentes agregados en la entrega del 2º parcial.
   Reutilizan las variables de :root definidas arriba.
   ========================================================================== */

/* ------------------------------------------------------------- mensajes */
.flash-messages {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.alert {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}

.alert a {
  color: inherit;
  font-weight: 800;
}

.alert-error {
  background: #fbe3e4;
  color: #8a1f24;
  border-color: #f0bfc2;
}

.alert-success {
  background: #e3f2e5;
  color: #1e5b2a;
  border-color: #bfdcc4;
}

.alert-warning {
  background: #fdf0dc;
  color: #7a4d10;
  border-color: #edd4a8;
  margin-bottom: 18px;
}

.api-status {
  margin: 16px 0 0;
  font-size: 11px;
  text-align: center;
  font-weight: 700;
}

.api-ok { color: #1e5b2a; }
.api-down { color: #8a1f24; }

/* --------------------------------------------------------------- tablas */
.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 26px 12px;
  font-style: italic;
}

.row-inactive {
  opacity: 0.55;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--soft);
  color: var(--brand-dark);
}

.status-badge.ok {
  background: #dff1e2;
  color: #1e5b2a;
}

.status-badge.process {
  background: #fbe6cf;
  color: #8a4a12;
}

.status-badge.muted {
  background: #ece3da;
  color: var(--muted);
}

.chip {
  display: inline-block;
  padding: 3px 10px;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.total-pill {
  background: var(--brand);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
}

/* -------------------------------------------------------------- filtros */
.filter-panel {
  min-height: auto;
  margin-bottom: 22px;
  padding: 22px 28px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-grid label {
  display: grid;
  gap: 6px;
}

.filter-grid span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.filter-grid input,
.filter-grid select {
  height: 38px;
  border: 1px solid var(--soft);
  border-radius: 19px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.filter-grid .primary {
  height: 38px;
  min-width: auto;
  padding: 0 22px;
  border-radius: 19px;
  font-size: 13px;
}

.filter-grid .span-2 {
  grid-column: span 2;
}

.inline-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-filter select {
  height: 36px;
  border: 1px solid var(--soft);
  border-radius: 18px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

/* ------------------------------------------------------- formularios */
.form-grid .span-2 {
  grid-column: span 2;
}

.form-title.separado {
  margin-top: 26px;
  border-top: 1px solid var(--soft);
  padding-top: 20px;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 14px 0 4px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--soft);
  border-radius: 14px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check-card:has(input:checked) {
  border-color: var(--brand);
  background: #fdf3ec;
  color: var(--brand-dark);
}

/* --------------------------------------------------------- acciones */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.icon-button:hover {
  background: var(--soft);
}

.icon-button img {
  width: 20px;
  height: 20px;
  display: block;
}

.ghost-button.small {
  min-width: auto;
  padding: 6px 14px;
  font-size: 11px;
  min-height: auto;
}

.logout-form {
  display: inline-flex;
}

.logout-form .logout {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

/* ------------------------------------------------------- paginación */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.pag-btn {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--soft);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.pag-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* --------------------------------------------------------- gráficas */
.chart-box {
  position: relative;
  height: 260px;
  margin-top: 12px;
}

.chart-box canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}

.swatch-brand { background: #a14f33; }
.swatch-soft { background: #d4ad88; }

/* ------------------------------------------------------------ modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 20, 12, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: 660px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px 30px;
  display: grid;
  gap: 18px;
  color: var(--text);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--soft);
  padding-bottom: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 19px;
  color: var(--brand-dark);
}

.modal-close {
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.modal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  font-size: 13px;
}

.modal-scroll {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--soft);
  border-radius: 12px;
  padding: 12px 14px;
}

.modal-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.modal-table th {
  border-bottom: 1px solid var(--soft);
  padding: 6px 0;
  text-align: left;
  font-size: 11px;
  color: var(--muted);
}

.modal-table td {
  padding: 8px 0;
}

.modal-table .center { text-align: center; }
.modal-table .right { text-align: right; }

.modal-table small {
  color: var(--muted);
  font-size: 11px;
}

.modal-notes {
  font-size: 13px;
  padding: 12px 14px;
  background: #f3ece6;
  border-radius: 10px;
}

.modal-history {
  font-size: 12px;
  max-height: 160px;
}

.modal-history ul {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--soft);
  padding-top: 14px;
  font-size: 15px;
}

.modal-total {
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 18px;
}

/* --------------------------------------------------- ajustes menores */
.panel-head h2 .subtle {
  font-size: 12px;
  font-weight: 600;
}

/* Los PNG de PDF y XLSX ya traen su propio rótulo dibujado: no se les añade
   texto encima, se veía duplicado y desbordaba la altura del botón. */
.file-button {
  transition: transform 0.12s ease;
}

.file-button:hover {
  transform: translateY(-2px);
}

/* ------------------------------- acción bloqueada (p. ej. producto en uso) */
.icon-button.bloqueado {
  cursor: not-allowed;
  opacity: 0.4;
}

.icon-button.bloqueado:hover {
  background: #fbe3e4;
  opacity: 0.7;
}

.chip-aviso {
  background: #fdf0dc;
  color: #7a4d10;
  border: 1px solid #edd4a8;
  text-decoration: none;
  white-space: nowrap;
}

.chip-aviso:hover {
  background: #f8e4c4;
}

/* --------------------------------------------------- pantalla de reportes */
.report-types {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

/* Estas tarjetas ya no llevan icono, así que la rejilla base de dos columnas
   (36px para la imagen + texto) dejaba el título encima de la descripción.
   Una sola columna, título arriba y descripción debajo. */
.report-type {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 8px;
  min-height: 104px;
  padding: 16px 18px;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.report-type strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.report-type small {
  display: block;
  font-size: 11px;
  line-height: 1.4;
}

.report-type:hover {
  transform: translateY(-2px);
}

/* El borde de 2px del estado seleccionado movía la tarjeta: se compensa con
   un borde transparente del mismo grosor en reposo. */
.report-type {
  border: 2px solid transparent;
}

.report-type.selected {
  border-color: #54e983;
  background: #fbfff6;
}

.export-actions {
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.export-actions .primary {
  min-width: 170px;
}

.report-generado {
  margin: -10px 0 20px;
}

.report-download {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.report-section {
  min-height: auto;
  margin-bottom: 22px;
}

/* Las tablas de reporte pueden tener 10 columnas: que rueden solas y no
   rompan el ancho de la página. */
.table-scroll {
  overflow-x: auto;
  margin-top: 8px;
}

.table-scroll .data-table {
  min-width: 100%;
  white-space: nowrap;
}

.table-scroll .data-table td,
.table-scroll .data-table th {
  padding-right: 18px;
}

/* ----------------------------------------------------- página de error */
.error-page {
  max-width: 560px;
  margin: 40px auto;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 40px;
  text-align: center;
}

.error-icon {
  width: 66px;
  height: 66px;
  border-radius: 33px;
  background: #fbe3e4;
  color: #b3261e;
  font-size: 34px;
  font-weight: 900;
  line-height: 66px;
  margin: 0 auto 18px;
}

.error-page h1 {
  color: var(--brand-dark);
  font-size: 22px;
  margin: 0 0 12px;
}

.error-mensaje {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
}

.error-detalle {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.error-acciones {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 26px 0 8px;
  flex-wrap: wrap;
}

.error-ayuda {
  margin-top: 18px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
}

.error-ayuda summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 10px;
}

.error-ayuda ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.error-ayuda code {
  background: var(--soft);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
}

/* ------------------------------------------- filtro de series de la gráfica */
.chart-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chart-filter button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid var(--soft);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chart-filter button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.chart-filter button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chart-filter button .swatch {
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.chart-total {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-dark);
}

@media (max-width: 900px) {
  .modal-meta {
    grid-template-columns: 1fr;
  }

  .filter-grid .span-2,
  .form-grid .span-2 {
    grid-column: span 1;
  }

  .inline-filter {
    width: 100%;
  }
}


/* ==========================================================================
   Adaptación a pantallas pequeñas.

   Todo lo que sigue vive dentro de media queries, así que el diseño en
   computadora queda exactamente igual que antes: ninguna regla de aquí se
   aplica por encima de 760px de ancho.
   ========================================================================== */

/* Contenedor de tablas. En escritorio es un <div> inerte que no altera el
   layout; sólo se vuelve desplazable en móvil (ver más abajo). */
.table-wrap {
  width: 100%;
}

@media (max-width: 760px) {
  /* ------------------------------------------------------- barra superior */
  /* De rejilla de 4 columnas a dos filas: marca + usuario + salir arriba,
     y el menú deslizable debajo. */
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    row-gap: 2px;
    height: auto;
    padding: 10px 16px;
  }

  .brand-logo {
    order: 1;
  }

  .brand-logo img {
    width: 116px;
  }

  .admin {
    order: 2;
    margin-left: auto;
    text-align: right;
  }

  .admin strong {
    font-size: 12px;
  }

  .admin span {
    font-size: 10px;
  }

  .logout-form {
    order: 3;
  }

  /* Los seis enlaces no caben en una línea: se reparten en dos filas. Se
     prefiere eso a un carrusel horizontal, donde las últimas secciones
     quedarían escondidas fuera de pantalla. */
  .nav {
    order: 4;
    width: 100%;
    justify-content: flex-start;
    column-gap: 20px;
    row-gap: 0;
  }

  .nav a {
    font-size: 14px;
    padding: 6px 0 8px;
    white-space: nowrap;
  }

  .nav a.active::after {
    bottom: 2px;
    height: 3px;
  }

  /* ------------------------------------------------------------ contenido */
  .page-shell {
    min-height: auto;
    padding: 18px 16px 48px;
  }

  .page-heading h1,
  .title-actions h1 {
    font-size: 26px;
  }

  .title-actions,
  .panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .panel-head {
    margin-bottom: 20px;
  }

  .panel,
  .alerts-panel,
  .form-card,
  .chart-panel,
  .orders-panel {
    padding: 20px 16px;
  }

  .chart-panel,
  .orders-panel {
    min-height: 0;
  }

  /* --------------------------------------------------------------- tablas */
  /* Las tablas no se reflujan: se desplazan en horizontal dentro de su
     contenedor, que es lo único que conserva legibles las columnas. */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap .data-table {
    min-width: 640px;
  }

  .data-table td {
    font-size: 13px;
    padding: 14px 0;
  }

  .data-table th {
    font-size: 10px;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
  }

  /* ------------------------------------------------------------ formularios */
  .form-actions {
    flex-direction: column-reverse;
    gap: 12px;
    margin-top: 34px;
  }

  .form-actions .primary,
  .form-actions .ghost-button,
  .form-actions a {
    width: 100%;
    text-align: center;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  /* ----------------------------------------------------------- inicio sesión */
  .login-page {
    padding-top: 40px;
  }

  .login-logo-img {
    margin-bottom: 30px;
    width: min(260px, 68vw);
  }

  .login-logo {
    font-size: 60px;
    margin-bottom: 30px;
  }

  .login-card {
    min-height: 0;
    padding: 26px 22px;
    width: min(380px, calc(100vw - 32px));
  }

  /* --------------------------------------------------------------- gráficas */
  .chart-box {
    height: 220px;
  }

  /* ---------------------------------------------------------------- modales */
  .modal-card,
  .confirm-card {
    padding: 22px 18px;
  }

  .modal-card {
    max-height: 86vh;
  }

  .confirm-card h2 {
    font-size: 24px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .confirm-actions button {
    width: 100%;
  }
}

/* Teléfonos estrechos: se recupera algo más de ancho útil. */
@media (max-width: 420px) {
  .page-shell {
    padding: 14px 12px 40px;
  }

  .page-heading h1,
  .title-actions h1 {
    font-size: 22px;
  }

  .brand-logo img {
    width: 96px;
  }

  /* Se conserva quién ha iniciado sesión, sólo que más discreto. */
  .admin strong {
    font-size: 11px;
  }

  .admin span {
    font-size: 9px;
  }
}

/*
 * El icono de "ver detalle" (pedidos.png) es un contorno gris de trazo muy
 * fino: reducido a 18 px sobre el fondo crema del panel casi desaparecía y el
 * botón parecía vacío, cuando es el único que abre el detalle del pedido.
 *
 * Se ennegrece con un filtro (en vez de sustituir el archivo) y se le dan dos
 * píxeles más, que en un trazo tan delgado se notan. El selector incluye
 * `.actions-cell` porque `.actions-cell img` fija 18 px y le ganaba en
 * especificidad.
 */
.actions-cell .icono-detalle {
  filter: brightness(0);
  height: 20px;
  opacity: 0.8;
  width: 20px;
}

.actions-cell .icon-button:hover .icono-detalle {
  opacity: 1;
}

/* ---------------------------------------------------- fotos de producto */
.celda-producto {
  align-items: center;
  display: flex;
  gap: 12px;
}

.miniatura-producto {
  border-radius: 8px;
  flex: 0 0 auto;
  height: 38px;
  object-fit: cover;
  width: 38px;
}

/* Hueco del mismo tamaño cuando el producto todavía no tiene foto, para que
   la columna no se descuadre entre filas. */
.miniatura-producto.vacia {
  background: var(--soft);
  display: inline-block;
}

.foto-producto {
  align-items: center;
  display: flex;
  gap: 22px;
  margin-bottom: 8px;
}

.foto-actual,
.foto-vacia {
  border-radius: 12px;
  flex: 0 0 auto;
  height: 112px;
  width: 112px;
}

.foto-actual {
  object-fit: cover;
}

.foto-vacia {
  align-items: center;
  background: var(--soft);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: center;
}

.foto-controles {
  flex: 1;
  min-width: 0;
}

.foto-controles input[type="file"] {
  color: var(--text);
  font-size: 13px;
  margin: 6px 0;
  max-width: 100%;
}

@media (max-width: 760px) {
  .foto-producto {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
}

/* ------------------------------------------------ motivo de cancelación */
.confirm-motivo {
  display: block;
  margin: 6px 0 18px;
  text-align: left;
}

.confirm-motivo span {
  color: var(--brand-dark);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.confirm-motivo textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.confirm-motivo-error {
  color: #b3261e;
  display: block;
  font-size: 11px;
  margin-top: 6px;
}

/* El motivo acompaña al estado sin ensanchar la columna. */
.motivo-cancelacion {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 6px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirm-pregunta {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 0 0 18px;
  text-align: left;
}

.confirm-pregunta span {
  color: var(--text);
  font-size: 13px;
}
