:root {
  color-scheme: light;
  --paper: #f5f3ed;
  --panel: #fffdf8;
  --ink: #222821;
  --muted: #5e635a;
  --line: #dadbd0;
  --rust: #984429;
  --rust-dark: #79331e;
  --serif: Georgia, "Times New Roman", serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box }
body { margin: 0; min-width: 280px }
button, input, select { font: inherit }
button, select, a { -webkit-tap-highlight-color: transparent }
button { cursor: pointer }
button:disabled { cursor: default; opacity: .45 }
[hidden] { display: none !important }
button, input, select, a { outline-offset: 3px }
:focus-visible { outline: 2px solid var(--rust) }
h1, h2, h3, p { margin: 0 }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0 }
.sr-focus:focus, .skip:focus { position: fixed; top: 10px; left: 10px; z-index: 5; width: auto; height: auto; clip-path: none; background: white; padding: 10px; color: var(--ink) }
.topbar { border-bottom: 1px solid var(--line); background: var(--panel) }
.topbar-inner, .workspace { width: min(1256px, calc(100% - 80px)); margin: 0 auto }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 74px }
.identity { display: flex; align-items: center; gap: 22px }
.identity img { display: block; width: 83px; height: 38px; object-fit: contain }
.identity span { border-left: 1px solid var(--line); padding-left: 21px; color: var(--muted); font-size: 14px }
#loading { padding: 74px 6%; color: var(--muted); text-align: center }
.sign-in { width: min(426px, calc(100% - 32px)); margin: clamp(42px, 11vh, 130px) auto 30px; padding: clamp(24px, 4vw, 42px); background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--rust); border-radius: 3px; box-shadow: 0 9px 32px #23291c08 }
#clerk-sign-in { display: flex; justify-content: center; margin: clamp(32px, 9vh, 110px) auto; padding: 0 12px }
#clerk-sign-in:empty { display: none }
h1 { font: normal clamp(42px, 4.6vw, 66px)/1.05 var(--serif); letter-spacing: -.055em }
.sign-in h1 { font-size: 43px }
.sign-in > p { line-height: 1.55; color: var(--muted); margin: 10px 0 26px }
label, .field-label { font-size: 14px; font-weight: 600 }
input, select { color: var(--ink); background: white; border: 1px solid #b6bbaf; border-radius: 4px; min-width: 0; padding: 10px 11px; min-height: 42px }
select { padding-right: 24px }
input::placeholder { color: #64695d; opacity: 1 }
.primary, .quiet, .pager button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 15px; border: 1px solid #bfc3b7; border-radius: 4px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none }
.primary { background: var(--rust); color: white; border-color: var(--rust); min-height: 45px }
.primary:hover:not(:disabled) { background: var(--rust-dark) }
.quiet:hover:not(:disabled), .pager button:hover:not(:disabled), .icon-button:hover { background: #eeeee6 }
.error { color: #8b251e; font-size: 14px; line-height: 1.45 }
.workspace { padding: clamp(34px, 5vw, 65px) 0 64px }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 30px }
.refresh-icon { font-size: 21px; line-height: .8 }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 5px; background: var(--panel); overflow: hidden; margin-bottom: clamp(28px, 4vw, 50px) }
.metric { display: flex; flex-direction: column; justify-content: space-between; gap: 19px; padding: clamp(16px, 2.3vw, 30px); min-height: 126px }
.metric + .metric { border-left: 1px solid var(--line) }
.metric > span { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; font-weight: 600 }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: #6c7364 }
.dot.waiting { background: #ad592e }
.dot.confirmed { background: #6b6b3c }
.dot.shipped { background: #52727b }
.dot.delivered { background: #47724e }
.metric strong { font-size: clamp(27px, 3vw, 41px); line-height: 1; font-weight: 550; letter-spacing: -.055em; overflow-wrap: anywhere }
.metric.amount { background: #eaf0e6 }
.metric.amount strong { color: #334f39 }
.ledger { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; overflow: hidden }
.ledger-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 22px 24px }
h2 { font: normal 26px/1.15 var(--serif); letter-spacing: -.045em }
#filters { display: flex; align-items: center; gap: 8px }
#filters select, #filters input { font-size: 14px }
.search { position: relative }
.search input { width: 226px; padding-left: 36px }
.search i { position: absolute; top: 13px; left: 13px; width: 13px; height: 13px; border: 1.6px solid var(--muted); border-radius: 50%; pointer-events: none }
.search i::after { content: ""; width: 6px; height: 1.6px; position: absolute; background: var(--muted); transform: rotate(45deg); right: -4px; bottom: -2px }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #f0f0e9; border-block: 1px solid var(--line); padding: 11px 12px }
td { padding: 13px 12px; border-bottom: 1px solid #e5e5dc; overflow-wrap: anywhere }
th:first-child, td:first-child { padding-left: 24px }
th:last-child, td:last-child { padding-right: 24px }
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
td.money { font-weight: 650 }
.reference { font-weight: 650; font-size: 14px; overflow-wrap: anywhere }
.row-date { display: block; color: var(--muted); font-size: 12px; margin-top: 4px }
.status { display: inline-flex; border-radius: 30px; padding: 5px 9px; align-items: center; gap: 6px; font-size: 12px; color: #454b42; background: #ebede8; font-weight: 650; white-space: nowrap }
.status::before { content: ""; border-radius: 50%; width: 6px; height: 6px; background: currentColor }
.status.awaiting_confirmation { color: #804023; background: #f8e6d8 }
.status.confirmed { color: #5b5a28; background: #efefd8 }
.status.shipped { color: #375966; background: #e1edf0 }
.status.delivered { color: #315c43; background: #e2efe3 }
.status.returned { color: #743c4b; background: #f5e5e8 }
.row-action { text-align: right; width: 1% }
.row-action button { min-width: 44px; height: 36px; border: 1px solid transparent; color: var(--rust); border-radius: 3px; background: transparent; font-size: 20px }
.row-action button:hover { border-color: var(--line); background: var(--paper) }
tbody tr:focus-within, tbody tr:hover { background: #f7f6ef }
.empty { text-align: center; padding: 38px 20px 42px; border-bottom: 1px solid var(--line) }
.empty-mark { display: inline-block; width: 25px; height: 29px; border: 2px solid #9b9e90; border-radius: 2px; background: repeating-linear-gradient(to bottom,transparent 0 4px,#b4b7a9 4px 6px,transparent 6px 8px) center/11px 14px no-repeat; margin-bottom: 8px }
.empty h3 { font: normal 24px var(--serif) }
.empty p { font-size: 14px; color: var(--muted); margin: 8px 0 0 }
.empty button { margin-top: 14px }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 24px; color: var(--muted); font-size: 13px }
.pager nav { display: flex; align-items: center; gap: 11px }
.pager button { width: 35px; min-height: 35px; padding: 3px }
.list-error { padding: 8px 24px 16px }
dialog { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(490px,100%); max-width: 100%; height: 100%; max-height: 100dvh; padding: 0 0 25px; color: var(--ink); background: var(--panel); border: 0; box-shadow: -8px 0 30px #20271d22; overflow-y: auto }
dialog::backdrop { background: #20271d70 }
body:has(dialog[open]) { overflow: hidden }
.drawer-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; padding: 17px 24px; border-bottom: 1px solid var(--line); background: var(--panel); gap: 8px }
.drawer-head h2 { font-size: clamp(19px,4vw,25px); overflow-wrap: anywhere }
.icon-button { font-size: 21px; min-width: 40px; padding: 4px; flex-shrink: 0 }
#detail-body, .detail-message { padding: 0 24px }
.detail-meta { display: flex; justify-content: space-between; gap: 9px; color: var(--muted); align-items: center; font-size: 12px; padding: 17px 0 }
.detail-block { border-top: 1px solid var(--line); padding: 20px 0 }
.detail-block h3 { font: normal 23px/1.2 var(--serif); margin-bottom: 13px; letter-spacing: -.035em }
.detail-block p { line-height: 1.55; font-size: 14px; overflow-wrap: anywhere }
.customer { font-weight: 650 }
.address { white-space: pre-line; color: var(--muted) }
.call { display: inline-block; font-size: 14px; color: var(--rust-dark); text-underline-offset: 3px; margin-top: 9px }
.line { padding: 11px 0 }
.line + .line { border-top: 1px dashed var(--line) }
.line-head, .detail-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px }
.line-head strong:first-child { overflow-wrap: anywhere }
.line-options { color: var(--muted) }
.size-field { margin-top: 8px; display: grid; gap: 5px }
.size-field label { color: #75391f; font-size: 13px }
.detail-total { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; font-weight: 650 }
.detail-total strong { font-size: 19px }
#process { display: grid; gap: 10px }
.terminal { color: var(--muted) }
.detail-message { margin-top: 6px; font-size: 14px; color: #315c43 }
.detail-message.error { color: #8b251e }
@media (max-width: 820px) {
  .topbar-inner, .workspace { width: calc(100% - 44px) }
  .metric { min-height: 106px }
  .ledger-tools { align-items: start }
}
@media (max-width: 700px) {
  .topbar-inner, .workspace { width: calc(100% - 32px) }
  .topbar-inner { min-height: 61px }
  .identity { gap: 12px }
  .identity img { width: 67px }
  .identity span { padding-left: 11px; font-size: 12px }
  .quiet { padding: 8px 10px; font-size: 13px }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 26px }
  .metric { min-height: 89px; gap: 13px; padding: 16px }
  .metric:nth-child(3) { border-left: 0 }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line) }
  .metric > span { font-size: 13px }
  .page-heading { margin-bottom: 23px }
  .ledger-tools { padding: 18px 15px 14px; gap: 13px }
  .ledger-tools h2 { font-size: 24px }
  #filters { width: 100%; display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr) }
  .search input, #filters select { width: 100% }
  #orders-table, tbody, tr, td { display: block }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%) }
  tbody tr { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; padding: 15px 15px 15px; border-top: 1px solid var(--line) }
  td, td:first-child, td:last-child { padding: 0; border: 0 }
  td:first-child { grid-column: 1; grid-row: 1 }
  td:nth-child(2), td:nth-child(3) { grid-column: 1; font-size: 13px; color: var(--muted) }
  td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right }
  td.money { grid-column: 2; grid-row: 1; font-size: 14px }
  .row-action { grid-column: 2; grid-row: 3; width: auto; height: 24px }
  .row-action button { height: 44px; min-width: 44px; margin: -7px -5px -13px 0 }
  .pager { border-top: 1px solid var(--line); padding: 10px 15px }
  .empty { border-top: 1px solid var(--line) }
  .list-error { padding-left: 15px }
  .drawer-head { padding: 14px 17px }
  #detail-body, .detail-message { padding-inline: 17px }
}
@media (max-width: 375px) {
  .topbar-inner, .workspace { width: calc(100% - 24px) }
  .page-heading { flex-wrap: wrap }
  .page-heading h1 { font-size: 36px }
  #filters { grid-template-columns: 1fr }
  .metric { padding: 13px }
  .metric > span { gap: 6px }
}
@media (prefers-reduced-motion: no-preference) {
  button, a { transition: background-color 140ms, border-color 140ms }
  dialog[open] { animation: slide-in 170ms ease-out }
  @keyframes slide-in { from { opacity: .5; transform: translateX(12px) } to { opacity: 1; transform: none } }
}
