﻿:root {
  color-scheme: light;
  --bg: #f5f0e8;
  --bg-strong: #ebe1d1;
  --panel: rgba(255, 251, 245, 0.86);
  --panel-strong: #fffaf1;
  --ink: #1d2622;
  --muted: #5f6f66;
  --line: rgba(35, 53, 45, 0.11);
  --line-strong: rgba(35, 53, 45, 0.18);
  --brand: #0d7a5f;
  --brand-ink: #0a4b3a;
  --accent: #c96b3b;
  --warn: #d48a1e;
  --danger: #b84a38;
  --shadow: 0 24px 60px rgba(48, 38, 24, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-ui: "Bahnschrift", "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(74, 148, 123, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(201, 107, 59, 0.18), transparent 26%),
    linear-gradient(180deg, #f9f3ea 0%, #f3ede2 100%);
}

.bg-orb,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-orb-a {
  background: radial-gradient(circle at 18% 16%, rgba(13, 122, 95, 0.12), transparent 28%);
}

.bg-orb-b {
  background: radial-gradient(circle at 82% 78%, rgba(201, 107, 59, 0.12), transparent 24%);
}

.bg-grid {
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(29, 38, 34, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 38, 34, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0));
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 46px);
  line-height: 0.96;
}

.login-box {
  width: min(420px, 100%);
  padding: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 241, 232, 0.94));
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.login-card-head h1 {
  margin-bottom: 4px;
  font-size: 34px;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.form-stack label,
.filters-grid label,
.edit-grid label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--ink);
  min-height: 48px;
}

textarea {
  resize: vertical;
  min-height: 108px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(13, 122, 95, 0.2);
  border-color: rgba(13, 122, 95, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0f8567, #0b6650);
  color: #fff;
  box-shadow: 0 18px 28px rgba(13, 122, 95, 0.24);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--line);
  color: var(--ink);
}

.btn-accent {
  background: rgba(201, 107, 59, 0.12);
  border-color: rgba(201, 107, 59, 0.2);
  color: #8a4c2c;
}

.btn-danger {
  background: rgba(184, 74, 56, 0.12);
  border-color: rgba(184, 74, 56, 0.22);
  color: var(--danger);
}

.btn-full {
  width: 100%;
}

.btn-large {
  min-height: 52px;
  font-weight: 700;
}

.note-card h2,
.section-card h2,
.detail-card h2,
.shell-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.note-card p,
.muted,
.item-meta,
.list-subtle {
  color: var(--muted);
}

.form-error,
.error-box {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(184, 74, 56, 0.11);
  border: 1px solid rgba(184, 74, 56, 0.16);
  color: var(--danger);
}

.main-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 22px;
  padding: 20px;
}

.sidebar {
  padding: 22px 18px 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  position: static;
  height: auto;
}

.brand-block h2 {
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1;
}

.nav-menu {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  border-radius: 18px;
  padding: 14px 14px 13px;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.nav-button:hover {
  transform: translateX(2px);
  border-color: rgba(13, 122, 95, 0.12);
  background: rgba(255, 255, 255, 0.7);
}

.nav-button.active {
  background: linear-gradient(135deg, rgba(13, 122, 95, 0.16), rgba(13, 122, 95, 0.08));
  border-color: rgba(13, 122, 95, 0.18);
}

.nav-button strong {
  display: block;
  font-size: 15px;
}

.nav-button span {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}

.badge-block {
  display: grid;
  gap: 8px;
}

.badge-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(13, 122, 95, 0.1);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.topbar {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-welcome {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.btn-topbar {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
}

#account-button {
  min-width: 88px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.kicker {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 800;
}

.flash {
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.flash.success {
  border-color: rgba(13, 122, 95, 0.2);
  background: rgba(13, 122, 95, 0.1);
}

.flash.error {
  border-color: rgba(184, 74, 56, 0.22);
  background: rgba(184, 74, 56, 0.08);
}

.view {
  display: grid;
  gap: 18px;
}

.stats-grid,
.split-grid,
.three-grid,
.two-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.split-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
}

.three-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.section-card,
.detail-card,
.shell-card {
  padding: 20px;
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(253, 248, 240, 0.85));
  border: 1px solid var(--line);
  box-shadow: 0 14px 28px rgba(48, 38, 24, 0.08);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(26px, 3vw, 40px);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header p,
.section-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.filters-grid,
.inline-form {
  display: grid;
  gap: 14px;
}

.filters-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.stack {
  display: grid;
  gap: 12px;
}

.list-grid {
  display: grid;
  gap: 12px;
}

.list-item,
.alert-card,
.history-item,
.event-row {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  padding: 16px;
}

.list-item.is-selected {
  border-color: rgba(13, 122, 95, 0.28);
  box-shadow: 0 18px 34px rgba(13, 122, 95, 0.12);
  background: linear-gradient(180deg, rgba(240, 250, 246, 0.96), rgba(255, 255, 255, 0.92));
}

.list-item button,
.alert-actions {
  margin-top: 12px;
}

.list-item h3,
.alert-card h3,
.history-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.list-item p,
.alert-card p,
.history-item p {
  margin: 0;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(13, 122, 95, 0.09);
  border: 1px solid rgba(13, 122, 95, 0.12);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-ink);
}

.mini-pill.warn {
  background: rgba(212, 138, 30, 0.1);
  border-color: rgba(212, 138, 30, 0.16);
  color: #8c6014;
}

.mini-pill.danger {
  background: rgba(184, 74, 56, 0.1);
  border-color: rgba(184, 74, 56, 0.16);
  color: var(--danger);
}

.info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.import-dropzone {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 250, 247, 0.9));
  border-style: dashed;
  border-color: rgba(13, 122, 95, 0.2);
}

.imports-page {
  gap: 24px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.imports-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.friendly-dropzone {
  align-items: stretch;
  border-radius: 24px;
  padding: 22px;
  text-align: left;
}

.upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border-radius: 22px;
  background: rgba(13, 122, 95, 0.1);
  color: var(--brand);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.file-picker-label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.file-picker-label input {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
}

.imports-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.imports-result-grid div {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.imports-result-grid span,
.import-card-numbers {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.imports-result-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.import-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.import-batch-card {
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  padding: 16px;
}

.import-batch-card.is-selected {
  border-color: rgba(13, 122, 95, 0.34);
  box-shadow: 0 18px 34px rgba(13, 122, 95, 0.12);
  background: linear-gradient(180deg, rgba(240, 250, 246, 0.96), rgba(255, 255, 255, 0.94));
}

.import-batch-card strong {
  color: var(--ink);
  font-size: 16px;
}

.import-batch-card small {
  color: var(--muted);
}

.import-status {
  justify-self: start;
  border-radius: 999px;
  background: rgba(13, 122, 95, 0.1);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  text-transform: uppercase;
}

.friendly-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.friendly-details summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 900;
}

.friendly-details > *:not(summary) {
  margin-top: 14px;
}

.imports-documents-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  padding: 16px;
}

.imports-documents-card table {
  min-width: 980px;
}

.last-document-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.38fr) minmax(0, 1.62fr);
  align-items: stretch;
  gap: 18px;
  padding: 20px;
  border-color: rgba(13, 122, 95, 0.26);
  background:
    linear-gradient(135deg, rgba(13, 122, 95, 0.08), rgba(255, 255, 255, 0.1)),
    rgba(255, 253, 249, 0.98);
  box-shadow: 0 16px 34px rgba(34, 52, 42, 0.1);
}

.last-document-card h3 {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.reference-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(13, 122, 95, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.reference-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reference-card > strong {
  display: block;
  color: var(--brand-ink);
  font-size: clamp(25px, 2.6vw, 36px);
  line-height: 1.05;
  letter-spacing: 0;
}

.last-document-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.last-document-meta span {
  display: grid;
  gap: 6px;
  min-height: 62px;
  border: 1px solid rgba(13, 122, 95, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-weight: 800;
  padding: 10px;
}

.last-document-meta b {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(22, 35, 27, 0.42);
  backdrop-filter: blur(6px);
}

.busy-overlay[hidden] {
  display: none !important;
}

.busy-card {
  width: min(440px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 28px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 28px 70px rgba(20, 33, 25, 0.26);
  text-align: center;
  padding: 30px;
}

.busy-card h3 {
  margin: 14px 0 8px;
  font-size: 28px;
}

.busy-card p {
  margin: 0;
  color: var(--muted);
}

.busy-spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  border: 5px solid rgba(13, 122, 95, 0.14);
  border-top-color: var(--brand);
  animation: busy-spin 0.85s linear infinite;
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

.table-shell {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: rgba(13, 122, 95, 0.08);
  color: var(--brand-ink);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover {
  background: rgba(13, 122, 95, 0.04);
}

.empty-state {
  padding: 26px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.loader {
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.metric {
  min-width: 150px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.edit-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.history-grid {
  display: grid;
  gap: 10px;
}

.code-block {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #1f2722;
  color: #effaf5;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.subtabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.subtab-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
}

.subtab-button.active {
  background: rgba(13, 122, 95, 0.12);
  border-color: rgba(13, 122, 95, 0.2);
  color: var(--brand-ink);
}

@media (max-width: 1100px) {
  .main-screen,
  .split-grid,
  .three-grid,
  .two-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }
}

@media (max-width: 760px) {
  .main-screen {
    padding: 14px;
    gap: 14px;
  }

  .topbar,
  .panel,
  .section-card,
  .detail-card,
  .shell-card {
    border-radius: 22px;
  }

  .topbar {
    padding: 18px;
    align-items: flex-start;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .login-panel h1 {
    font-size: 32px;
    max-width: none;
  }

  .login-box {
    padding: 24px;
  }
}

.page-grid {
  display: grid;
  gap: 18px;
}

.panel-card,
.toolbar-card,
.kpi-card,
.table-card,
.chart-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.panel-card,
.toolbar-card,
.table-card,
.chart-card {
  padding: 20px;
}

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

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

.kpi-card {
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(27, 111, 89, 0.08), rgba(255, 253, 249, 0.96));
}

.kpi-card span,
.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
}

.kpi-card strong {
  font-size: 32px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 16px;
}

.supplier-layout {
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.4fr);
}

.suppliers-page {
  gap: 24px;
}

.supplier-filter-toolbar {
  gap: 18px;
}

.supplier-filter-toolbar .select-input:first-child {
  min-width: min(100%, 360px);
}

.pareto-layout {
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.35fr);
}

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

.section-heading.large {
  margin-bottom: 0;
}

.section-heading h2,
.section-heading h3,
.panel-card h2 {
  margin: 0;
}

.section-heading small {
  color: var(--muted);
}

.toolbar-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.toolbar-card.wrap {
  flex-wrap: wrap;
}

.alert-list,
.stack-list,
.search-results,
.search-chip-list {
  display: grid;
  gap: 12px;
}

.alert-item {
  border-radius: 18px;
  padding: 15px 16px;
  background: rgba(27, 111, 89, 0.06);
  border-left: 4px solid var(--brand);
}

.alert-item.warning {
  border-left-color: var(--warn);
}

.alert-item.high,
.alert-item.critical {
  border-left-color: var(--danger);
}

.alert-link {
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
}

.alert-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.alert-meta {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.text-input,
.select-input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
  padding: 13px 14px;
  color: var(--ink);
}

.chip {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(27, 111, 89, 0.08);
  color: var(--ink);
  cursor: pointer;
}

.chip.active {
  background: var(--brand);
  color: white;
}

.chip.soft {
  background: white;
  border: 1px solid var(--line);
}

.filter-field {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.filter-field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.article-filter-toolbar {
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.articles-page {
  gap: 28px;
}

.articles-page .split-layout {
  gap: 28px;
}

.articles-page .chart-card {
  padding: 24px;
}

.article-header-block {
  display: grid;
  gap: 10px;
  justify-items: start;
  align-content: start;
  margin-bottom: 20px;
}

.article-header-block h2 {
  margin: 0;
}

.article-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.article-code-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
}

.reference-price-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 1px solid rgba(27, 111, 89, 0.22);
  border-radius: 8px;
  background: rgba(27, 111, 89, 0.08);
  color: var(--brand);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.reference-price-tag span {
  color: var(--muted);
  font-weight: 700;
}

.reference-price-tag strong {
  color: var(--brand);
  font-size: 14px;
}

.reference-price-tag.compact {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.reference-price-tag.compact strong {
  font-size: 12px;
}

.reference-price-tag.missing {
  border-color: rgba(170, 62, 44, 0.25);
  background: rgba(170, 62, 44, 0.08);
  color: var(--danger);
}

.reference-price-tag.missing strong {
  color: var(--danger);
}

.article-year-strip {
  margin: 2px 0 18px;
}

.references-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.8fr);
  align-items: start;
}

.references-table table small,
.reference-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

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

.reference-detail-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.reference-detail-grid strong {
  display: block;
  margin-top: 4px;
}

.reference-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.reference-edit-form .wide-field,
.reference-edit-form button {
  grid-column: 1 / -1;
}

.reference-timeline-preview {
  margin-top: 12px;
}

.article-match-card {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
  min-width: 220px;
  max-width: 320px;
  width: 100%;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.article-match-card.active {
  border-color: var(--brand);
  background: rgba(27, 111, 89, 0.08);
}

.article-match-card:hover {
  border-color: rgba(27, 111, 89, 0.45);
}

.article-match-code,
.article-match-name {
  display: block;
  width: 100%;
}

.article-match-code {
  font-weight: 700;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.password-field input {
  min-width: 0;
}

.password-toggle {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  border-radius: 12px;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.password-toggle:hover {
  border-color: rgba(27, 111, 89, 0.35);
  background: rgba(27, 111, 89, 0.04);
}

.password-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.compact-password-field {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.article-match-name {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.article-match-card.active .article-match-code {
  color: var(--brand);
}

.article-match-card.active .article-match-name {
  color: var(--ink);
}

.article-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
  margin-bottom: 8px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-align: center;
}

.summary-card span,
.summary-card small {
  display: block;
}

.summary-card strong {
  display: block;
  font-size: 28px;
  margin: 5px 0;
}

.summary-card .deviation-amount {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(27, 111, 89, 0.12);
  color: var(--brand);
  font-weight: 700;
  padding: 6px 12px;
  margin-bottom: 8px;
}

.deviation-card.up .deviation-amount {
  background: rgba(201, 107, 59, 0.12);
  color: #a24f24;
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-pill {
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  padding: 9px 13px;
  color: var(--muted);
}

.table-card {
  overflow: auto;
}

.supplier-articles-table table {
  table-layout: fixed;
  /* Las columnas fijas (articulo 105px + 3 numericas de 115px + relleno) comen
     ~590px, asi que con min-width:0 la de Descripcion se quedaba en ~20px y su
     `overflow-wrap:anywhere` partia el texto letra a letra: se leia en vertical.
     Con un minimo, la tarjeta (.table-card tiene overflow:auto) se desliza en
     horizontal como el resto de tablas de la app, que ya usan min-width:780px. */
  min-width: 780px;
  width: 100%;
}

.supplier-articles-table th:nth-child(1),
.supplier-articles-table td:nth-child(1) {
  width: 105px;
}

.supplier-articles-table th:nth-child(3),
.supplier-articles-table td:nth-child(3),
.supplier-articles-table th:nth-child(4),
.supplier-articles-table td:nth-child(4),
.supplier-articles-table th:nth-child(5),
.supplier-articles-table td:nth-child(5) {
  width: 115px;
  white-space: nowrap;
}

.supplier-articles-table td:nth-child(2) {
  overflow-wrap: anywhere;
  word-break: normal;
}

.severity-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.severity-badge.warning {
  background: rgba(212, 138, 30, 0.14);
  color: #8b5f00;
}

.severity-badge.high,
.severity-badge.critical {
  background: rgba(184, 74, 56, 0.14);
  color: #8f2f24;
}

.inline-button {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(13, 122, 95, 0.1);
  color: var(--brand);
  cursor: pointer;
}

.inline-button.subtle {
  background: rgba(29, 38, 34, 0.08);
  color: var(--ink);
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.review-input {
  min-width: 220px;
  padding: 11px 14px;
  border-radius: 999px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-button {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  align-items: center;
}

.metric-button.active {
  color: var(--brand);
}

.chart-card {
  padding-bottom: 24px;
}

.chart-svg {
  width: 100%;
  height: auto;
}

.chart-axis {
  stroke: rgba(32, 53, 38, 0.24);
  stroke-width: 1.5;
}

.chart-bar-label,
.chart-line-label {
  fill: #31453a;
  font-size: 10px;
  font-weight: 700;
}

.chart-date-label {
  fill: #667665;
  font-size: 9px;
}

.correction-hero,
.pareto-hero,
.negotiation-hero,
.comparator-hero {
  background: linear-gradient(135deg, rgba(13, 122, 95, 0.08), rgba(201, 107, 59, 0.08)), rgba(255, 253, 249, 0.94);
}

.negotiation-page,
.comparator-page {
  gap: 24px;
}

.negotiation-table table {
  min-width: 1040px;
}

.negotiation-target-input {
  width: 130px;
}

.comparator-table table {
  min-width: 1120px;
}

.comparator-table td:first-child,
.negotiation-table td:first-child {
  min-width: 130px;
}

.comparator-table td small,
.negotiation-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  max-width: 320px;
  line-height: 1.35;
}

.comparator-page .search-results {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.comparator-page .search-chip-list {
  display: flex;
  flex-wrap: wrap;
}

.bulk-action-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(13, 122, 95, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  padding: 16px 18px;
}

.bulk-action-card strong,
.bulk-action-card small {
  display: block;
}

.bulk-action-card small {
  margin-top: 4px;
  color: var(--muted);
}

.bulk-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.is-selected-row {
  background: rgba(13, 122, 95, 0.07);
}

.offer-page {
  gap: 24px;
}

.offer-layout {
  grid-template-columns: 1fr;
  gap: 24px;
}

.offer-table table {
  min-width: 980px;
}

.offer-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.offer-table .section-heading {
  align-items: flex-start;
}

.offer-table .section-heading small {
  max-width: 520px;
}

.compact-input {
  max-width: 150px;
}

.pareto-priority-chip {
  cursor: default;
}

.pareto-chart-card {
  padding: 24px;
}

.pareto-bars {
  display: grid;
  gap: 12px;
}

.pareto-bar-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(180px, 1fr) 130px;
  align-items: center;
  gap: 14px;
}

.pareto-bar-name {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pareto-bar-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(27, 111, 89, 0.1);
  overflow: hidden;
}

.pareto-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #d05e2a);
}

.pareto-bar-value {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.pareto-start-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: center;
}

.pareto-start-name {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.pareto-start-name small {
  color: var(--muted);
}

.pareto-start-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.table-input {
  min-width: 110px;
  padding: 10px 12px;
  border-radius: 14px;
}

.wide-cell-input {
  min-width: 240px;
}

.correction-reason-label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.correction-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.audit-page {
  gap: 24px;
}

.audit-filters {
  align-items: end;
}

.audit-filters label {
  display: grid;
  gap: 8px;
}

.audit-filters input,
.audit-filters select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  padding: 12px 14px;
}

.audit-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.audit-stats {
  margin-bottom: 16px;
}

.audit-table-card {
  box-shadow: none;
  padding: 0;
}

.audit-table-card table {
  table-layout: fixed;
  width: 100%;
  min-width: 900px;
}

.audit-table-card th:nth-child(1),
.audit-table-card td:nth-child(1) {
  width: 145px;
}

.audit-table-card th:nth-child(2),
.audit-table-card td:nth-child(2) {
  width: 180px;
}

.audit-table-card th:nth-child(3),
.audit-table-card td:nth-child(3) {
  width: 165px;
}

.audit-table-card th:nth-child(4),
.audit-table-card td:nth-child(4) {
  width: 140px;
}

.audit-entity-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-detail summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 700;
}

.audit-detail .code-block {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

.account-form {
  align-items: end;
}

.account-users-table {
  box-shadow: none;
  padding: 0;
}

.account-users-table table {
  table-layout: fixed;
  width: 100%;
  min-width: 920px;
}

.account-users-table th:nth-child(1),
.account-users-table td:nth-child(1) {
  width: 260px;
}

.account-users-table th:nth-child(5),
.account-users-table td:nth-child(5) {
  width: 180px;
}

.account-users-table th:nth-child(6),
.account-users-table td:nth-child(6) {
  width: 120px;
}

.account-users-table td strong,
.account-users-table td small {
  display: block;
}

.account-users-table td small {
  color: var(--muted);
  margin-top: 3px;
}

@media (max-width: 1320px) {
  .split-layout,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .imports-layout,
  .last-document-card,
  .reference-grid,
  .last-document-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .pareto-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pareto-bar-name {
    white-space: normal;
  }

  .pareto-bar-value {
    text-align: left;
  }

  .pareto-start-row {
    grid-template-columns: 1fr;
  }

  .pareto-start-value {
    text-align: left;
  }
}

.toolbar-copy {
  display: grid;
  gap: 3px;
  min-width: 260px;
  flex: 1 1 320px;
}

.toolbar-copy strong,
.toolbar-copy small {
  display: block;
}

.search-result-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  cursor: pointer;
}

.search-result-card:hover {
  border-color: rgba(27, 111, 89, 0.35);
  background: rgba(27, 111, 89, 0.03);
}

.search-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-result-title {
  margin: 0;
  color: var(--ink);
}

.search-result-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-result-hint,
.search-result-meta {
  color: var(--muted);
  font-size: 13px;
}


.alert-action-stack {
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}

.review-reason-select {
  min-width: 210px;
}

.inline-button.danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
}

tr.selected-row {
  background: rgba(27, 111, 89, 0.06);
}

/* Alertas: desplegable inline de historial (2026-06-08) */
.alert-row {
  cursor: pointer;
}

.alert-row:hover {
  background: rgba(27, 111, 89, 0.05);
}

.alert-row .row-caret {
  display: inline-block;
  width: 1em;
  margin-right: 4px;
  color: #8a8174;
  font-size: 0.85em;
}

.alert-detail-row > td {
  background: var(--bg-strong);
  border-top: 2px solid var(--brand);
  border-bottom: 1px solid var(--line-strong);
  padding: 16px 18px;
  box-shadow: inset 0 6px 10px -8px rgba(48, 38, 24, 0.25);
}

.alert-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
}

.alert-status-pill.open {
  background: rgba(212, 138, 30, 0.16);
  color: #8b5f00;
}

.alert-status-pill.reviewed {
  background: rgba(27, 111, 89, 0.16);
  color: #1b6f59;
}

.alert-status-pill.dismissed {
  background: rgba(120, 113, 100, 0.18);
  color: #5b5347;
}

.alert-detail-timeline {
  overflow-x: auto;
}

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

.alert-detail-timeline th,
.alert-detail-timeline td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.alert-detail-timeline th {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Color por tipo de evento en la cronologia */
.tl-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tl-badge.tl-alert {
  background: rgba(212, 138, 30, 0.16);
  color: #8b5f00;
}

.tl-badge.tl-reference {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

.tl-badge.tl-review {
  background: rgba(27, 111, 89, 0.16);
  color: #1b6f59;
}

.alert-detail-timeline .tl-row.tl-alert td:first-child {
  box-shadow: inset 3px 0 0 #d48a1e;
}

.alert-detail-timeline .tl-row.tl-reference td:first-child {
  box-shadow: inset 3px 0 0 #2563eb;
}

.alert-detail-timeline .tl-row.tl-review td:first-child {
  box-shadow: inset 3px 0 0 #1b6f59;
}

/* ============================================================================
   MENU: agrupado por bloques, contraible en escritorio y en cajon en movil.
   Solo se anaden reglas: no se modifica ninguna existente ni ningun color
   (se reutilizan los tokens --brand, --panel, --ink, --muted, --line...).
   ========================================================================== */

.nav-group + .nav-group { margin-top: 18px; }

.nav-group-label {
  margin: 0 0 8px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
}

.nav-group-items { display: grid; gap: 6px; }

.nav-button { display: grid; grid-template-columns: 20px 1fr; align-items: start; gap: 12px; }
.nav-ico { margin-top: 2px; color: var(--brand); }
.nav-copy { min-width: 0; }
.nav-button.active .nav-ico { color: var(--brand-ink); }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.sidebar-toggle {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.sidebar-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* estado contraido: franja de iconos */
.main-screen[data-collapsed="true"] { grid-template-columns: 76px 1fr; }
.main-screen[data-collapsed="true"] .brand-block,
.main-screen[data-collapsed="true"] .nav-group-label,
.main-screen[data-collapsed="true"] .nav-copy { display: none; }
.main-screen[data-collapsed="true"] .nav-button { grid-template-columns: 1fr; justify-items: center; padding: 12px 6px; }
.main-screen[data-collapsed="true"] .sidebar { padding: 16px 10px; }
.main-screen[data-collapsed="true"] .sidebar-head { justify-content: center; }
.main-screen[data-collapsed="true"] .sidebar-toggle svg { transform: rotate(180deg); }

/* solo existen en movil */
.menu-button { display: none; }
.drawer-close { display: none; }
.drawer-veil { display: none; }

/* ---- ESCRITORIO: el menu SIEMPRE al lado del contenido --------------------
   app.css tiene mas arriba un @media (max-width:1100px) que pone .main-screen
   a una sola columna, y por eso el contenido caia DEBAJO del menu en cuanto la
   ventana bajaba de 1100px. Con el cajon de movil esa regla ya no hace falta:
   se neutraliza de 901px para arriba.                                       */
@media (min-width: 901px) {
  .main-screen { grid-template-columns: 290px 1fr; }
  .main-screen[data-collapsed="true"] { grid-template-columns: 76px 1fr; }
  .sidebar { position: static; transform: none; visibility: visible; }
}

/* ---- MOVIL: el menu pasa a ser un cajon lateral -------------------------- */
@media (max-width: 900px) {
  .main-screen { grid-template-columns: 1fr; padding: 12px; gap: 12px; }

  .menu-button {
    display: inline-grid;
    place-items: center;
    gap: 2px;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: var(--panel-strong);
    color: var(--brand-ink);
    cursor: pointer;
    flex: 0 0 auto;
  }
  .menu-button strong { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; }

  .topbar { display: flex; align-items: center; gap: 14px; }
  .topbar h1 { font-size: 24px; }
  .topbar-status { display: none; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    width: min(320px, 86vw);
    border-radius: 0 24px 24px 0;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 220ms ease, visibility 0s linear 220ms;
    overflow-y: auto;
  }
  .main-screen[data-menu-open="true"] .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 220ms ease;
  }

  .drawer-veil {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(29, 38, 34, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  .main-screen[data-menu-open="true"] .drawer-veil { opacity: 1; pointer-events: auto; }

  .nav-button { padding: 15px 14px; min-height: 56px; align-items: center; }
  .nav-button span { font-size: 12px; }

  .sidebar-toggle { display: none; }
  .drawer-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--ink);
    cursor: pointer;
    flex: 0 0 auto;
  }
}
