[hidden] {
  display: none !important;
}
/* ============================================================
   Design tokens — edit colours here first
   ============================================================ */
:root {
  --bg: #f4f5f7;
  --card: #fff;
  --ink: #1c1f24;
  --muted: #6b7280;
  --line: #e3e6ea;
  --brand: #1c84c6;
  --brand-dark: #1a7bb9;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --err: #c0392b;
  --info: #2b6cb0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font:
    14px/1.45 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a {
  color: var(--info);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1 {
  font-size: 20px;
  margin: 0 0 10px;
}
h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
h3 {
  font-size: 14px;
  margin: 18px 0 6px;
}
h4 {
  margin: 12px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
p {
  margin: 6px 0;
}
code {
  background: #eef0f3;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 12px;
}
pre {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  overflow: auto;
  max-height: 420px;
  margin: 6px 0;
}
pre.wrap {
  white-space: pre-wrap;
  word-break: break-word;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.center {
  text-align: center;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nowrap {
  white-space: nowrap;
}
.text-error {
  color: var(--err);
}

/* ============================================================
   Top menu bar + brand
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  height: 72px;
  background: #2f4050;
  color: #fff;
}
.topbar nav {
  display: flex;
  gap: 16px;
  flex: 1;
}
.topbar nav a {
  color: #cfd3da;
}
.topbar nav a:hover {
  color: #fff;
  text-decoration: none;
}
.brand {
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover {
  text-decoration: none;
}
.brand.big {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 4px;
}
.logo {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #cfd3da;
}
.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px;
}
.container-fluid {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.narrow {
  max-width: 560px;
  margin: 40px auto;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
.stack > * + * {
  margin-top: 12px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.inline {
  display: inline;
}
label {
  display: block;
  font-weight: 500;
}
label > span.muted {
  font-weight: 400;
}
label input,
label select,
label textarea,
.filters input,
.filters select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #cdd2d9;
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
label.check input {
  width: auto;
  margin: 0;
}
textarea {
  resize: vertical;
}
textarea.mono {
  width: 100%;
  padding: 10px;
  border: 1px solid #cdd2d9;
  border-radius: 6px;
  background: #fafbfc;
}

/* ============================================================
   Buttons — variants: .btn-primary (blue) .btn-success (green)
   .btn-danger (red) .btn-info (teal) .btn-warning (orange)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid #cdd2d9;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: #f1f3f5;
  text-decoration: none;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-dark);
}
.btn-success {
  background: #1ab394;
  border-color: #1ab394;
  color: #fff;
}
.btn-success:hover {
  background: #18a689;
  color: #fff;
}
.btn-danger {
  background: #ed5565;
  border-color: #ed5565;
  color: #fff;
}
.btn-danger:hover {
  background: #ec4758;
  color: #fff;
}
.btn-info {
  background: #23c6c8;
  border-color: #23c6c8;
  color: #fff;
}
.btn-info:hover {
  background: #21b9bb;
  color: #fff;
}
.btn-warning {
  background: #f8ac59;
  border-color: #f8ac59;
  color: #fff;
}
.btn-warning:hover {
  background: #f7a54a;
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #cfd3da;
}
.card .btn-ghost,
.discard .btn-ghost,
main .btn-ghost {
  color: var(--muted);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.btn-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.btn-x:hover {
  color: var(--err);
}
.alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin: 0 0 10px;
  border: 1px solid transparent;
}
.alert-ok {
  background: #e8f6ee;
  border-color: #bfe3cd;
  color: #1b5e38;
}
.alert-error {
  background: #fdecea;
  border-color: #f5c2bd;
  color: #7d1f16;
}
.alert-warn {
  background: #fff6e5;
  border-color: #f6dfb0;
  color: #6b4a0c;
}
.alert.small {
  padding: 6px 10px;
  margin-bottom: 6px;
}

/* ============================================================
   Tables
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
}
.table.compact th,
.table.compact td {
  padding: 5px 8px;
}

/* ============================================================
   Status badges (order states)
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #eef0f3;
  color: #3a4049;
  text-transform: capitalize;
}
.badge-sent {
  background: rgba(26, 179, 148, 0.15);
  color: #128a72;
}
.badge-parsed {
  background: rgba(248, 172, 89, 0.2);
  color: #c47c1e;
}
.badge-failed_send,
.badge-failed_parse {
  background: rgba(237, 85, 101, 0.15);
  color: #d43a4b;
}
.badge-parsing,
.badge-uploaded {
  background: rgba(248, 172, 89, 0.2);
  color: #c47c1e;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 10px 0;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
}
.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filters input,
.filters select {
  margin: 0;
  width: auto;
}
.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dropzone {
  border: 2px dashed #cdd2d9;
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
}
.dropzone.over {
  border-color: var(--brand);
  background: #fbf7ee;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #e3e6ea;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 18px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* login */

/* ============================================================
   Login page
   ============================================================ */
.login-page {
  display: grid;
  place-items: center;
  background: #2f4050;
}
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.login-logo {
  height: 64px;
  width: auto;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 32px;
  width: min(420px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.btn-ms {
  width: 100%;
  justify-content: center;
  background: #2f2f2f;
  border-color: #2f2f2f;
  padding: 11px;
}
.btn-ms:hover {
  background: #000;
}
/* review */
.review {
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
  flex: 1;
  min-height: calc(100vh - 52px);
}
.pdf-pane {
  position: sticky;
  top: 0;
  height: calc(100vh - 52px);
  background: #4a4d52;
  border-right: 1px solid #2f3238;
  display: flex;
  flex-direction: column;
}
.pdf-pane iframe {
  width: 100%;
  flex: 1;
  border: 0;
}
.pdf-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 6px 10px;
  background: #2b2e33;
}
.pdf-tabs button {
  background: transparent;
  border: 1px solid transparent;
  color: #cfd3da;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.pdf-tabs button.active {
  background: #4a4d52;
  color: #fff;
}
.pdf-tabs a {
  margin-left: auto;
  color: #cfd3da;
}
.pages-view {
  flex: 1;
  overflow: auto;
  padding: 12px;
}
.pages-view figure {
  margin: 0 0 14px;
}
.pages-view img {
  width: 100%;
  aspect-ratio: 1/1.4142;
  display: block;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.pages-view figcaption {
  color: #cfd3da;
  font-size: 11px;
  text-align: center;
  margin-top: 4px;
}
.data-pane {
  padding: 16px 20px 40px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.header-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  padding: 12px;
}
.hf span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.hf input {
  margin-top: 2px;
  padding: 6px 8px;
}
.hf input.missing {
  border-color: var(--err);
  background: #fff5f4;
}
.totals {
  display: flex;
  gap: 26px;
  align-items: center;
  padding: 10px 14px;
}
.totals strong {
  font-size: 16px;
  margin-left: 4px;
}
.match {
  margin-left: auto;
  font-weight: 600;
}
.match.ok {
  color: var(--ok);
}
.match.bad {
  color: var(--err);
}
.table.lines td {
  padding: 3px 6px;
}
.table.lines input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font: inherit;
}
.table.lines input:hover {
  border-color: #d5d9df;
}
.table.lines input:focus {
  border-color: var(--brand);
  background: #fff;
  outline: none;
}
.table.lines .in-item {
  width: 64px;
}
.table.lines .in-size {
  width: 52px;
}
.table.lines .in-qty {
  width: 64px;
  text-align: right;
}
.table.lines .in-product {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  min-width: 230px;
}
.table.lines tr.edited td:first-child {
  box-shadow: inset 3px 0 0 var(--info);
}
.table.lines tr.lowconf td {
  background: #fffbea;
}
.table.lines tr.invalid td {
  background: #fdecea;
}
.prod-cell .orig {
  font-size: 11px;
  color: var(--muted);
  padding: 0 7px 3px;
  cursor: pointer;
}
.prod-cell .orig s {
  color: var(--err);
  text-decoration: line-through;
}
.prod-cell .orig:hover::after {
  content: " (double-click to restore)";
}
.table.lines tr.overridden .in-product {
  font-weight: 600;
  color: #1d4e89;
}
.table.lines td.pos {
  color: var(--muted);
  font-size: 11px;
  width: 28px;
}
.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
details.card summary {
  cursor: pointer;
  font-weight: 600;
}
.discard {
  margin-top: auto;
  align-self: flex-start;
}

/* ============================================================
   Send modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal[hidden] {
  display: none;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: min(640px, 92vw);
  max-height: 85vh;
  overflow: auto;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
@media (max-width: 1000px) {
  .review {
    grid-template-columns: 1fr;
  }
  .pdf-pane {
    position: static;
    height: 50vh;
  }
}

.send-gif {
  margin: 10px 0;
  text-align: center;
}
.send-gif iframe {
  max-width: 100%;
  border: 0;
  border-radius: 8px;
}
.send-gif p {
  margin: 2px 0 0;
}

.logo-img {
  height: 44px;
  width: auto;
  display: block;
}
.brand.big {
  justify-content: center;
}
