:root {
  color-scheme: light;
  --paper: #f3f4ec;
  --surface: #fffefa;
  --ink: #172c26;
  --muted: #68756d;
  --line: #d9ded4;
  --green: #176a51;
  --green-dark: #0f4c3b;
  --lime: #c4dc62;
  --gold: #e8b24b;
  --red: #a54135;
  --soft-green: #e9f0e7;
  --shadow: 0 16px 48px rgba(23, 44, 38, 0.08);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, transparent, transparent 35px, rgba(23, 44, 38, 0.025) 36px);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
[hidden] { display: none !important; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.82);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px 9px 9px 2px;
  background: var(--green);
  color: white;
  font-family: Georgia, serif;
  font-size: 23px;
  font-style: italic;
}
.brand-name { font-size: 15px; font-weight: 800; }
.brand-name span { color: var(--green); }
.topbar-meta, .environment { display: flex; align-items: center; }
.topbar-meta { gap: 22px; color: var(--muted); font-size: 12px; }
.environment { gap: 8px; color: var(--ink); font-weight: 700; }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--lime); }
.api-status { padding-left: 18px; border-left: 1px solid var(--line); }
.api-status.is-offline { color: var(--red); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.login-layout {
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  align-items: center;
  gap: clamp(52px, 10vw, 150px);
  padding: 56px 4%;
  animation: rise-in 480ms ease-out both;
}
.login-intro { max-width: 530px; padding: 26px 0; }
.eyebrow, .step-label, .queue-label {
  margin: 0;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.eyebrow { letter-spacing: 1.4px; }
h1, h2, p { margin-top: 0; }
.login-intro h1, .workspace-heading h1 {
  margin: 20px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 400;
  line-height: 0.98;
}
.login-intro h1 em { color: var(--green); font-weight: 400; }
.intro-copy { max-width: 370px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.intro-rule { display: flex; align-items: center; gap: 7px; margin: 34px 0 16px; }
.intro-rule span { width: 27px; height: 4px; border-radius: 3px; background: var(--green); }
.intro-rule span:nth-child(2) { width: 12px; background: var(--gold); }
.intro-rule span:nth-child(3) { width: 6px; background: var(--lime); }
.intro-foot { color: var(--muted); font-size: 12px; }

.login-form {
  width: 100%;
  max-width: 410px;
  padding: 34px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-heading { margin-bottom: 26px; }
.form-heading h2 { margin: 11px 0 5px; font-family: Georgia, serif; font-size: 31px; font-weight: 400; }
.form-heading p, .form-note { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.login-form label { display: block; margin: 17px 0 7px; font-size: 12px; font-weight: 700; }
.login-form input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  background: white;
  color: var(--ink);
}
.login-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 106, 81, 0.12); }
.button {
  min-height: 42px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { background: var(--green); color: white; }
.button-primary:hover:not(:disabled) { background: var(--green-dark); }
.login-button { width: 100%; margin-top: 22px; justify-content: space-between; }
.form-note { margin-top: 14px; text-align: center; font-size: 11px; }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.button-quiet { min-height: 36px; padding: 0 10px; border-color: transparent; background: transparent; color: var(--muted); }
.message { margin: 12px 0 0; font-size: 12px; line-height: 1.5; }
.error-message { color: var(--red); }

.workspace { padding: 52px 0 36px; animation: rise-in 400ms ease-out both; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.workspace-heading h1 { margin: 9px 0 0; font-size: 42px; }
.workspace-actions { display: flex; align-items: center; gap: 7px; }
.queue-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.queue-title-group { display: flex; align-items: center; gap: 11px; }
.queue-count { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); font-size: 11px; font-weight: 800; }
.queue-message { margin: 0; color: var(--muted); font-size: 12px; }
.work-grid { display: grid; grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1.18fr); gap: 18px; padding-top: 18px; }
.queue-panel, .detail-panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.queue-list { min-height: 300px; }
.queue-empty { padding: 38px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.order-row {
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.order-row:hover { background: #f6f8f0; }
.order-row.is-selected { border-left: 3px solid var(--green); background: var(--soft-green); }
.order-info { min-width: 0; display: grid; gap: 7px; }
.order-number { font-size: 13px; font-weight: 800; }
.order-product, .order-date { color: var(--muted); font-size: 11px; }
.order-date { flex: 0 0 auto; text-align: right; }
.pagination { min-height: 54px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.pagination span { color: var(--muted); font-size: 11px; }
.detail-panel { min-height: 410px; padding: clamp(20px, 3vw, 32px); }
.detail-empty { min-height: 350px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-symbol { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 50%; color: var(--green); font-family: Georgia, serif; font-size: 26px; }
.detail-empty h2 { margin-bottom: 7px; font-family: Georgia, serif; font-size: 23px; font-weight: 400; }
.detail-empty p { color: var(--muted); font-size: 12px; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-heading h2 { margin: 7px 0 0; font-family: Georgia, serif; font-size: 27px; font-weight: 400; }
.paid-label { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; font-weight: 700; }
.paid-label .status-dot { background: var(--green); }
.customer-data { margin: 5px 0 0; }
.data-row { padding: 13px 0; display: grid; grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr); gap: 15px; border-bottom: 1px solid #e8ebe4; }
.data-row dt { color: var(--muted); font-size: 11px; }
.data-row dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }
.detail-expiry { padding: 16px 0; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.detail-expiry strong { color: var(--ink); font-weight: 700; text-align: right; }
.process-button { width: 100%; min-height: 46px; }
.footer { min-height: 60px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .login-layout { min-height: auto; grid-template-columns: 1fr; gap: 22px; padding: 46px 0 38px; }
  .login-intro { padding: 0; }
  .login-intro h1 { margin-top: 14px; font-size: 48px; }
  .intro-copy { margin-bottom: 14px; font-size: 14px; }
  .intro-rule { margin: 18px 0 12px; }
  .login-form { max-width: none; padding: 25px; }
  .workspace { padding-top: 34px; }
  .workspace-heading { align-items: start; flex-direction: column; margin-bottom: 24px; }
  .workspace-heading h1 { font-size: 36px; }
  .work-grid { grid-template-columns: 1fr; }
  .queue-list { min-height: 120px; }
  .detail-panel { min-height: 340px; }
}

@media (max-width: 420px) {
  .topbar { height: 62px; padding: 0 15px; }
  .topbar-meta { gap: 10px; font-size: 10px; }
  .api-status { padding-left: 10px; }
  main { width: calc(100% - 30px); }
  .workspace-actions { width: 100%; }
  .workspace-actions .button-secondary { flex: 1; }
  .queue-toolbar { align-items: start; flex-direction: column; justify-content: center; gap: 5px; padding: 11px 0; }
  .data-row { grid-template-columns: 1fr; gap: 5px; }
  .footer { align-items: start; flex-direction: column; justify-content: center; padding: 12px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}