:root {
  color-scheme: light;
  --ink: #f7f9fa;
  --muted: #b7c2ca;
  --line: rgba(255, 255, 255, .16);
  --glass: rgba(20, 27, 32, .68);
  --glass-strong: rgba(28, 35, 40, .82);
  --accent: #da2f0c;
  --accent-dark: #a91e05;
  --navy: #11191f;
  --success: #176b45;
  --danger: #a72a2a;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(218, 47, 12, .30), transparent 29%),
    radial-gradient(circle at 91% 18%, rgba(92, 111, 123, .28), transparent 25%),
    radial-gradient(circle at 70% 88%, rgba(218, 47, 12, .13), transparent 31%),
    linear-gradient(135deg, #11171b 0%, #202a30 47%, #0d1215 100%);
  background-attachment: fixed;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}
body::before { width: 280px; height: 280px; left: -90px; bottom: 8%; background: rgba(218, 47, 12, .15); }
body::after { width: 220px; height: 220px; right: 4%; top: 18%; background: rgba(255, 255, 255, .055); }

button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 24px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, #ef4826, #a91e05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 25px rgba(169,30,5,.32);
  font-weight: 900;
  letter-spacing: -.05em;
}

.login-card h1 { margin: 22px 0 6px; font-size: 2rem; }
.login-card p { color: var(--muted); }
.login-card label, .print-controls label { display: block; margin: 24px 0 8px; font-weight: 700; }
.login-card input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  font-size: 1.05rem;
  color: white;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.14);
}

.login-card button, .print-button {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, #ee4826, var(--accent-dark));
  font-weight: 850;
  box-shadow: 0 10px 26px rgba(218,47,12,.28);
}

.error { min-height: 1.25rem; margin-bottom: 0; color: var(--danger) !important; }

.topbar {
  min-height: 92px;
  padding: 18px clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(105deg, rgba(7,11,14,.94), rgba(24,31,36,.91) 72%, rgba(63,24,18,.84));
  box-shadow: 0 12px 38px rgba(15,24,32,.18);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.topbar h1 { margin: 2px 0 0; font-size: clamp(1.5rem, 3vw, 2.15rem); }
.eyebrow, .step { margin: 0; font-size: .76rem; font-weight: 900; letter-spacing: .14em; }
.eyebrow { color: #ff7558; }
.step { color: #f04a28; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.count-pill, .printer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 800;
}
.count-pill { border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.12); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
.printer-pill { color: #ffd9d0; border: 1px solid rgba(255,105,74,.32); background: rgba(218,47,12,.18); box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.secondary, .text-button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  color: white;
}
.secondary { border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); font-weight: 750; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.text-button { border: 0; background: transparent; }

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(390px, .75fr);
  gap: 22px;
  padding: 24px clamp(18px, 3vw, 44px) 42px;
  max-width: 1500px;
  margin: 0 auto;
}

.job-panel, .print-panel {
  min-height: calc(100vh - 158px);
  padding: 24px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 24px;
  background: var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.10);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}
.print-panel { position: sticky; top: 18px; align-self: start; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 1.25rem; }
.refresh-time { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 14px;
  padding: 0 14px;
  min-height: 52px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: rgba(255,255,255,.075);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
}
.search-box:focus-within { border-color: rgba(218,47,12,.85); background: rgba(255,255,255,.11); box-shadow: 0 0 0 3px rgba(218,47,12,.16); }
.search-box span { font-size: 1.6rem; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; color: white; background: transparent; font-size: 1rem; }
.search-box input::placeholder { color: #9eacb6; }

.state-card, .empty-preview {
  padding: 28px;
  border: 1px dashed #bdc7d0;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,.045);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.job-list { display: grid; gap: 9px; max-height: calc(100vh - 310px); overflow: auto; padding-right: 4px; }
.job-card {
  width: 100%;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(125px, .7fr) minmax(160px, 1fr) minmax(180px, 1.4fr);
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 13px;
  color: var(--ink);
  text-align: left;
  background: rgba(255,255,255,.065);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 5px 18px rgba(0,0,0,.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.job-card:hover, .job-card:focus-visible { border-color: rgba(218,47,12,.78); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.18); outline: 0; }
.job-card.selected { color: white; border-color: rgba(255,93,61,.72); background: linear-gradient(135deg, rgba(218,47,12,.92), rgba(125,24,6,.94)); box-shadow: 0 12px 30px rgba(104,19,4,.30), inset 0 1px 0 rgba(255,255,255,.14); }
.job-card strong, .job-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-card strong { font-size: 1rem; }
.job-card span { font-size: .9rem; color: var(--muted); }
.job-card.selected span { color: #ffe4de; }

.empty-preview { min-height: 440px; display: grid; place-content: center; gap: 8px; }
.label-icon { width: 86px; height: 58px; margin: 0 auto 10px; border: 3px solid #93a1ad; border-radius: 6px; position: relative; }
.label-icon::after { content: ""; position: absolute; left: 10px; right: 10px; top: 18px; height: 3px; background: #93a1ad; box-shadow: 0 12px #93a1ad, 0 24px #93a1ad; }

.label-frame {
  width: min(640px, 100%);
  aspect-ratio: 3 / 2;
  margin: 22px auto;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(200,210,216,.88), rgba(105,120,129,.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 0 0 1px rgba(255,255,255,.13), 0 22px 48px rgba(0,0,0,.34);
}
.label-paper {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  padding: 17px 15px 12px;
  display: flex;
  flex-direction: column;
  color: #050505;
  background: white;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  line-height: 1.18;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  overflow: hidden;
}
.label-job, .label-customer, .label-item, .label-description, #labelSalesOrder { display: block; width: 100%; white-space: nowrap; line-height: 1.06; }
.label-job { font-size: 38px; }
.label-customer { margin-top: 3px; font-size: 29px; }
.label-item { margin-top: 4px; font-size: 28px; }
.label-description { margin-top: 2px; font-size: 20px; }
.label-order-row { margin-top: 5px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; white-space: nowrap; }
#labelSalesOrder { width: 42%; font-size: 24px; }
.label-due { width: 58%; text-align: right; font-size: 23px; line-height: 1.08; }
.label-plaque { margin-top: 4px; font-size: 22px; line-height: 1.08; }
.label-qc { margin-top: auto; align-self: flex-start; font-size: 30px; line-height: 1; }
.label-footer {
  margin-top: 8px;
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid #8a8a8a;
  font-size: 14px;
}
.label-footer > span { margin-right: 14px; }

.print-controls { border-top: 1px solid rgba(255,255,255,.72); padding-top: 2px; }
.print-controls label { margin-top: 14px; }
.quantity-control { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.quantity-control button, .quantity-control input {
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 11px;
  text-align: center;
  color: white;
  background: rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  font-weight: 850;
  font-size: 1.1rem;
}
.quantity-control button { font-size: 1.6rem; }
.print-button:disabled { cursor: wait; filter: grayscale(.65); opacity: .7; }
.toast { margin-top: 14px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.25); border-radius: 11px; color: white; background: rgba(23,107,69,.92); box-shadow: 0 10px 28px rgba(23,107,69,.18); font-weight: 700; backdrop-filter: blur(12px); }
.toast.error-toast { background: var(--danger); }

.batch-dialog {
  width: min(500px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 22px;
  color: var(--ink);
  background: transparent;
  box-shadow: 0 30px 90px rgba(0,0,0,.58);
}
.batch-dialog::backdrop {
  background: rgba(5, 8, 10, .76);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
.batch-dialog-card {
  padding: 30px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(218,47,12,.22), transparent 42%),
    linear-gradient(145deg, rgba(34,42,47,.98), rgba(13,18,21,.98));
}
.batch-warning-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border: 1px solid rgba(255,122,91,.46);
  border-radius: 17px;
  color: white;
  background: linear-gradient(145deg, #ef4826, #a91e05);
  box-shadow: 0 12px 30px rgba(169,30,5,.36), inset 0 1px 0 rgba(255,255,255,.2);
  font-size: 2rem;
  font-weight: 900;
}
.batch-dialog h2 { margin: 8px 0 10px; font-size: 1.65rem; }
.batch-dialog-message { margin: 0 auto; max-width: 390px; color: var(--muted); line-height: 1.55; }
.batch-dialog-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px; margin-top: 26px; }
.batch-dialog-actions button { min-height: 52px; margin: 0; }
.batch-cancel { width: 100%; }
.batch-confirm { box-shadow: 0 10px 28px rgba(218,47,12,.34); }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .job-panel, .print-panel { min-height: auto; }
  .print-panel { position: static; }
  .job-list { max-height: 58vh; }
}

@media (max-width: 600px) {
  .topbar { flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .workspace { padding: 12px; }
  .job-panel, .print-panel { padding: 16px; border-radius: 15px; }
  .job-card { grid-template-columns: 1fr; gap: 3px; }
  .label-frame { width: min(500px, 92vw); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
