:root {
  --page-bg: #f3f6f8;
  --sidebar-bg: #132238;
  --sidebar-soft: rgba(255,255,255,.1);
  --accent: #0f766e;
  --accent-dark: #115e59;
  --muted: #6b7280;
  --line: #dfe6ee;
}

body {
  background: var(--page-bg);
  color: #17202a;
  font-family: Arial, Helvetica, sans-serif;
}

a { text-decoration: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 22px;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 700;
}

.brand:hover { color: #fff; }

.sidebar .brand .brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background-color: #1e3a8a !important;
  color: #fff !important;
}

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

.sidebar nav a {
  color: #dbeafe;
  padding: 10px 12px;
  border-radius: 8px;
}

.sidebar nav a:hover {
  background: var(--sidebar-soft);
  color: #fff;
}

.nav-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff;
  background: rgba(255,255,255,.08);
}

.nav-search input::placeholder {
  color: #cbd5e1;
}

.user-panel {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}

.user-panel span,
.user-panel small {
  display: block;
}

.user-panel small {
  color: #cbd5e1;
}

.content {
  margin-left: 260px;
  padding: 28px;
}

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

.login-panel {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 14px 35px rgba(23,32,42,.08);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
}

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

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

.metric, .info-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(23,32,42,.06);
}

.metric span, .info-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.metric strong {
  display: block;
  font-size: 30px;
}

.info-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

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

.wide { grid-column: span 2; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(23,32,42,.06);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  font-size: 18px;
  margin: 0;
}

.compact-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
}

.compact-line:last-child { border-bottom: 0; }
.compact-line span, .empty, small { color: var(--muted); }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.filters input, .filters select {
  min-height: 42px;
}

.change-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.filter-field {
  display: grid;
  gap: 5px;
}

.filter-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.filter-actions {
  display: flex;
  gap: 8px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #334155;
  background: #fff;
  font-weight: 600;
}

.badge-status {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
}

.status-new, .status-ordered { background: #2563eb; }
.status-waiting, .status-missing_lines, .status-in_transit, .status-partly_received { background: #b7791f; }
.status-ready, .status-received, .status-completed, .status-shipped { background: #15803d; }
.status-receiving { background: #7c3aed; }
.status-archived { background: #64748b; }
.status-ready_to_ship { background: #0f766e; }
.status-in_progress { background: var(--accent); }
.status-cancelled { background: #c2410c; }

.copyable {
  cursor: pointer;
  border-bottom: 1px dotted #94a3b8;
}

.copyable.copied {
  color: #0f766e;
  border-bottom-color: #0f766e;
}

.ghost-button {
  width: 100%;
  min-height: 40px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #0d6efd;
  font-weight: 600;
}

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

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

.check-grid .form-check {
  min-height: 48px;
  padding: 12px 12px 12px 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table tr[onclick] { cursor: pointer; }
.table code { color: #334155; }

.supplier-ref {
  display: block;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.2;
}

.supplier-name {
  color: #17202a;
  font-size: 16px;
}

.message {
  padding: 12px 14px;
  border-radius: 8px;
  background: #e6f4f1;
  border: 1px solid #b7ded7;
  margin-bottom: 16px;
}

.integration-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.ok { background: #15803d; }
.dot.warning { background: #b7791f; }

.integration-docs {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.sync-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sync-status strong,
.sync-status small {
  display: block;
}

.api-doc {
  display: grid;
  gap: 16px;
}

.api-doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.api-doc-header h3 {
  margin: 0;
  font-size: 20px;
}

.api-doc-header code,
.api-doc dd code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.api-doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.api-doc h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.api-doc dl {
  margin: 0;
  display: grid;
  gap: 7px;
}

.api-doc dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.api-doc dd {
  margin: 0 0 8px;
  line-height: 1.5;
}

.label-sheet {
  width: 420px;
  min-height: 260px;
  padding: 26px;
  background: #fff;
  border: 1px dashed #111827;
  border-radius: 8px;
}

.packing-slip {
  width: min(760px, 100%);
  min-height: 520px;
}

.label-sheet pre {
  white-space: pre-wrap;
  margin: 0;
  font: 18px/1.45 Arial, Helvetica, sans-serif;
}

@media (max-width: 1000px) {
  .sidebar {
    position: static;
    width: auto;
  }
  .content {
    margin-left: 0;
    padding: 18px;
  }
  .metric-grid, .summary-grid, .dashboard-grid, .detail-grid, .api-doc-grid, .sync-status-grid {
    grid-template-columns: 1fr;
  }
  .api-doc-header {
    flex-direction: column;
  }
  .check-grid {
    grid-template-columns: 1fr;
  }
  .wide { grid-column: span 1; }
  .page-header, .filters {
    align-items: stretch;
    flex-direction: column;
  }
  .change-filters {
    grid-template-columns: 1fr;
  }
  .filter-search {
    grid-column: span 1;
  }
  .filter-actions {
    flex-direction: column;
  }
}

@media print {
  .sidebar, .page-header button, .messages {
    display: none;
  }
  .content {
    margin: 0;
    padding: 0;
  }
  .label-sheet {
    border: 0;
    box-shadow: none;
  }
}
