:root {
  --bg: #f4f7f9;
  --panel: #ffffff;
  --line: #d8e1e8;
  --ink: #182235;
  --muted: #687385;
  --navy: #214e73;
  --teal: #18756f;
  --soft: #eef5f8;
  --danger: #b42318;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: #102b43;
  color: #fff;
  padding: 20px;
}

.brand {
  display: grid;
  gap: 2px;
  margin-bottom: 28px;
}

.brand strong {
  font-size: 28px;
  line-height: 1;
}

.brand span {
  color: #b8d4e8;
  font-size: 13px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar a,
.link-button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e8f2f8;
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
}

.sidebar a:hover,
.link-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar form {
  margin-top: 24px;
}

.main {
  margin-left: 240px;
  padding: 28px;
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 16px 38px rgba(16, 43, 67, 0.12);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.alert {
  border: 1px solid #f0b4ad;
  border-radius: 6px;
  background: #fff5f5;
  color: var(--danger);
  margin: 14px 0;
  padding: 10px 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.money-input {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
}

.money-input span {
  display: grid;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 1px solid #cbd5df;
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 700;
}

.money-input input {
  border-radius: 0 6px 6px 0;
}

.login-card form,
.sidebar form {
  display: grid;
  gap: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  padding: 0 14px;
  text-decoration: none;
}

.primary {
  background: var(--teal);
  color: #fff;
}

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.page-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.paste-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px dashed #b9c9d6;
  border-radius: 8px;
  background: #f8fbfc;
  margin-bottom: 14px;
  padding: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(24, 34, 53, 0.04);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.kpi strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.flow-state {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.flow span,
.flow-state span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-weight: 700;
  padding: 10px;
  text-align: center;
}

.flow-state span.active {
  border-color: var(--teal);
  background: #e6f4f1;
  color: var(--teal);
}

.filters,
.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

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

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

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--soft);
  color: #24425f;
  font-size: 12px;
  text-transform: uppercase;
}

.data-table .empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.table-link {
  color: var(--teal);
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #e6f4f1;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
}

.table-scroll {
  overflow-x: auto;
}

.quote-lines {
  min-width: 1180px;
}

.quote-lines input,
.quote-lines select {
  min-width: 92px;
}

.quote-lines td:first-child input {
  min-width: 260px;
}

.quote-lines td:nth-child(8) input {
  min-width: 220px;
}

.delete-row {
  width: 32px;
  height: 32px;
  border: 1px solid #f0b4ad;
  border-radius: 6px;
  background: #fff5f5;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

.totals-box {
  width: min(420px, 100%);
  margin-left: auto;
}

.inline-total {
  width: 100%;
  margin-left: 0;
}

.totals-box div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.totals-box .grand {
  color: var(--navy);
  font-size: 22px;
}

.grid-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
}

.preline {
  white-space: pre-line;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
  }

  .kpi-grid,
  .filters,
  .form-grid,
  .form-grid.two,
  .flow,
  .flow-state,
  .paste-box,
  .grid-detail {
    grid-template-columns: 1fr;
  }
}

.check-label {
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 38px;
  gap: 10px;
  color: var(--ink);
}

.check-label input {
  width: 18px;
  height: 18px;
}
.brand .brand-logo {
  display: inline-block;
  color: #e1272f;
  font-family: Magneto, "Brush Script MT", cursive;
  font-size: 34px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  transform: skewX(-7deg);
}
.alert.success {
  border-color: #9ad5c7;
  background: #eefaf6;
  color: #12645e;
}

.search-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
}

.full-field {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .search-bar {
    grid-template-columns: 1fr;
  }
}
.catalog-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.status-pill.inactive {
  background: #eef1f3;
  color: #687385;
}

@media (max-width: 720px) {
  .catalog-picker { grid-template-columns: 1fr; }
}
.report-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(320px, .8fr) minmax(500px, 1.2fr);
  gap: 16px;
}

.kpi.compact strong { font-size: 24px; }

@media (max-width: 1100px) {
  .report-grid, .report-filters { grid-template-columns: 1fr; }
}
.danger-button {
  border-color: #d9a3a0;
  background: #fff5f5;
  color: #a61b1b;
}

.left-actions { justify-content: flex-start; }
.action-panel h2 { margin-bottom: 12px; }
.purchase-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px auto auto;
  gap: 10px;
  align-items: end;
}
.purchase-table { min-width: 1250px; }
.status-pill.purchase-pendiente { background:#fff4d6; color:#7a5700; }
.status-pill.purchase-comprada { background:#e8f1fb; color:#245b8a; }
.status-pill.purchase-recibida { background:#e6f4f1; color:#18756f; }
.status-pill.purchase-cancelada { background:#eef1f3; color:#687385; }
@media (max-width: 900px) { .purchase-filters { grid-template-columns:1fr; } }
.kpi-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.kpi-link:hover,
.kpi-link:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(10, 95, 91, 0.12);
  outline: none;
}