:root {
  color-scheme: light;
  --bg: #f8f6f3;
  --side: #f0ece8;
  --paper: #fffdfa;
  --ink: #282222;
  --muted: #6e6665;
  --faint: #817674;
  --line: #e7e0da;
  --line-soft: #eee7e1;
  --accent: #69374e;
  --accent-deep: #52283d;
  --accent-soft: #efe4e9;
  --late: #a1443d;
  --radius: 13px;
  --shadow: 0 12px 38px #39212a14, 0 1px 4px #39212a0b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .55; cursor: wait; }
a { color: var(--accent); }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
svg { flex-shrink: 0; vertical-align: middle; }
[hidden] { display: none !important; }
::selection { color: var(--accent-deep); background: var(--accent-soft); }

.layout { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; align-self: start; overflow: auto; padding: 32px 16px 15px; background: var(--side); border-right: 1px solid #e5ddd7; }
.brand { display: flex; flex-direction: column; align-items: flex-start; align-self: flex-start; margin: 0 0 43px 13px; }
.wordmark { font-family: Georgia, "Times New Roman", serif; font-size: 46px; font-style: italic; font-weight: 400; line-height: .97; letter-spacing: -.085em; color: var(--accent-deep); white-space: nowrap; }
.wordmark span { margin-left: .03em; }
.wordmark-caption { margin-top: 11px; padding-left: 2px; color: #74636a; font-size: 9px; font-weight: 650; letter-spacing: .19em; }
.side-group + .side-group { margin-top: 31px; }
.side-label { display: flex; align-items: center; justify-content: space-between; min-height: 23px; margin: 0 8px 7px 12px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.side-label .icon-button { width: 25px; height: 25px; }
.side-label svg { width: 15px; height: 15px; }
.side-group nav { display: grid; gap: 3px; }
.nav-link { min-width: 0; height: 41px; border-radius: 8px; padding: 0 11px; display: flex; gap: 10px; align-items: center; color: #51494a; text-align: left; font-weight: 540; font-size: 13px; transition: background .16s, color .16s; }
.nav-link:hover, .icon-button:hover { background: #68364c0b; color: var(--accent-deep); }
.nav-link[aria-current] { color: var(--accent-deep); background: #e8dce3; font-weight: 670; }
.nav-icon { position: relative; display: grid; place-items: center; }
.nav-icon svg { opacity: .88; }
.nav-count { margin-left: auto; color: var(--accent); background: #e9dce4; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 690; font-variant-numeric: tabular-nums; line-height: 1.6; }
.category-link { height: 35px; font-size: 12.5px; }
.category-link > span:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.category-link small { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin: 0 4px; background: var(--tint); opacity: .72; }
.tint-rose { --tint: #995c77; --tint-bg: #f0e3e9; }
.tint-gold { --tint: #986a39; --tint-bg: #f3e9d9; }
.tint-green { --tint: #50796a; --tint-bg: #e4ece5; }
.tint-lavender { --tint: #78618e; --tint-bg: #ece5f1; }
.tint-slate { --tint: #696a73; --tint-bg: #ecebf0; }
.side-footer { margin: auto 3px 0; padding: 15px 4px 1px; border-top: 1px solid #e2d9d3; display: flex; align-items: center; gap: 9px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; color: #f9eef3; background: var(--accent); font: italic 23px/.95 Georgia, serif; }
.side-footer strong, .side-footer div span { display: block; }
.side-footer strong { font-size: 12px; font-weight: 650; }
.side-footer div span { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.workspace { min-width: 0; }
.topbar { min-height: 64px; padding: 0 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.breadcrumb, .topbar-right, .header-date { display: flex; align-items: center; gap: 9px; }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 625; }
.breadcrumb svg { opacity: .55; }
.topbar-right { gap: 17px; }
.header-date { color: var(--muted); font-size: 12px; }
.header-date::first-letter { text-transform: uppercase; }
.icon-button { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; border-radius: 8px; color: #655b5f; transition: color .16s, background .16s; }
.header-inbox { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--paper); }
.nav-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border: 1.5px solid var(--paper); background: var(--accent); border-radius: 50%; }
.mobile-brand, .mobile-date, .bottom-nav { display: none; }

.main-content { display: grid; grid-template-columns: minmax(0, 740px); align-items: start; gap: 25px; max-width: 1510px; margin: auto; padding: 26px 28px 40px 30px; }
.main-content.with-detail { grid-template-columns: minmax(0, 1fr) clamp(279px, 26vw, 345px); }
.main-column { min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 21px; }
h1 { overflow-wrap: anywhere; font-size: 31px; line-height: 1.13; letter-spacing: -.043em; font-weight: 670; }
.page-description { margin-top: 9px; color: var(--muted); font-size: 13px; }
.button { min-height: 37px; padding: 0 12px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; white-space: nowrap; border-radius: 8px; border: 1px solid transparent; font-weight: 630; font-size: 12px; transition: background .16s, border-color .16s, transform .16s; }
.button:active, .order-row:active, .metric:active { transform: scale(.985); }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.secondary { color: #4a3d43; background: var(--paper); border-color: var(--line); }
.secondary:hover, .quiet:hover { background: #f3ebe9; }
.quiet { color: var(--muted); }

.summary { min-width: 0; margin-bottom: 23px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.16fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.metric { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 7px; min-height: 79px; padding: 10px 14px; text-align: left; transition: background .16s, transform .16s; }
.metric + .metric { border-left: 1px solid var(--line-soft); }
button.metric:hover { background: #f9f3f4; }
.metric-label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--muted); font-size: 11px; font-weight: 570; }
.metric-label svg { opacity: .8; }
.metric strong { font-size: 25px; font-weight: 650; line-height: 1.06; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-money strong { font-size: clamp(18px, 1.7vw, 25px); }
.metric.attention .metric-label, .metric.attention strong { color: var(--late); }

.toolbar { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 18px; }
.tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid #eae3dd; border-radius: 9px; background: #efeae5; white-space: nowrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-height: 29px; padding: 0 9px; border-radius: 6px; color: #645856; font-size: 11.5px; font-weight: 590; transition: background .16s, color .16s; }
.tab span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.tab:hover { background: #f9f6f2; }
.tab[aria-pressed="true"] { color: var(--accent-deep); background: var(--paper); box-shadow: 0 1px 2px #3f2c2514; }
.tab[aria-pressed="true"] span { color: var(--accent); }
.search-tools { display: flex; gap: 7px; min-width: 0; align-items: center; }
.search { min-width: 108px; width: clamp(136px, 15vw, 230px); min-height: 37px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--paper); }
.search:focus-within { border-color: #ad8b9c; box-shadow: 0 0 0 2px var(--accent-soft); }
.search input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; font-size: 12px; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search kbd { flex: 0 0 auto; font: inherit; font-size: 10px; line-height: 1.2; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; }
.filter { position: relative; }
.filter summary { list-style: none; display: flex; align-items: center; gap: 6px; min-height: 37px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: #5b5052; font-size: 12px; font-weight: 570; cursor: pointer; white-space: nowrap; }
.filter summary::-webkit-details-marker { display: none; }
.filter summary:hover, .filter[open] summary { background: #f3ebe9; }
.filter-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); }
.filter-panel { position: absolute; z-index: 12; top: calc(100% + 8px); right: 0; padding: 14px; width: 230px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); animation: enter .16s ease-out both; }
.filter-fields { display: grid; gap: 12px; margin-bottom: 12px; }
.filter-fields label, .editor-fields label, .swatches legend { display: grid; gap: 5px; font-size: 12px; font-weight: 610; }
.filter-fields select, .editor-fields input:not([type="checkbox"], [type="radio"]), .editor-fields select, .editor-fields textarea { min-width: 0; width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fffefc; font-size: 14px; outline: 0; font-weight: 450; }
.filter-fields select:focus, .editor-fields input:focus, .editor-fields select:focus, .editor-fields textarea:focus { border-color: #ad8b9c; box-shadow: 0 0 0 2px var(--accent-soft); }
.text-button { font-size: 12px; font-weight: 620; color: var(--accent); border-radius: 3px; }
.text-button:hover { color: var(--accent-deep); text-decoration: underline; }

.order-list { display: grid; gap: 18px; }
.order-group h2 { display: flex; align-items: center; gap: 7px; margin: 0 0 7px 2px; color: #4e4446; font-size: 12.5px; font-weight: 650; }
.order-group h2 svg { color: #756a69; }
.order-group.overdue h2, .order-group.overdue h2 svg, .row-due.late strong, .detail-line.late strong { color: var(--late); }
.order-group h2 span, .feature-label span { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; border-radius: 5px; background: #eee8e3; padding: 1px 5px; }
.order-group.overdue h2 span { background: #f4e6e2; color: var(--late); }
.order-rows { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; }
.order-row { position: relative; display: grid; align-items: center; grid-template-columns: minmax(0, 1.7fr) minmax(79px, .7fr) minmax(70px, .62fr) minmax(53px, .55fr) 13px; gap: 7px; width: 100%; min-height: 65px; padding: 8px 11px 8px 12px; text-align: left; transition: background .16s, transform .16s; }
.order-row + .order-row { border-top: 1px solid var(--line-soft); }
.order-row:first-child { border-radius: 10px 10px 0 0; }
.order-row:last-child { border-radius: 0 0 10px 10px; }
.order-row:only-child { border-radius: 10px; }
.order-row:hover { background: #f9f4f1; }
.order-row[aria-pressed="true"] { background: #f5edf1; }
.order-row[aria-pressed="true"]::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: #a77790; border-radius: 8px 0 0 8px; content: ""; }
.order-row:focus-visible { z-index: 1; }
.row-identity { display: flex; align-items: center; min-width: 0; gap: 9px; }
.category-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; flex: 0 0 auto; background: var(--tint-bg); color: var(--tint); }
.row-names { min-width: 0; }
.row-names strong, .row-names > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-names strong { font-size: 13px; font-weight: 640; line-height: 1.35; }
.row-names > span { margin-top: 3px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-names i, .detail-heading p i { display: inline-block; width: 3px; height: 3px; margin: 0 5px; vertical-align: .22em; border-radius: 50%; background: #9a8a8b; }
.status { display: inline-flex; vertical-align: middle; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 5px; background: var(--status-bg); color: var(--status-ink); white-space: nowrap; font-size: 10px; font-weight: 640; line-height: 1.2; --icon-bg: var(--status-bg); }
.status-new { --status-bg: #ede8ef; --status-ink: #665275; }
.status-progress { --status-bg: #f6e9d8; --status-ink: #865a27; }
.status-ready { --status-bg: #e4eee5; --status-ink: #3f6b50; }
.status-shipped { --status-bg: #e9edf0; --status-ink: #4e6573; }
.row-due, .row-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-due strong, .row-due small { display: block; }
.row-due strong { font-size: 11.5px; font-weight: 640; }
.row-due small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.no-date, .row-arrow { color: #9a888e; }
.row-amount { text-align: right; font-size: 11.5px; font-weight: 620; }
.row-arrow { display: grid; place-items: center; }

.detail-rail { position: sticky; top: 16px; min-width: 0; }
.detail-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.detail-top { min-height: 49px; padding: 5px 12px 5px 17px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.detail-id { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; font-weight: 620; font-variant-numeric: tabular-nums; }
.detail-top-actions { display: flex; gap: 1px; }
.detail-heading { padding: 15px 17px 12px; }
.detail-heading h2 { font-size: 23px; line-height: 1.15; letter-spacing: -.04em; font-weight: 675; overflow-wrap: anywhere; }
.detail-heading p { margin-top: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.detail-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 11px; }
.detail-status > span:last-child { color: var(--muted); font-size: 11px; }
.stage-control { position: relative; min-height: 29px; padding: 0 8px; font-size: 11px; }
.stage-control select { margin-inline: -22px -20px; padding: 5px 20px 5px 22px; min-height: inherit; appearance: none; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.stage-control option { color: var(--ink); background: var(--paper); }
.stage-control svg { pointer-events: none; }
.stage-control svg:last-child { transform: rotate(90deg); }
.cover, .photo-placeholder { position: relative; display: block; width: calc(100% - 34px); height: clamp(132px, 14vw, 184px); margin: 0 17px; overflow: hidden; border-radius: 8px; text-align: left; color: var(--muted); background: #efe4d8; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 53%; transition: transform .28s ease-out; }
.cover:hover img { transform: scale(1.045); }
.cover > span { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; border: 1px solid #fff9; border-radius: 5px; padding: 3px 6px; background: #fffaf3e8; font-size: 11px; color: #51453f; }
.photo-placeholder { display: inline-flex; width: auto; min-height: 34px; height: auto; margin: 0; padding: 0 9px; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--accent); font-size: 12px; }
.photo-placeholder:hover { background: var(--accent-soft); }
.photo-placeholder svg { width: 16px; height: 16px; }
.detail-section { margin: 0 17px; padding: 13px 0 12px; }
.detail-section + .detail-section { border-top: 1px solid var(--line-soft); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.detail-section h3 { font-size: 13px; font-weight: 660; }
.detail-line, .detail-source { display: flex; justify-content: space-between; align-items: center; gap: 7px; min-height: 25px; font-size: 12px; }
.detail-line span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.detail-line strong, .detail-source strong { font-weight: 610; font-variant-numeric: tabular-nums; }
.payment-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.payment-values span, .payment-values strong { display: block; }
.payment-values span { color: var(--muted); font-size: 10px; }
.payment-values strong { margin-top: 3px; font-size: 12.5px; font-weight: 660; white-space: nowrap; font-variant-numeric: tabular-nums; }
.payment-values div:last-child strong { color: var(--accent); }
progress { appearance: none; display: block; width: 100%; height: 4px; overflow: hidden; margin-top: 11px; border: 0; border-radius: 5px; color: #94627b; background: #efe5e9; }
progress::-webkit-progress-bar { background: #efe5e9; }
progress::-webkit-progress-value { border-radius: 5px; background: #94627b; }
progress::-moz-progress-bar { border-radius: 5px; background: #94627b; }
.notes p, .notes a { margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.notes a { display: inline-flex; gap: 5px; align-items: center; color: var(--accent); }
.detail-source { border-top: 1px solid var(--line-soft); min-height: 0; margin: 0 17px; padding-top: 9px; color: var(--muted); font-size: 11px; }
.detail-source strong { color: var(--ink); }
.detail-action { padding: 12px 17px 16px; }
.detail-action .button { width: 100%; }

.empty { display: grid; gap: 7px; justify-items: center; padding: 31px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 3px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.empty strong { font-size: 15px; font-weight: 650; }
.empty p { color: var(--muted); font-size: 12px; }
.empty .button { margin-top: 4px; }
.feature-list { display: grid; gap: 11px; }
.feature-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.incoming-card, .category-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.incoming-card { padding: 15px; }
.incoming-head, .incoming-footer, .category-item, .category-open { display: flex; align-items: center; gap: 10px; }
.incoming-head > div { min-width: 0; }
.incoming-head h2 { font-size: 15px; font-weight: 660; overflow-wrap: anywhere; }
.incoming-head p, .incoming-footer > span, .category-open small { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.request-source { margin-left: auto; padding: 3px 7px; border-radius: 5px; background: #f0eae6; color: #665756; font-size: 10.5px; }
.incoming-note { margin: 12px 0; color: #51484a; font-size: 13px; }
.incoming-footer { justify-content: space-between; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.incoming-footer > div { display: flex; gap: 5px; }
.category-list { gap: 0; }
.category-item { justify-content: space-between; padding: 5px 11px; }
.category-item + .category-item { border-top: 1px solid var(--line-soft); }
.category-open { min-width: 0; align-self: stretch; flex: 1; text-align: left; min-height: 52px; border-radius: 8px; }
.category-open:hover strong { color: var(--accent); }
.category-open strong, .category-open small { display: block; overflow-wrap: anywhere; }

dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); }
dialog::backdrop { background: #30232e5d; }
dialog[open] { animation: dialog-enter .18s ease-out; }
body:has(dialog[open]) { overflow: hidden; }
.editor-dialog { width: min(520px, calc(100% - 28px)); max-height: min(85dvh, 760px); padding: 0; border-radius: 14px; box-shadow: var(--shadow); overscroll-behavior: contain; }
.editor-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.editor-head h2 { font-size: 18px; letter-spacing: -.025em; font-weight: 660; }
.editor-fields { display: grid; gap: 13px; padding: 16px; }
.fields-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.editor-fields input[type="date"] { appearance: none; min-width: 0; }
.editor-fields textarea { resize: vertical; }
.editor-fields .file-label small { color: var(--muted); font-weight: 450; }
.editor-fields input[type="file"]::file-selector-button { border: 0; border-radius: 4px; padding: 4px 7px; margin-right: 6px; background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 12px; }
.editor-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 11px 16px; border-top: 1px solid var(--line); }
.editor-actions .icon-button { margin-right: auto; color: var(--late); }
.editor-info { color: var(--muted); font-size: 13px; }
.editor-info strong { color: var(--ink); }
.editor-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.editor-photos img { width: 74px; height: 55px; border-radius: 5px; object-fit: cover; }
.editor-photos label span { font-size: 11px; }
.form-error { margin: 0 16px 13px; color: var(--late); font-size: 12px; }
.swatches { min-width: 0; padding: 5px 0 0; margin: 0; border: 0; display: flex; gap: 9px; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; cursor: pointer; width: 31px; height: 31px; border-radius: 50%; border: 2px solid var(--paper); background: var(--tint); }
.swatches input:checked + span, .swatches input:focus-visible + span { outline: 2px solid var(--tint); }
.photo-dialog { max-width: calc(100% - 24px); width: min(660px, calc(100% - 24px)); max-height: 89dvh; padding: 9px; border-radius: 13px; box-shadow: var(--shadow); }
.gallery-head, .gallery-nav { display: flex; align-items: center; gap: 8px; padding: 0 3px 6px; justify-content: space-between; color: var(--muted); font-size: 12px; }
.gallery-nav { justify-content: center; padding: 6px 0 0; }
.photo-dialog img { display: block; width: 100%; max-height: 70dvh; object-fit: contain; border-radius: 8px; background: #f1e8df; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 22px; display: flex; align-items: center; gap: 12px; max-width: min(420px, calc(100% - 30px)); padding: 10px 13px; border-radius: 9px; background: #3f2b35; color: #fff; font-size: 12px; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .18s, transform .18s, visibility .18s; }
.toast.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.toast button { color: #f6d2e4; font-weight: 650; }
.detail-dialog .toast { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-enter { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1250px) {
  .layout { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .main-content { gap: 18px; padding-inline: 21px; }
  .main-content.with-detail { grid-template-columns: minmax(0, 1fr) 283px; }
  .metric { padding-inline: 10px; }
  .search kbd, .filter summary > span { display: none; }
}

@media (max-width: 1099px) {
  .main-content.with-detail { grid-template-columns: minmax(0, 1fr); }
  .detail-rail { display: none; }
  .detail-dialog { margin: 0 0 0 auto; padding: 0; width: min(435px, 100%); height: 100dvh; max-height: 100dvh; max-width: 100%; overflow: auto; border: 0; box-shadow: var(--shadow); overscroll-behavior: contain; }
  .detail-dialog .detail-panel { overflow: visible; border: 0; border-radius: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .detail-dialog .detail-top { position: sticky; z-index: 2; top: 0; min-height: 54px; padding-left: 8px; background: var(--paper); }
  .detail-dialog .cover { height: 205px; }
  .detail-dialog .detail-top .icon-button { width: 40px; height: 40px; }
  .detail-dialog .detail-action .button { min-height: 43px; }
  .order-row[aria-pressed="true"] { background: transparent; }
  .order-row[aria-pressed="true"]::before { display: none; }
  .search { width: min(230px, 24vw); }
}

@media (max-width: 700px) {
  .layout { display: block; }
  .sidebar, .breadcrumb, .header-date { display: none; }
  .topbar { min-height: calc(55px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 16px 0; }
  .mobile-brand { display: flex; gap: 9px; align-items: baseline; }
  .mobile-brand .wordmark { font-size: 32px; }
  .mobile-brand > span:last-child { font-size: 10px; font-weight: 590; letter-spacing: .005em; color: var(--muted); }
  .header-inbox { width: 38px; height: 38px; }
  .main-content { padding: 17px 15px calc(81px + env(safe-area-inset-bottom, 0px)); }
  .page-heading { min-height: 49px; margin-bottom: 15px; align-items: flex-end; }
  h1 { font-size: 29px; }
  .mobile-date { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
  .mobile-date::first-letter { text-transform: uppercase; }
  .page-description { margin-top: 6px; font-size: 12px; }
  .page-heading > .button { min-height: 40px; margin-bottom: 1px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 15px; }
  .metric { gap: 4px; min-height: 61px; padding: 8px 11px; }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
  .metric-label { font-size: 11px; }
  .metric strong, .metric-money strong { font-size: 21px; }
  .toolbar { display: grid; gap: 8px; margin-bottom: 15px; }
  .tabs { padding: 3px; gap: 3px; }
  .tab { min-height: 33px; flex: 1; font-size: 12px; }
  .search-tools { width: 100%; }
  .search { width: 100%; min-height: 41px; padding-inline: 10px; }
  .search input { font-size: 16px; }
  .search input::placeholder { font-size: 13px; }
  .filter summary { min-height: 41px; padding-inline: 10px; }
  .filter summary > span { display: inline; }
  .filter-fields select, .editor-fields input:not([type="checkbox"], [type="radio"]), .editor-fields select, .editor-fields textarea { font-size: 16px; }
  .order-list { gap: 15px; }
  .order-group h2 { font-size: 12px; margin-bottom: 6px; }
  .order-row { min-height: 70px; padding: 7px 8px; gap: 6px; grid-template-columns: minmax(0, 1fr) minmax(69px, auto) 12px; grid-template-rows: auto auto; column-gap: 7px; row-gap: 3px; }
  .row-identity { grid-area: 1 / 1 / 2 / 2; align-self: end; gap: 8px; }
  .row-identity .category-mark { grid-row: span 2; width: 32px; height: 36px; align-self: start; margin-top: 1px; }
  .row-names strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; font-size: 13px; }
  .row-names > span { font-size: 10.5px; margin-top: 2px; }
  .row-status { grid-area: 2 / 1 / 3 / 2; padding-left: 40px; align-self: start; }
  .status { padding: 2px 5px; font-size: 10px; }
  .row-due { grid-area: 1 / 2 / 2 / 3; text-align: right; align-self: end; }
  .row-due strong { font-size: 11.5px; }
  .row-due small { margin-top: 1px; font-size: 9.5px; }
  .row-amount { grid-area: 2 / 2 / 3 / 3; align-self: start; font-size: 11px; color: var(--muted); }
  .row-arrow { grid-area: 1 / 3 / 3 / 4; }
  .bottom-nav { position: fixed; z-index: 14; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 5px 10px calc(5px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: #fffcf8f2; backdrop-filter: blur(12px); }
  .bottom-nav .nav-link { height: 49px; flex-direction: column; justify-content: center; gap: 3px; padding: 0 1px; border-radius: 8px; font-size: 10px; font-weight: 580; text-align: center; }
  .bottom-nav .nav-link[aria-current] { background: #efe4ea; font-weight: 660; }
  .bottom-nav .nav-dot { top: 0; right: 0; }
  .detail-dialog { width: 100%; margin: 0; }
  .detail-dialog .detail-top { padding-top: calc(3px + env(safe-area-inset-top, 0px)); }
  .detail-dialog .detail-top .icon-button { width: 43px; height: 43px; }
  .detail-dialog .detail-heading { padding-top: 16px; }
  .detail-dialog .detail-heading h2 { font-size: 25px; }
  .detail-dialog .stage-control { min-height: 44px; }
  .detail-dialog .detail-section { padding-block: 14px; }
  .detail-dialog .detail-section h3 { font-size: 14px; }
  .detail-dialog .detail-line { min-height: 28px; }
  .detail-dialog .detail-action .button { min-height: 44px; }
  .detail-dialog .detail-source, .detail-dialog .notes p { font-size: 12px; }
  .detail-dialog .payment .text-button, .detail-dialog .photo-placeholder { min-height: 44px; }
  .editor-dialog { max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 26px); }
  .toast { right: 13px; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 360px) {
  .main-content { padding-inline: 11px; }
  .page-heading > .button { padding-inline: 8px; gap: 4px; }
  .incoming-card { padding: 10px; }
  .incoming-footer .button { padding-inline: 6px; gap: 3px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Stage 3 controls use the existing typography, colours and card rhythm. */
.order-row { position: relative; }
.row-opener { display: block; width: 100%; padding: 0; border-radius: 4px; text-align: left; }
.row-opener:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.buyer-link { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; font: inherit; }
.buyer-link:hover { color: var(--accent); }
.row-names .buyer-link { margin-left: 4px; }
.detail-buyer { display: flex; gap: 5px 8px; flex-wrap: wrap; align-items: baseline; margin: 7px 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.detail-buyer .buyer-name { color: var(--ink); }
.mobile-tool { display: none; }
.extended-section h3 small { color: var(--muted); font-size: 11px; margin-left: 4px; }
.position-line, .studio-entry { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; padding: 9px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.position-line:last-child, .studio-entry:last-child { border-bottom: 0; }
.position-line strong, .studio-entry strong { font-size: 13px; }
.position-line small, .studio-entry small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.position-tools, .detail-shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.position-tools { flex-shrink: 0; }
.detail-shortcuts { margin-top: 8px; }
.detail-shortcuts .button { min-height: 35px; padding: 0 8px; }
.helper-text { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 4px 0; overflow-wrap: anywhere; }
.delay-note { color: var(--late); }
.studio-details { padding: 8px 0; border-top: 1px solid var(--line); }
.studio-details summary { cursor: pointer; font-weight: 650; font-size: 13px; margin-bottom: 8px; }
.studio-details > label { margin-bottom: 9px; }
.editor-fields .studio-check { display: flex; align-items: center; gap: 8px; }
.studio-check input { width: 17px; height: 17px; }
.chat-history { display: grid; gap: 7px; max-height: 300px; overflow: auto; }
.chat-history article { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-history strong, .chat-history small { display: inline-block; padding-right: 6px; font-size: 11px; }
.chat-history p { font-size: 13px; margin-top: 3px; }
.studio-search { width: min(100%, 360px); margin-bottom: 13px; }
.studio-search .icon-button { height: 28px; width: 28px; }
.studio-products { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.studio-product { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.studio-product > button { display: block; width: 100%; aspect-ratio: 4/3; background: var(--side); }
.studio-product img { display: block; width: 100%; height: 100%; object-fit: cover; }
.studio-product > div { padding: 9px; }
.studio-product h2 { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.studio-product small { color: var(--muted); font-size: 11px; }
.studio-product-price { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.studio-queue { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.studio-queue h2 { font-size: 16px; margin-bottom: 8px; }
.login-screen { min-height: 100dvh; display:grid; place-items:center; padding:24px; }
.login-card { width:min(100%, 390px); padding:26px; border:1px solid var(--line); border-radius:var(--radius); background:var(--paper); }
.login-card h1 { margin: 20px 0 8px; font-size: 25px; }
.login-card p { margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.login-card form { display:grid; gap:12px; }
.status-confirmed { color: var(--accent-deep); background: var(--accent-soft); }
.status-completed, .status-cancelled { color: var(--muted); background: var(--side); }
@media (max-width: 1099px) {
  .mobile-tool { display: inline-grid; }
  .topbar-right { gap: 4px; }
  .position-tools .icon-button { width: 42px; height: 42px; }
  .detail-shortcuts > .button { min-height: 42px; }
}
@media (max-width: 399px) {
  .studio-products { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .header-inbox { display: none; }
}
