:root {
  --ink: #1f2933;
  --muted: #65717d;
  --line: #d9dee3;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --soft: #eef2ef;
  --accent: #296b46;
  --accent-strong: #185735;
  --accent-soft: #e6f2ea;
  --amber: #9a6500;
  --amber-soft: #fff3d4;
  --danger: #a3322a;
  --danger-soft: #fff0ee;
  --blue: #285f8f;
  --blue-soft: #eaf2f9;
  --focus: #f0aa22;
  --shadow: 0 12px 28px rgba(31,41,51,.08);
  --radius: 14px;
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, input[type="date"] { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; color: #fff; background: var(--accent); font-weight: 900; letter-spacing: -.04em; }
.brand-mark--small { width: 38px; height: 38px; border-radius: 10px; font-size: 14px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: linear-gradient(120deg,#edf1ec 0 55%,#e5ebe6 55%); }
.login-panel { width: min(520px,100%); padding: 38px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.login-panel h1 { margin: 18px 0 10px; font-size: clamp(28px,5vw,40px); line-height: 1.08; letter-spacing: -.035em; }
.login-copy { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.demo-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid #ead89e; border-radius: 10px; background: var(--amber-soft); color: #6b4a0c; font-size: 13px; }
.demo-notice span { text-align: right; }
.demo-users { display: grid; gap: 10px; }
.user-choice { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; transition: border-color .15s,background .15s,transform .15s; }
.user-choice:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.user-choice__name { font-weight: 800; }
.user-choice__meta { color: var(--muted); font-size: 12px; text-align: right; }
.login-footnote { margin: 16px 0 0; color: var(--muted); font-size: 12px; }

.portal { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 24px; padding: 10px clamp(16px,3vw,42px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
.topbar__identity, .account { display: flex; align-items: center; gap: 12px; }
.topbar__identity strong { font-size: 18px; }
.demo-chip { padding: 4px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.account__text { display: grid; text-align: right; font-size: 13px; }
.account__text span { color: var(--muted); font-size: 11px; }
.workspace { width: min(1540px,100%); margin: 0 auto; padding: 24px clamp(14px,2.8vw,40px) 30px; }
.context-strip { display: grid; grid-template-columns: 1.3fr 1.3fr .7fr 1fr; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.context-strip div { display: grid; gap: 3px; min-width: 0; padding: 13px 16px; border-right: 1px solid var(--line); }
.context-strip div:last-child { border-right: 0; }
.context-strip span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.context-strip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.columns { display: grid; grid-template-columns: minmax(460px,.92fr) minmax(580px,1.08fr); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 14px rgba(31,41,51,.045); }
.list-panel { min-height: 690px; }
.form-panel { position: sticky; top: 86px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px 16px; }
.panel-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.panel-heading--form { border-bottom: 1px solid var(--line); }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; background: transparent; font-weight: 800; font-size: 13px; transition: background .15s,border-color .15s,transform .1s; }
.button:active { transform: translateY(1px); }
.button--primary { color: #fff; background: var(--accent); }
.button--primary:hover { background: var(--accent-strong); }
.button--primary:disabled { color: #b9c9bf; background: #e4eae6; }
.button--ghost { border-color: var(--line); background: #fff; }
.button--ghost:hover { border-color: #a9b4ac; background: var(--soft); }
.button--compact { min-height: 40px; padding: 7px 12px; }
.button--text { padding-inline: 4px; color: var(--muted); }
.button--submit { min-width: 184px; }
.filters { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto; gap: 9px; padding: 14px 22px; border-block: 1px solid var(--line); background: #fafbfa; }
label { display: grid; gap: 5px; min-width: 0; }
label > span { color: #4f5b65; font-size: 11px; font-weight: 800; }
label b { color: var(--danger); }
input, select, textarea { width: 100%; border: 1px solid #cbd2d8; border-radius: 8px; background: #fff; }
input, select { min-height: 44px; padding: 9px 10px; }
textarea { min-height: 68px; padding: 10px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #9da9b2; }
input:disabled, select:disabled, textarea:disabled, fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { color: #49535b; opacity: 1; background: #f0f2f1; border-color: #d9dedd; }
.list-meta { min-height: 38px; padding: 11px 22px 5px; color: var(--muted); font-size: 12px; }
.requests-list { display: grid; gap: 8px; padding: 8px 14px 18px; }
.request-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; width: 100%; min-height: 76px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; }
.request-card:hover { border-color: #aeb8b1; background: #fbfcfb; }
.request-card.is-selected { border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.request-date { min-width: 64px; color: var(--muted); font-size: 12px; }
.request-date strong { display: block; color: var(--ink); font-size: 22px; line-height: 1; }
.request-body { min-width: 0; }
.request-body strong { display: block; margin-bottom: 4px; }
.request-body p { overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.request-aside { display: grid; justify-items: end; gap: 6px; }
.base-badge, .status { display: inline-flex; align-items: center; width: max-content; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.base-badge--b1 { color: #7a5000; background: var(--amber-soft); }
.base-badge--b2 { color: var(--accent-strong); background: var(--accent-soft); }
.base-badge--b3 { color: var(--blue); background: var(--blue-soft); }
.status--sent { color: var(--accent-strong); background: var(--accent-soft); }
.status--draft { color: #675419; background: #f5efd8; }
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 70px 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }

#request-form { padding: 20px 22px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.form-grid small { margin-left: auto; color: var(--muted); font-size: 10px; }
.line-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 24px 0 10px; }
.line-heading h3, .split-preview h3 { margin: 0; font-size: 15px; }
.line-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.line-labels, .order-line { display: grid; grid-template-columns: minmax(220px,1fr) 104px 78px 44px; gap: 8px; }
.line-labels { padding: 0 4px 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.order-lines { display: grid; gap: 8px; }
.order-line { position: relative; padding-bottom: 22px; }
.order-line .mobile-label { display: none; }
.remove-line { width: 44px; height: 44px; border: 1px solid #e2c7c3; border-radius: 8px; color: var(--danger); background: #fff; font-size: 22px; line-height: 1; }
.remove-line:hover { background: var(--danger-soft); }
.line-base { position: absolute; bottom: 0; left: 4px; }
.availability { color: var(--muted); font-size: 10px; }
.split-preview { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.split-preview__heading { display: flex; justify-content: space-between; gap: 10px; }
.split-preview__heading span { color: var(--muted); font-size: 11px; }
.split-groups { display: grid; gap: 7px; margin-top: 10px; }
.split-group { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 10px; border-radius: 7px; background: #fff; font-size: 12px; }
.split-group span:last-child { color: var(--muted); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.alert { margin: 16px 22px 0; padding: 11px 13px; border: 1px solid #e6bdb8; border-radius: 8px; color: var(--danger); background: var(--danger-soft); font-size: 13px; }
.receipt { margin: 16px 22px 0; padding: 14px; border: 1px solid #b8d7c1; border-radius: 10px; background: var(--accent-soft); }
.receipt h3 { margin: 0 0 8px; color: var(--accent-strong); font-size: 15px; }
.receipt ul { margin: 0; padding-left: 20px; font-size: 12px; }
.locked-note { margin-top: 8px; color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.mobile-tabs { display: none; }
.footer-note { padding: 3px 18px 24px; color: var(--muted); font-size: 11px; text-align: center; }

.modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(20,28,24,.58); }
.modal__card { position: relative; width: min(500px,100%); padding: 26px; border-radius: 15px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.modal__card h2 { margin: 4px 0 10px; }
.confirm-groups { display: grid; gap: 7px; margin: 16px 0; }
.lock-warning { padding: 10px; border-radius: 8px; color: #6b4a0c; background: var(--amber-soft); font-size: 12px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
body.modal-open { overflow: hidden; }

@media (max-width: 1050px) {
  .columns { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .list-panel { min-height: auto; }
  .context-strip { grid-template-columns: 1fr 1fr; }
  .context-strip div:nth-child(2) { border-right: 0; }
  .context-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 700px) {
  .topbar { align-items: flex-start; padding: 10px 14px; }
  .account__text { max-width: 145px; }
  .account__text span { display: none; }
  .workspace { padding: 12px 10px 24px; }
  .context-strip { grid-template-columns: 1fr 1fr; }
  .context-strip div { padding: 10px; }
  .context-strip div:nth-child(odd) { border-right: 1px solid var(--line); }
  .context-strip div:nth-child(even) { border-right: 0; }
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 10px; padding: 4px; border-radius: 10px; background: #dfe5e0; }
  .mobile-tabs button { border: 0; border-radius: 7px; background: transparent; font-weight: 800; }
  .mobile-tabs button.is-active { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
  .columns { display: block; }
  .columns .panel { display: none; }
  .columns[data-active-tab="list"] #list-panel, .columns[data-active-tab="form"] #form-panel { display: block; }
  .panel-heading { padding: 16px 14px 12px; }
  .panel-heading h2 { font-size: 20px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 12px 14px; }
  .filters label:nth-child(3) { grid-column: 1 / -1; }
  .requests-list { padding-inline: 8px; }
  .request-card { grid-template-columns: auto 1fr; }
  .request-aside { grid-column: 2; grid-template-columns: auto auto; justify-content: start; }
  #request-form { padding: 16px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .line-heading { align-items: flex-start; }
  .line-heading p { max-width: 200px; }
  .line-labels { display: none; }
  .order-line { grid-template-columns: minmax(0,1fr) 92px 44px; padding: 12px 10px 36px; border: 1px solid var(--line); border-radius: 9px; }
  .order-line .line-product { grid-column: 1 / -1; }
  .order-line .mobile-label { display: block; }
  .line-base { left: 12px; bottom: 10px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .button--submit { width: 100%; }
  .demo-notice, .user-choice { align-items: flex-start; flex-direction: column; }
  .demo-notice span, .user-choice__meta { text-align: left; }
  .login-panel { padding: 26px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
