:root {
  color-scheme: light;
  --canvas: #f5f5f2;
  --paper: #fff;
  --line: #dddeda;
  --ink: #222622;
  --muted: #626861;
  --accent: #34483d;
  --soft: #e8eee8;
  --danger: #8c342e;
  --gutter: clamp(20px, 4vw, 48px);
  --content: 1180px;
  font: 14px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; inline-size: 100%; max-inline-size: 100%; overflow: hidden; overscroll-behavior-x: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.layout { display: grid; height: 100vh; height: 100dvh; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
.layout.signed-in { grid-template-columns: 216px minmax(0, 1fr); }
aside { display: none; }
.signed-in aside { display: flex; min-height: 0; flex-direction: column; gap: 24px; overflow-y: auto; padding: 26px 14px 16px; background: #222923; color: #f5f6f2; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; font-size: 19px; font-weight: 670; }
.brand small { display: block; font-size: 12px; font-weight: 450; color: #adb8ad; }
.mark { display: grid; place-items: center; width: 39px; height: 39px; flex: none; border: 1px solid #647569; border-radius: 9px; background: #34483d; color: #fff; }
nav { display: grid; gap: 3px; }
nav button { position: relative; text-align: left; border-color: transparent; background: transparent; color: #ccd4cc; padding-left: 15px; }
nav button:hover:not(:disabled) { background: #313c34; color: white; }
nav button[aria-current] { background: #3b493e; color: white; font-weight: 650; }
nav button[aria-current]::before { content: ""; position: absolute; inset: 9px auto 9px 4px; width: 2px; border-radius: 2px; background: #b6c9b9; }
#logout { margin-top: auto; text-align: left; border-color: #536054; color: #f1f4ef; }
#logout:hover { background: #313c34; }
main { min-width: 0; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.topbar { display: none; }
.signed-in .topbar { display: block; position: sticky; top: 0; z-index: 3; border-bottom: 1px solid var(--line); background: #fafaf8; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 59px; gap: 12px; max-width: calc(var(--content) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.topbar-label { font-weight: 650; }
.environment { flex: none; border-radius: 99px; background: var(--soft); color: var(--accent); font-size: 12px; padding: 4px 10px; }
.mobile-navigation { display: none; }
#workspace { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin-inline: auto; padding: 30px var(--gutter) 52px; }
.heading, .toolbar, .actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.heading { justify-content: space-between; gap: 16px; margin-bottom: 22px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.heading > div, #content, .toolbar, .actions { min-width: 0; overflow-wrap: anywhere; }
.heading > div { flex: 1 1 210px; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(24px, 2.3vw, 32px); line-height: 1.25; letter-spacing: -.02em; }
h2 { font-size: 18px; margin-bottom: 12px; }
h3 { font-size: 14px; margin-bottom: 6px; }
p, small { color: var(--muted); }
.heading p, .signin p { margin-top: 7px; }
.card, .signin { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.card + .card, .toolbar + .card, .card + .toolbar { margin-top: 14px; }
.signin { width: min(424px, calc(100% - 32px)); margin: clamp(28px, 13vh, 140px) auto 32px; padding: clamp(21px, 5vw, 34px); box-shadow: 0 12px 38px #20251e0a; }
.signin-brand { margin-bottom: 29px; padding: 0; }
.signin-brand small { color: var(--muted); }
form, label { display: grid; gap: 7px; min-width: 0; }
form { gap: 15px; }
.signin form { margin-top: 22px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); min-height: 36px; padding: 7px 12px; overflow-wrap: anywhere; }
button:hover:not(:disabled) { border-color: #a2ada3; background: #f1f4ef; }
button:disabled { opacity: .52; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #527460; outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: #26392f; color: white; }
.quiet { background: transparent; }
input:not([type=checkbox]), textarea, select { width: 100%; max-width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #cfd4cc; background: white; border-radius: 7px; color: var(--ink); }
textarea { min-height: 88px; resize: vertical; }
.scroll { padding: 0; overflow: hidden; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
td, th { padding: 13px 15px; border-bottom: 1px solid #ecedea; vertical-align: middle; overflow-wrap: anywhere; }
th { background: #f7f8f5; color: var(--muted); font-size: 12px; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf9; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.grid .card { display: grid; justify-items: start; align-content: start; gap: 9px; margin: 0; }
.grid .card h2 { margin: 0; }
.toolbar select { width: auto; }
.check { display: flex; align-items: flex-start; gap: 8px; margin: 9px 0; }
.check input { flex: none; margin-top: 5px; accent-color: var(--accent); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
dialog {
  --dialog-height: calc(100vh - 2rem);
  --dialog-height: calc(100dvh - 2rem);
  position: fixed;
  inset: 0;
  width: min(530px, calc(100% - 28px));
  height: fit-content;
  max-width: 100%;
  max-height: var(--dialog-height);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  color: var(--ink);
  background: white;
}
dialog::backdrop { background: #1f2723a0; }
#modal { display: flex; flex-direction: column; min-width: 0; max-height: calc(var(--dialog-height) - 2px); gap: 0; }
#dialog-title { flex: none; margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#fields { flex: 1 1 auto; display: grid; align-content: start; gap: 14px; min-width: 0; min-height: 0; padding: 18px 20px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
#modal > .actions { flex: none; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.license-dialog { width: min(970px, calc(100% - 28px)); }
.license-dialog #fields { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.license-preview { min-width: 0; background: #f0f2ee; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.license-preview img { display: block; width: 100%; height: clamp(120px, 48dvh, 420px); object-fit: contain; }
.license-preview figcaption { padding: 8px 11px; color: var(--muted); border-top: 1px solid var(--line); }
.review-fields { display: grid; align-content: start; gap: 13px; min-width: 0; }
.review-fields textarea { max-height: 180px; }
.recognition { padding: 13px; border: 1px solid #d7e3d8; border-radius: 8px; background: #f0f5ef; }
.credit-code { display: block; font-size: 16px; font-weight: 650; overflow-wrap: anywhere; color: var(--accent); }
.recognition small { display: block; margin-top: 4px; }
#message { position: fixed; inset: auto 14px 14px auto; max-width: min(400px, calc(100% - 28px)); background: white; border: 1px solid var(--line); padding: 11px 14px; border-radius: 8px; color: var(--ink); box-shadow: 0 6px 18px #2222; z-index: 5; overflow-wrap: anywhere; }
#message.failure { color: var(--danger); }

@media (max-width: 820px) {
  :root { --gutter: 15px; }
  .layout.signed-in { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .signed-in aside { min-width: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 8px var(--gutter); }
  aside .brand { padding: 0; }
  aside .mark { height: 32px; width: 32px; }
  aside nav { display: none; }
  #logout { margin: 0; min-height: 32px; }
  .topbar-inner { min-height: 49px; }
  .topbar-label { display: none; }
  .mobile-navigation { display: grid; max-width: min(64%, 280px); }
  .mobile-navigation select { padding: 5px 8px; }
  #workspace { padding-top: 20px; }
  .heading { margin-bottom: 14px; padding-bottom: 14px; }
  .card { padding: 15px; }
  .scroll { padding: 0; border: 0; background: transparent; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { padding: 8px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
  td { display: grid; grid-template-columns: minmax(68px, 28%) minmax(0, 1fr); gap: 8px; padding: 7px 0; border: 0; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  td > button { justify-self: start; }
  #fields { padding: 14px; }
  #dialog-title, #modal > .actions { padding-inline: 14px; }
}

.order-filters { display: grid; grid-template-columns: minmax(120px, .65fr) minmax(140px, 1fr) auto; align-items: end; margin-bottom: 14px; }
.card > .scroll { margin: 12px 0; }
@media (max-width: 820px), (pointer: coarse) {
  input:not([type=checkbox]), textarea, select { font-size: 16px; }
}
@media (max-width: 540px) {
  .order-filters { grid-template-columns: minmax(0, 1fr); }
  .order-filters button { justify-self: start; }
}

@media (max-width: 640px) {
  dialog { --dialog-height: calc(100dvh - 16px); }
  .license-dialog #fields { grid-template-columns: minmax(0, 1fr); }
  .license-preview img { height: clamp(120px, 32dvh, 275px); }
  #modal > .actions { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (max-height: 520px) {
  #dialog-title { padding-block: 9px; }
  #modal > .actions { padding-block: 8px; }
}
