:root {
  color-scheme: light;
  --ink: #1f2329;
  --muted: #777e87;
  --line: #e9ebee;
  --surface: #fff;
  --canvas: #f6f7f8;
  --blue: #3483fa;
  --blue-dark: #2968c8;
  --green: #00a650;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 360px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1160px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: #202329; text-decoration: none; font: 800 21px Manrope, sans-serif; letter-spacing: -1px; }
.brand-icon { display: grid; place-items: center; width: 27px; height: 27px; color: #fff; background: #ffe600; border-radius: 50%; font: 700 18px 'DM Sans', sans-serif; transform: rotate(-35deg); }
.brand-dot { color: var(--blue); }
.top-actions { display: flex; align-items: center; gap: 22px; }
.today { color: #555b63; font-size: 13px; font-weight: 600; }
.page-shell { width: min(1160px, calc(100% - 48px)); margin: 40px auto 64px; }
.heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font: 800 30px Manrope, sans-serif; letter-spacing: -1.1px; }
.subtitle { margin: 0; color: var(--muted); font-size: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 700; transition: background .15s, border-color .15s; white-space: nowrap; }
.button-primary { color: white; background: var(--blue); }
.button-primary:hover { background: var(--blue-dark); }
.button-dark { color: white; background: #272b30; }
.button-dark:hover { background: #111418; }
.button-dark:disabled { cursor: wait; opacity: .65; }
.button-light { min-height: 36px; color: #343a40; background: white; border-color: var(--line); }
.button-light:hover { background: #f7f8f9; }
.panel { background: var(--surface); border: 1px solid #eceef0; border-radius: 10px; box-shadow: 0 2px 8px rgba(28, 39, 49, .025); }
.accounts-panel { padding: 20px 22px; margin-bottom: 22px; }
.profit-panel { padding: 18px 22px; margin-bottom: 22px; }
.profit-heading h2 { margin: 0 0 6px; font: 700 16px Manrope, sans-serif; }
.profit-heading p { max-width: 900px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.product-cost-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 14px; }
.product-cost-form label { display: grid; gap: 5px; color: #525c6a; font-size: 12px; }
.product-cost-form input { min-height: 38px; width: 180px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
.product-cost-form label:nth-of-type(2) input { width: 135px; }
.product-cost-form label:nth-of-type(3) input { width: 76px; text-transform: uppercase; }
.profit-status { min-height: 16px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.product-cost-list { display: grid; gap: 6px; padding: 0; margin: 8px 0 0; list-style: none; }
.product-cost-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 560px; padding: 7px 10px; background: #f7f9fc; border-radius: 6px; font-size: 12px; }
.remove-product-cost { padding: 4px 8px; color: #555; background: white; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.profit-total { border: 1px solid #cde7da; background: #f2faf5 !important; }
.profit-value { font-weight: 700; white-space: nowrap; }
.chart-track span.is-negative { background: #dc4c4c; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 5px; font: 700 16px Manrope, sans-serif; letter-spacing: -.2px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.count-badge { display: inline-grid; place-items: center; min-width: 24px; height: 23px; padding: 0 8px; color: #5e646c; background: #f0f2f4; border-radius: 20px; font: 700 11px 'DM Sans', sans-serif; }
.accounts-list { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.account-chip { display: inline-flex; align-items: center; gap: 9px; min-height: 34px; padding: 5px 10px; color: #383e46; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-weight: 600; }
.account-avatar { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: #1c73e8; background: #eaf2ff; font-size: 10px; font-weight: 700; }
.remove-account { padding: 1px 3px; color: #999fa6; background: transparent; border: 0; font-size: 16px; line-height: 1; }
.remove-account:hover { color: #d33; }
.muted { margin: 0; color: var(--muted); font-size: 12px; }
.orders-panel { overflow: hidden; }
.orders-heading { padding: 20px 22px; align-items: flex-end; flex-wrap: wrap; }
.filters-panel { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 22px; margin: 0 22px 16px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; }
.filter-field, .filters-panel .dispatch-filter { display: grid; gap: 5px; color: #525c6a; font-size: 12px; }
.filter-field select { min-height: 38px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font-size: 12px; }
.filter-field select:focus-visible { outline: 2px solid #8bb8ff; }
.filters-panel .filter-help { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 11px; }
.visible-summary { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 22px 12px; }
.visible-summary > div { padding: 10px 14px; background: #f7f9fc; border-radius: 6px; font-size: 12px; }
.visible-summary strong { font-size: 16px; }
.money-summary { display: grid; gap: 5px; }
.money-summary strong { font-size: 12px; }
.financial-help { padding: 0 22px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.financial-cell { min-width: 190px; }
.financial-cell span { display: block; margin-bottom: 5px; font-size: 11px; }
.net-value { font-weight: 700; color: var(--ink); }
.sale-menu-button { margin-top: 8px; min-width: 32px; min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font-size: 22px; }
.sale-menu { position: fixed; inset: auto; margin: 0; width: 280px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px #0003; }
.sale-menu > strong, .sale-menu > span { display: block; padding: 0 8px 6px; }
.sale-menu button, .sale-menu a { display: block; width: 100%; padding: 10px 8px; border: 0; border-radius: 5px; background: white; color: var(--ink); text-align: left; text-decoration: none; font-size: 13px; }
.sale-menu button:hover, .sale-menu a:hover { background: #eff6ff; }
.sale-menu small { display: block; color: var(--muted); margin-top: 3px; }
.sale-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.sale-dialog::backdrop { background: #0006; }
.sale-dialog h2 { font-size: 18px; }
.sale-dialog p, .sale-dialog li { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.sale-dialog a { color: var(--blue-dark); }
.sale-dialog label { display: grid; gap: 8px; margin: 14px 0; font-size: 13px; }
.sale-dialog textarea { width: 100%; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.sale-dialog .sale-confirmation { display: flex; align-items: center; }
.sale-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
#sale-status { margin-top: 16px; }
.charts-panel { margin: 0 22px 18px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.charts-panel summary { cursor: pointer; font-size: 13px; font-weight: 700; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-top: 16px; }
.simple-chart h3 { margin: 0 0 12px; font-size: 13px; }
.simple-chart ul { list-style: none; padding: 0; margin: 0; }
.simple-chart li { display: grid; grid-template-columns: 1fr auto; gap: 5px; margin-bottom: 10px; font-size: 11px; }
.simple-chart li > span:first-child { overflow-wrap: anywhere; }
.chart-track { grid-column: 1 / -1; height: 8px; background: #edf1f6; border-radius: 4px; }
.chart-track span { display: block; height: 100%; background: #3483fa; border-radius: 4px; }
.simple-chart p { color: var(--muted); font-size: 12px; }
.list-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.dispatch-filter select { max-width: 100%; min-height: 38px; padding: 0 10px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.dispatch-filter select:focus-visible { outline: 2px solid #8bb8ff; }
.scheduled-date-filter { display: grid; gap: 3px; color: #777e87; font-size: 10px; }
.scheduled-date-filter input { width: 145px; min-height: 38px; padding: 0 8px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.scheduled-date-filter input:focus-visible { outline: 2px solid #8bb8ff; }
.status-pill.is-blocked { color: #725a14; background: #fff8df; }
.status-pill.is-blocked::before { background: #b48a20; }
.search-box { display: flex; align-items: center; gap: 8px; width: 220px; height: 38px; padding: 0 10px; color: #888f98; border: 1px solid var(--line); border-radius: 6px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); font-size: 12px; background: transparent; }
.search-box:focus-within { border-color: #8bb8ff; box-shadow: 0 0 0 2px #eaf2ff; }
.grouped-heading { padding: 12px 22px 18px; }
.grouped-heading h3 { margin: 0 0 6px; font-size: 14px; }
.grouped-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.grouped-quantity { font-weight: 700; font-size: 16px; }
.warning-list { padding: 0 22px 12px; }
.warning-item { padding: 9px 11px; color: #725a14; background: #fff8df; border-radius: 5px; font-size: 12px; }
.warning-item + .warning-item { margin-top: 5px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #fafbfc; }
th { padding: 11px 14px; color: #7d838b; border-top: 1px solid #eff0f2; border-bottom: 1px solid #eff0f2; font-size: 10px; font-weight: 700; letter-spacing: .45px; text-transform: uppercase; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
td { padding: 14px; border-bottom: 1px solid #f0f1f3; vertical-align: top; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.is-checked { background: #fbfdfb; }
tbody tr.is-checked .order-number { color: #8d9690; text-decoration: line-through; }
.check-column { width: 40px; }
.check-cell { width: 40px; }
.order-check { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }
.order-number { display: block; color: #2675db; font-weight: 700; text-decoration: none; white-space: nowrap; }
.account-name { display: block; margin-top: 5px; color: #888f96; font-size: 10px; }
.items-cell { min-width: 255px; max-width: 360px; }
.item-line { margin: 0 0 4px; color: #343a40; line-height: 1.35; }
.item-line:last-child { margin-bottom: 0; }
.sku { color: #999fa6; font-size: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; color: #277a4b; background: #e9f7ef; border-radius: 4px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-pill::before { width: 5px; height: 5px; content: ''; background: #18a058; border-radius: 50%; }
.substatus { display: block; max-width: 130px; margin-top: 5px; color: #858c94; font-size: 10px; }
.buyer-cell { color: #4d545c; }
.date-cell { color: #686f77; white-space: nowrap; }
.empty-state { padding: 45px 18px; color: #838a93; text-align: center; font-size: 13px; }
.empty-filter { padding: 22px; }
.table-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 22px; color: #858b93; background: #fafbfc; border-top: 1px solid #eff0f2; font-size: 10px; }
.table-footer > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 7px; height: 7px; background: #18a058; border-radius: 50%; }
.privacy-note { margin: 15px 2px 0; color: #959ba2; font-size: 10px; }
.notice { margin: -10px 0 20px; padding: 13px 15px; border: 1px solid; border-radius: 7px; font-size: 12px; line-height: 1.5; }
.notice-info { color: #355b83; background: #eff6ff; border-color: #d8e9ff; }
.notice-error { color: #963a34; background: #fff1ef; border-color: #f6d5d1; }
.notice a { color: inherit; font-weight: 700; }
.toast { position: fixed; right: 24px; bottom: 22px; max-width: min(420px, calc(100% - 48px)); padding: 12px 16px; color: #fff; background: #272b30; border-radius: 7px; box-shadow: 0 6px 25px #0002; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.login-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.login-card { width: min(100%, 410px); padding: 34px; background: var(--surface); border: 1px solid #eceef0; border-radius: 12px; box-shadow: 0 10px 35px rgba(28, 39, 49, .06); }
.login-brand { margin-bottom: 38px; }
.login-card h1 { margin-bottom: 7px; font-size: 27px; }
.login-subtitle { margin-bottom: 24px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card form { display: grid; gap: 9px; }
.login-card label { margin-top: 7px; color: #434950; font-size: 12px; font-weight: 700; }
.login-card input { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid #dfe2e6; border-radius: 6px; outline: 0; }
.login-card input:focus { border-color: #8bb8ff; box-shadow: 0 0 0 2px #eaf2ff; }
.login-submit { width: 100%; margin-top: 15px; }
.login-footnote { margin: 23px 0 0; color: #8b929a; font-size: 10px; line-height: 1.5; }
.login-card .notice { margin: 0 0 14px; }
.login-card .notice[hidden] { display: none !important; }

@media (max-width: 760px) { 
  .topbar { height: 60px; padding: 0 18px; }
  .today { display: none; }
  .page-shell { width: calc(100% - 28px); margin-top: 28px; }
  .heading-row { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 25px; }
  .orders-heading { align-items: flex-start; flex-direction: column; }
  .list-actions { width: 100%; }
  .search-box { flex: 1; width: auto; }
  .button-dark { padding: 0 11px; }
  .table-footer { flex-direction: column; }
}

@media print {
  :root { background: white; }
  body { min-width: 0; background: white; }
  .topbar { height: auto; padding: 0 0 16px; border-bottom: 1px solid #aaa; }
  .top-actions, .heading-row .button, .accounts-panel, .profit-panel, .list-actions, .filters-panel, .charts-panel, .privacy-note, .remove-account, .sale-menu-button, .sale-menu, .sale-dialog { display: none !important; }
  .visible-summary { padding: 0 0 12px; }
  .visible-summary > div { background: white; border: 1px solid #ccc; }
  .financial-help { padding: 0; }
  .page-shell { width: 100%; margin: 18px auto; }
  .heading-row { margin-bottom: 14px; }
  h1 { font-size: 21px; }
  .panel { border: 0; box-shadow: none; }
  .orders-heading { padding: 8px 0 12px; }
  th, td { padding: 7px 6px; font-size: 9px; }
  th:first-child, td:first-child { padding-left: 0; }
  th:last-child, td:last-child { padding-right: 0; }
  .table-footer { padding: 10px 0; }
  .status-pill { padding: 3px 5px; color: #222; background: white; border: 1px solid #aaa; }
  .status-pill::before, .status-dot { display: none; }
  .warning-item { border: 1px solid #ccc; }
  @page { margin: 14mm; }
}
