:root {
  color-scheme: light;
  --canvas: #fff;
  --surface: #fff;
  --ink: #19191b;
  --muted: #68686e;
  --line: #dedfe1;
  --soft: #f3f4f4;
  --control-radius: 8px;
  --panel-radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--canvas); color: var(--ink); font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; -webkit-font-smoothing: antialiased; }
header { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar { width: 100%; max-width: 1600px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px clamp(20px,3vw,48px); min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: block; width: 46px; height: 46px; object-fit: contain; flex: 0 0 46px; }
.brand-copy { display: grid; gap: 3px; min-width: 0; }
.brand-copy strong { font-size: 16px; font-weight: 650; line-height: 1.25; }
.brand-copy small { color: var(--muted); font-size: 12px; }
#logout { border-radius: 999px; white-space: nowrap; }
.icon-button, #new, #edit-order, #close, #settings-close, .inline-edit, .row-menu-trigger { display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; line-height: 1; border-radius: 50%; }
.icon-button { width: 42px; height: 42px; min-height: 42px; background: var(--soft); border: 1px solid transparent; }
.icon-button:hover { background: #e8e9eb; }
main { width: 100%; max-width: 1600px; margin: 0 auto; padding: 28px clamp(20px,3vw,48px); flex: 1; }
h1,h2 { margin: 0; font-weight: 650; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 25px; }
h2 { font-size: 21px; }
p { margin: 8px 0; color: var(--muted); }
button,input,select,textarea { font: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); padding: 8px 14px; font-weight: 600; min-height: 38px; transition: background .15s,border-color .15s; }
button > svg { display: block; flex-shrink: 0; }
button:hover { background: var(--soft); }
button:disabled { opacity: .5; cursor: wait; }
.primary { background: var(--ink); color: white; border-color: var(--ink); }
.primary:hover { background: #38383b; border-color: #38383b; }
:focus-visible { outline: 2px solid #555; outline-offset: 3px; }
input,select,textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px; border: 1px solid #d2d3d6; border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font-weight: 400; line-height: 1.45; transition: border-color .15s,box-shadow .15s; }
select { appearance: none; -webkit-appearance: none; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23585860' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; cursor: pointer; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
@media(forced-colors:active) { select { appearance: auto; background-image: none; } }
input::placeholder,textarea::placeholder { color: #76767d; font-weight: 400; }
input:focus,select:focus,textarea:focus { outline: none; border-color: #94949b; box-shadow: 0 0 0 1px #94949b; }
textarea { resize: vertical; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 550; margin: 12px 0; }
.heading,.toolbar,.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#dashboard > .heading { margin-bottom: 16px; }
#new { width: 48px; height: 48px; min-height: 48px; }
.new-control { position: relative; }
.new-menu { display: flex; flex-direction: column; gap: 3px; position: absolute; top: calc(100% + 6px); right: 0; z-index: 10; width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 5px 18px #00000016; }
.new-menu button { width: 100%; font-size: 14px; justify-content: flex-start; border: 0; text-align: left; white-space: nowrap; }
nav { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-top: 12px; }
nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); min-height: 42px; padding: 8px 2px; font-size: 14px; }
nav button:hover { background: transparent; color: var(--ink); }
nav button[aria-pressed=true] { color: var(--ink); border-bottom-color: var(--ink); }
.toolbar { margin: 16px 0; justify-content: flex-start; }
.toolbar input { flex: 1; max-width: 440px; min-height: 40px; border-radius: 999px; padding: 8px 16px; }
#refresh { min-height: 40px; margin-left: auto; border-radius: 999px; padding-inline: 16px; }
#login { width: min(100%,420px); margin: clamp(30px,9vh,100px) auto 0; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--panel-radius); }
#login h1 { font-size: 28px; }
#login form { margin-top: 25px; }
#login button { width: 100%; margin-top: 8px; min-height: 45px; }
#orders { overflow-x: auto; }
.order-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.sort-heading { display: inline; border: 0; background: transparent; min-height: 0; padding: 0; font: inherit; color: inherit; white-space: nowrap; }
.sort-heading:hover { background: transparent; text-decoration: underline; }
.order-table th { padding: 11px 14px; background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #424348; font-size: 12px; font-weight: 650; white-space: nowrap; }
.order-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.order-table tr { cursor: pointer; }
.order-table thead tr { cursor: default; }
.order-table tbody tr:hover { background: #fafafa; }
.order-table strong { font-weight: 600; }
.order-table small { display: block; margin-top: 3px; }
.muted { color: var(--muted); font-size: 12px; }
.order-link { border: 0; padding: 0; min-height: 28px; color: var(--ink); font-variant-numeric: tabular-nums; text-decoration: underline; text-underline-offset: 3px; background: transparent; white-space: nowrap; }
.tag { display: inline-block; padding: 4px 9px; border-radius: 6px; background: #efeff1; color: #505056; font-size: 12px; font-weight: 550; white-space: nowrap; }
.tag-done { background: #e3e3e5; color: #222; }
.tag-green { background: #e3f4e8; color: #176137; }
.tag-blue { background: #e3efff; color: #174e9b; }
.tag-red { background: #fce7e7; color: #a32121; }
.order-type { border-radius: 999px; }
.type-work { background: #242424; color: #fff; }
.type-string { background: #ffead6; color: #9a420d; }
.type-product { background: #e9e3f8; color: #59418a; }
.empty { min-height: 170px; display: grid; place-content: center; padding: 32px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); }
dialog { width: min(840px,calc(100% - 32px)); max-height: 92dvh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--panel-radius); color: var(--ink); box-shadow: 0 12px 40px #00000026; }
#editor { width: min(1160px,calc(100% - 40px)); }
dialog:focus { outline: none; }
#order-form { padding: 22px 26px 0; }
#fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,340px); gap: 24px; align-items: start; }
.editor-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 16px; align-items: start; min-width: 0; }
.editor-sidebar { display: grid; gap: 18px; padding: 0 0 0 24px; border-left: 1px solid var(--line); min-width: 0; align-self: stretch; align-content: start; }
.editor-sidebar .choice-options { flex-direction: column; }
.editor-sidebar .choice-option { flex: none; }
#fields label { margin: 0; }
.editor-title-group { min-width: 0; }
#editor-created { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.editor-heading-actions { display: flex; align-items: center; gap: 8px; }
#edit-order, #close, #settings-close { width: 36px; height: 36px; min-height: 36px; }
#close, #settings-close { border: 0; }
.summary-field { min-width: 0; padding: 5px 0 12px; }
.email-summary { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.email-summary small { display: inline; margin: 0; font-size: 12px; white-space: nowrap; }
.vendor-email-detail { grid-column: 1 / -1; }
.summary-label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.summary-value { font-size: 15px; font-weight: 550; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-details .summary-field.field-customer_name .summary-value { font-size: 19px; font-weight: 650; }
.choice-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-field legend { padding: 0; margin-bottom: 7px; font-size: 13px; font-weight: 600; }
.choice-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.choice-current { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.payment-summary-amount { font-size: 15px; font-weight: 600; }
.purchase-section { display: grid; gap: 10px; min-width: 0; }
.purchase-summary { display: grid; gap: 6px; }
.purchase-heading { font-size: 13px; font-weight: 600; }
.purchase-current { display: grid; gap: 3px; }
.purchase-current strong { font-size: 15px; font-weight: 600; }
.purchase-current small { font-size: 12px; color: var(--muted); }
.inline-edit { width: 28px; height: 28px; min-height: 28px; border: 0; background: transparent; color: var(--muted); }
.choice-summary + .choice-options:not([hidden]) { margin-top: 10px; }
.choice-options { display: flex; gap: 6px; flex-wrap: wrap; }
.choice-option { position: relative; flex: 1 1 90px; min-width: 0; cursor: pointer; }
.choice-option input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.choice-option span { display: flex; min-height: 46px; padding: 8px 12px; align-items: center; justify-content: center; text-align: center; border: 1px solid #d2d3d6; border-radius: var(--control-radius); background: var(--surface); color: var(--muted); font-weight: 550; line-height: 1.3; }
.choice-option:hover span { border-color: #aaa; }
.choice-option input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.choice-option input:focus-visible + span { outline: 2px solid #777; outline-offset: 3px; }
#fields .field-product_description, #fields .field-work_requested, #fields .field-notes, #fields .field-order_notes, #fields .editor-details > p { grid-column: 1 / -1; }
#fields .field-status, #fields .field-vendor_id, #fields textarea { min-height: 56px; }
#fields .field-product_description textarea { min-height: 368px; }
#fields .field-work_requested textarea { min-height: 300px; }
#fields .field-notes textarea { min-height: 200px; }
#fields .field-set_type { grid-column: 1 / -1; }
.field-set_type .choice-options { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; align-items: start; }
.field-set_type .choice-option input { position: static; opacity: 1; width: 16px; height: 16px; min-height: 0; margin: 0; flex: 0 0 16px; accent-color: var(--ink); box-shadow: none; }
.field-set_type .choice-option { display: flex; align-items: center; gap: 7px; }
#fields .field-set_type .choice-option span { display: inline; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.order-note-section { grid-column: 1 / -1; min-width: 0; display: grid; gap: 12px; }
.order-note-section h3 { margin: 0; font-size: 14px; font-weight: 650; }
.note-entry { display: grid; gap: 4px; }
.note-entry-header { display:flex; align-items:center; gap:8px; }
.note-entry-header .inline-edit { opacity:.55; }
.note-entry:hover .inline-edit,.note-entry-header .inline-edit:focus-visible { opacity:1; }
.note-edit-actions { display:flex; justify-content:flex-end; gap:8px; }
.note-entry small { color: var(--muted); font-size: 12px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.order-note-section .field-note_to_add { margin-top: 4px; }
.order-note-section > p { margin: 0; }
#fields input:not([type=radio]), #fields select { min-height: 38px; padding-block: 8px; }
#fields .choice-option span { min-height: 38px; }
.field-paid input[value=true]:checked + span, .field-status input[value=ordered]:checked + span { background: #e3f4e8; border-color: #b7dfc3; color: #176137; }
.field-paid input[value=false]:checked + span { background: #fce7e7; border-color: #efbcbc; color: #a32121; }
.field-status input[value=ready]:checked + span { background: #e3efff; border-color: #b7d2fa; color: #174e9b; }
.status-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#fields .editor-details > p { margin: 0; }
#fields input, #fields select, #fields textarea { font-size: 14px; }
#order-form .actions { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0 14px; margin-top: 12px; }
#order-form .actions button { border-radius: 999px; padding-inline: 18px; }
#order-form .actions #cancel { margin-left: auto; }
#order-form .actions #delete-order { border: 0; background: transparent; color: #a32121; padding-inline: 0; font-size: 13px; font-weight: 500; text-align: left; }
#order-form .actions #delete-order:hover { color: #791818; text-decoration: underline; }
.row-controls { display: flex; align-items: center; justify-content: flex-end; }
.row-menu-trigger { border: 0; background: transparent; min-height: 34px; height: 34px; width: 34px; }
.row-action-menu { position: fixed; z-index: 30; min-width: 160px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 5px 18px #00000016; }
.row-action-menu button { display: flex; width: 100%; justify-content: flex-start; border: 0; text-align: left; white-space: nowrap; font-size: 13px; }
.order-table td:last-child { width: 1%; white-space: nowrap; }
.settings-content { padding: 26px 30px; }
.settings-content h3 { font-size: 16px; margin: 18px 0 4px; }
.vendor-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.vendor-details { min-width: 0; overflow-wrap: anywhere; }
.vendor-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 3px; }
#vendor-add { margin-top: 16px; border-radius: 999px; }
#purchasing-form { margin-top: 24px; padding-top: 10px; border-top: 1px solid var(--line); }
#purchasing-save { border-radius: 999px; }
#vendor-form .actions button { border-radius: 999px; padding-inline: 18px; }
.vendor-row small { display: block; }
.vendor-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.vendor-actions button { font-size: 12px; min-height: 34px; }
.vendor-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.vendor-fields label { margin: 5px 0; }
.vendor-notes { grid-column: 1 / -1; }
#settings-message:empty { display: none; }
dialog::backdrop { background: #15151966; }
dialog .heading { padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.actions { justify-content: flex-end; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
#message,#form-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
#message:empty,#form-message:empty { display: none; }
main:has(#login:not([hidden])) #message { max-width: 420px; margin: 14px auto; text-align: center; }
footer { padding: 18px 28px; color: var(--muted); text-align: center; font-size: 11px; }
@media(max-width: 820px) {
 .field-set_type .choice-options { grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 12px; }
 #editor { width: calc(100% - 20px); }
 #fields { grid-template-columns: minmax(0,1fr); }
 .editor-sidebar { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
 .editor-sidebar .choice-options { flex-direction: row; }
 .editor-sidebar .choice-option { flex: 1 1 90px; }
}
@media(max-width: 600px) {
 .topbar { min-height: 66px; padding: 10px 16px; gap: 10px; }
 .brand { gap: 10px; }
 .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
 .brand-copy strong { font-size: 14px; }
 #logout { padding: 8px 12px; font-size: 12px; }
 main { padding: 25px 16px; }
 h1 { font-size: 24px; }
 #new { width: 44px; height: 44px; min-height: 44px; }
 nav { gap: 5px; width: 100%; margin-top: 20px; overflow-x: auto; }
 nav button { flex: 1 0 auto; padding: 7px 5px; font-size: 12px; }
 .toolbar { margin: 16px 0 12px; }
 .order-table, .order-table tbody { display: block; }
 .order-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
 .order-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-bottom: 1px solid var(--line); padding: 16px 0; }
 .order-table td { display: block; border: 0; padding: 0; min-width: 0; }
 .order-table td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
 .order-table td:first-child { grid-column: 1 / -1; }
 .order-table td:last-child { justify-self: end; width: auto; }
 .toolbar input { min-height: 38px; padding: 8px 14px; }
 #login { padding: 25px; }
 dialog { width: calc(100% - 20px); max-height: 94dvh; }
 #order-form { padding: 18px 18px 0; }
 .settings-content { padding: 18px; }
 .vendor-fields { grid-template-columns: 1fr; }
 #order-form .actions { flex-wrap: wrap; padding-bottom: 15px; }
 #order-form .actions button { padding-inline: 12px; }
 #fields { gap: 12px; }
 .editor-details { grid-template-columns: minmax(0,1fr); gap: 12px; }
}
@media(prefers-reduced-motion:reduce) { * { transition: none; } }
