:root {
  color-scheme: light;
  --purple: #7461a8;
  --purple-dark: #5d4b91;
  --ink: #243047;
  --muted: #788398;
  --line: #dce1e9;
  --bg: #f7f8fa;
  --card: #fff;
  --ok: #16805b;
  --warning: #9b6800;
  --danger: #b13d4b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 54px; padding: 0 24px; display: flex; align-items: center; gap: 26px; color: #fff; background: var(--purple); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.brand-mark { font-size: 24px; line-height: 1; }
nav { display: flex; align-self: stretch; gap: 22px; align-items: center; }
nav a { color: #f5f2ff; text-decoration: none; opacity: .9; padding: 18px 0 16px; border-bottom: 2px solid transparent; }
nav a:hover, nav a.active { opacity: 1; border-bottom-color: #fff; }
.topbar-status { margin-left: auto; font-size: 12px; opacity: .9; white-space: nowrap; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: #7de0ba; margin-right: 6px; }
.page-shell { max-width: 1480px; margin: 0 auto; padding: 30px 28px 70px; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { color: var(--purple); font-size: 11px; letter-spacing: .1em; font-weight: 800; margin: 0 0 7px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.02em; }
h2 { margin-bottom: 4px; font-size: 18px; }
h3 { margin-bottom: 3px; font-size: 15px; }
.muted { color: var(--muted); }
.heading-actions, .modal-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.auth-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 24px; align-items: end; margin-bottom: 18px; padding: 20px; border: 1px solid #cfc6e8; border-radius: 7px; background: #fbfaff; box-shadow: 0 4px 18px #25324c0b; }
.auth-panel[hidden] { display: none; }
.auth-panel .eyebrow { margin-bottom: 5px; }
.auth-panel h2 { margin-bottom: 5px; }
.auth-form { display: flex; align-items: end; gap: 9px; }
.auth-form label { flex: 1; }
.auth-form .btn { flex: 0 0 auto; }
.auth-panel > .notice { grid-column: 1 / -1; margin: 0; }
.btn { min-height: 38px; border: 1px solid transparent; border-radius: 5px; padding: 0 15px; font-weight: 700; transition: background .15s, box-shadow .15s, transform .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.btn-primary { color: #fff; background: var(--purple); box-shadow: 0 2px 5px #53477b2b; }
.btn-primary:hover:not(:disabled) { background: var(--purple-dark); }
.btn-secondary { color: var(--ink); border-color: #cfd5df; background: #fff; }
.btn-secondary:hover:not(:disabled) { background: #f0eff6; border-color: var(--purple); }
.notice { margin: 0 0 18px; padding: 11px 14px; border-radius: 5px; border: 1px solid; line-height: 1.45; }
.notice-info { color: #315a85; background: #eff6ff; border-color: #c6ddf7; }
.notice-error { color: #8e2937; background: #fff1f3; border-color: #f0c5cb; }
.notice-success { color: #126b4c; background: #ecfaf4; border-color: #bce8d5; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card, .card { background: var(--card); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 4px 18px #25324c0b; }
.summary-card { min-height: 110px; padding: 17px 18px; }
.summary-card span, .summary-card small { color: var(--muted); display: block; }
.summary-card strong { display: block; margin: 8px 0 3px; font-size: 25px; }
.summary-card strong.ok { color: var(--ok); font-size: 18px; margin-top: 14px; }
.table-card { overflow: hidden; }
.card-toolbar { padding: 18px 20px 15px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 1px solid var(--line); }
.search-box { min-width: min(330px, 100%); color: var(--muted); display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); background: #fff; border-radius: 4px; }
.search-box input { min-height: 38px; width: 100%; border: 0; outline: 0; color: var(--ink); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 930px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e8ebf0; text-align: left; vertical-align: middle; }
th { background: #fafbfc; color: #6b7587; font-size: 11px; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
tbody tr:hover { background: #fbfaff; }
.empty-state { padding: 50px; text-align: center; color: var(--muted); }
.receipt-id { color: var(--purple-dark); font-weight: 800; }
.source-label { color: var(--muted); font-size: 12px; margin-top: 3px; }
.status-badge, .badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 9px; background: #edf0f4; color: #526075; font-size: 12px; white-space: nowrap; }
.status-badge.review { color: #866000; background: #fff3d6; }
.status-badge.ready { color: #315b8d; background: #e8f1ff; }
.status-badge.created { color: #126b4c; background: #e6f8f0; }
.status-badge.error { color: #9a2d3d; background: #ffebee; }
.row-action { color: var(--purple-dark); background: transparent; border: 0; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.modal { border: 0; padding: 0; background: transparent; max-width: min(660px, calc(100% - 24px)); width: 100%; }
.modal-wide { max-width: min(1180px, calc(100% - 24px)); }
.modal::backdrop { background: #18203680; backdrop-filter: blur(2px); }
.modal-card { max-height: min(90vh, 900px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 16px 60px #1c27424d; }
.action-confirm { position: fixed; z-index: 3000; inset: 0; display: grid; place-items: center; padding: 24px; background: #18203680; backdrop-filter: blur(2px); }
.action-confirm[hidden] { display: none; }
.confirm-card { position: relative; width: min(520px, 100%); padding: 26px; border: 1px solid #cfc6e8; border-radius: 8px; background: #fff; box-shadow: 0 16px 60px #1c27424d; }
.confirm-card h2 { margin-bottom: 10px; padding-right: 35px; }
.confirm-close { position: absolute; top: 18px; right: 18px; }
.confirm-message { margin-bottom: 13px; line-height: 1.55; }
.confirm-warning { margin: 0 0 18px; padding: 11px 13px; border: 1px solid #ead49d; border-radius: 5px; color: #735100; background: #fff8e5; line-height: 1.45; }
.confirm-actions { justify-content: flex-end; padding-top: 5px; }
.modal-heading { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.icon-button { width: 33px; height: 33px; border: 0; border-radius: 4px; color: #677387; background: #f0f2f5; font-size: 23px; line-height: 1; }
.icon-button:hover { color: var(--purple-dark); background: #e8e5f2; }
.drop-zone { min-height: 190px; border: 1px dashed #aaa2c8; border-radius: 7px; color: var(--purple-dark); background: #fbfaff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; cursor: pointer; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { font-size: 28px; }
.form-row, .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
label { display: block; color: #536075; font-size: 12px; font-weight: 700; }
label > input, label > select, .autocomplete-field > input { display: block; width: 100%; min-height: 39px; margin-top: 6px; padding: 0 10px; border: 1px solid #ccd3de; border-radius: 4px; color: var(--ink); background: #fff; outline-color: var(--purple); font-weight: 400; }
.field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 400; }
.detail-grid { margin-top: 0; }
.lines-section { border-top: 1px solid var(--line); padding-top: 17px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.lines-scroll table { min-width: 930px; }
.lines-scroll input { min-width: 275px; padding: 8px 9px; border: 1px solid #ccd3de; border-radius: 4px; }
.product-cell { position: relative; }
.autocomplete-field { position: relative; }
.suggestions { position: fixed; z-index: 2000; box-sizing: border-box; max-height: 280px; overflow: auto; background: #fff; border: 1px solid #c8c3da; border-radius: 4px; box-shadow: 0 8px 25px #2d24421f; }
.suggestions.is-upward { box-shadow: 0 -8px 25px #2d24421f; }
.suggestions button { display: block; width: 100%; padding: 9px 10px; border: 0; border-bottom: 1px solid #eef0f4; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.suggestions button:hover, .suggestions button:focus-visible { background: #f3f0fa; outline: none; }
.suggestions .suggestion-create { color: var(--purple-dark); font-weight: 700; }
.suggestions .autocomplete-message { margin: 0; padding: 9px 10px; }
.match-ok { color: var(--ok); font-size: 12px; font-weight: 700; }
.match-pending { color: var(--warning); font-size: 12px; font-weight: 700; }
.number { text-align: right; }
.detail-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.original-link { color: var(--purple-dark); font-size: 12px; font-weight: 700; margin-left: 9px; }
@media (max-width: 850px) { .topbar { padding: 0 14px; gap: 14px; overflow-x: auto; } nav { gap: 13px; } nav a { font-size: 12px; } .topbar-status { display: none; } .page-shell { padding: 22px 14px 50px; } .page-heading, .card-toolbar, .detail-footer { align-items: stretch; flex-direction: column; } .auth-panel { grid-template-columns: 1fr; gap: 13px; } .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .search-box { min-width: 0; } .form-row, .detail-grid { grid-template-columns: 1fr; } .modal-card, .confirm-card { padding: 18px; } }
@media (max-width: 480px) { .summary-grid { gap: 8px; } .summary-card { padding: 12px; min-height: 98px; } .summary-card strong { font-size: 21px; } }
