:root {
  --navy: #292c3e;
  --ink: #1d2433;
  --muted: #687386;
  --line: #e1e6ed;
  --surface: #ffffff;
  --background: #f3f5f8;
  --blue: #315cdb;
  --green: #1d9a5b;
  --green-bg: #eaf8f1;
  --red: #c63d4b;
  --red-bg: #fff0f1;
  --amber: #a76b12;
  --amber-bg: #fff7e5;
  --gray: #667085;
  --gray-bg: #f0f2f5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button, .button-link { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(49, 92, 219, .12), transparent 34%),
    radial-gradient(circle at 88% 92%, rgba(29, 154, 91, .10), transparent 30%),
    var(--background);
}
.login-card {
  width: min(100%, 440px);
  padding: 40px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(29, 36, 51, .12);
}
.brand { margin-bottom: 34px; color: var(--navy); font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.brand span { color: #c6db24; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; color: var(--navy); font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -.03em; }
h2 { margin: 0 0 5px; color: var(--navy); font-size: 18px; }
.lead, .summary { color: var(--muted); line-height: 1.5; }
.lead { margin: 14px 0 30px; }
label { display: block; color: #465064; font-size: 14px; font-weight: 700; }
.login-card label { margin: 18px 0 7px; }
input, textarea, select {
  width: 100%;
  border: 1px solid #ccd2dc;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.login-card input, select { height: 48px; padding: 0 13px; }
textarea { padding: 11px 13px; line-height: 1.45; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49, 92, 219, .11); }
input:disabled, textarea:disabled { background: #f1f3f6; }

.primary, .secondary, .ghost, .danger, .success-button, .configure-button, .button-link {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none;
}
.primary { border: 0; color: #fff; background: var(--blue); }
.login-card .primary { width: 100%; margin-top: 26px; }
.secondary { border: 0; color: #fff; background: var(--blue); }
.configure-button { border: 0; color: #fff; background: #7251b5; }
.ghost { border: 1px solid #cfd5df; color: #4a5568; background: #fff; }
.danger { border: 1px solid #f0bcc1; color: var(--red); background: var(--red-bg); }
.success-button { border: 0; color: #fff; background: var(--green); }
.button-link { display: inline-flex; align-items: center; border: 0; color: #fff; background: var(--green); }
.error { margin: 16px 0 0; color: var(--red); font-size: 14px; }

.dashboard { width: min(1840px, 100%); margin: 0 auto; padding: 32px clamp(14px, 3vw, 44px) 22px; }
header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.summary { margin: 9px 0 0; }
.header-actions { display: flex; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.batch-picker { width: 250px; }
.batch-picker select { margin-top: 5px; }
.notice { margin-bottom: 15px; padding: 13px 16px; border-radius: 11px; color: var(--red); background: var(--red-bg); }
.notice.success { color: var(--green); background: var(--green-bg); }

.settings-card, .shared-settings-card, .action-card, .response-card, .finish-card, .table-card, .prod-transfer-card {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(29, 36, 51, .045);
}
.settings-card { display: grid; grid-template-columns: minmax(230px, .55fr) minmax(420px, 1.45fr); align-items: center; gap: 22px; padding: 18px 20px; }
.settings-card p, .table-heading p, .action-card p { margin: 0; color: var(--muted); font-size: 14px; }
.table-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.save-state { color: var(--green); font-size: 13px; font-weight: 700; }
.save-state.saving { color: var(--amber); }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1630px; border-collapse: collapse; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafbfc; font-size: 11px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fbfcff; }
tbody tr.selected { background: #eef3ff; box-shadow: inset 4px 0 0 var(--blue); }
.number-column { width: 44px; }
.row-number { width: 44px; color: var(--muted); font-weight: 800; text-align: center; }
.table-input { min-width: 135px; height: 40px; padding: 0 10px; font-size: 13px; }
.table-input.duplicate { border-color: var(--red); background: var(--red-bg); }
.field-error { display: block; margin-top: 4px; color: var(--red); font-size: 11px; }
.mono { min-width: 116px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.stacked-status { min-width: 148px; }
.stacked-status .status { display: flex; width: max-content; margin: 2px 0; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 27px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.good { color: var(--green); background: var(--green-bg); }
.bad { color: var(--red); background: var(--red-bg); }
.warn { color: var(--amber); background: var(--amber-bg); }
.unknown { color: var(--gray); background: var(--gray-bg); }

.action-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; }
.bulk-action-card { border-color: #b8c7f4; background: #f7f9ff; box-shadow: 0 9px 28px rgba(49, 92, 219, .09); }
.bulk-action-card .eyebrow { margin-bottom: 5px; }
.action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.action-feedback { min-height: 20px; margin-top: 5px !important; color: var(--blue) !important; font-weight: 700; }
.response-card { padding: 18px 20px; }
.response-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.response-heading > div { display: flex; align-items: center; gap: 10px; }
.response-heading span { color: var(--muted); font-size: 13px; }
.small-button { min-height: 34px; padding: 0 11px; font-size: 12px; }
.response-card pre { height: calc(10 * 1.5em + 26px); margin: 12px 0 0; padding: 13px 15px; border-radius: 10px; color: #223028; background: var(--green-bg); font: 650 14px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-x: hidden; overflow-y: auto; overflow-wrap: anywhere; }
.shared-settings-card { padding: 18px 20px; }
.shared-settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.shared-settings-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.shared-settings-card > label { margin: 14px 0 7px; }
.commands-label { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0 7px; }
.commands-label span { color: var(--muted); font-size: 13px; font-weight: 700; }
#tracker-commands { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.prod-transfer-card { border-color: #efb8bd; overflow: hidden; }
.prod-transfer-card summary { padding: 18px 20px; color: var(--red); background: var(--red-bg); cursor: pointer; font-size: 16px; font-weight: 800; }
.prod-transfer-card[open] summary { border-bottom: 1px solid #efc7cb; }
.prod-transfer-content { padding: 18px 20px; }
.prod-transfer-content > p:first-child { margin: 0 0 16px; color: var(--muted); }
.prod-transfer-content label { margin-bottom: 7px; }
.prod-transfer-content input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.prod-transfer-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.prod-transfer-actions .save-state { flex: 1; }
.finish-card { padding: 18px 20px; }
.finish-card label { margin-bottom: 7px; }
.finish-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.finish-actions p { flex: 1; margin: 0; color: var(--muted); font-size: 13px; }
.finish-button { width: auto; margin: 0; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 5px 3px; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .dashboard { padding-top: 22px; }
  header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .batch-picker { flex: 1; min-width: 240px; }
  .settings-card { grid-template-columns: 1fr; }
  .action-card { align-items: stretch; flex-direction: column; }
  .action-buttons { justify-content: flex-start; }
}

@media (max-width: 600px) {
  .login-card { padding: 30px 22px; }
  .header-actions > * { width: 100%; }
  .table-scroll { overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; min-width: 0; }
  thead { display: none; }
  tbody { padding: 9px; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 9px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
  tbody tr:last-child { margin-bottom: 0; }
  td { padding: 0; border: 0; }
  td::before { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; content: attr(data-label); }
  .row-number { grid-column: 1 / -1; text-align: left; }
  .table-input { min-width: 0; width: 100%; }
  .stacked-status { min-width: 0; }
  .action-buttons { display: grid; grid-template-columns: 1fr; }
  .finish-actions { align-items: stretch; flex-direction: column; }
  .finish-actions > * { width: 100%; justify-content: center; text-align: center; }
  .prod-transfer-actions { align-items: stretch; flex-direction: column; }
  .prod-transfer-actions > * { width: 100%; text-align: center; }
  footer { display: block; line-height: 1.8; }
  footer span { display: block; }
}
