@font-face { font-family: Inter; src: url(/font/regular) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/font/bold) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink: #1a1a1a;
  --muted: #56564e;
  --warm: #f5f4f1;
  --line: #dcdad5;
  --edge: #9c9b94;
  color: var(--ink);
  background: #fff;
  font: 15px/1.5 Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
header {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 76px;
  padding: 12px max(4vw, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--line);
}
.brand, .brand img { display: block; }
.brand img { width: 90px; height: auto; }
.studio-name { padding-left: 22px; border-left: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.signout { margin-left: auto; }
main { width: min(1200px, 92%); margin: 0 auto; padding: 48px 0 80px; }
.heading, .section, .grouphead, .dialoghead, footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 400; line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 24px; font-weight: 400; line-height: 1.2; letter-spacing: -.03em; }
.section h2 { font-size: 16px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
#clock, #count, .sub, #details, #ord, #notice { color: var(--muted); font-size: 13px; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer; color: var(--ink); border: 1px solid var(--ink); background: white;
  border-radius: 0; padding: 10px 18px; font-size: 14px;
}
button:hover { background: var(--warm); }
button:disabled { opacity: .6; cursor: wait; }
:where(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.primary, .primary:hover { background: var(--ink); color: #fff; }
.primary:hover { background: #383832; }
.signout button { padding: 6px 0; border: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.signout button:hover { background: white; color: var(--muted); }
form, label { display: grid; }
form { gap: 16px; }
label { gap: 6px; font-size: 13px; }
input, select, textarea {
  min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid var(--edge);
  border-radius: 0; background: white; color: var(--ink); font-size: 16px; line-height: 1.4;
}
textarea { resize: vertical; }

.login {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  margin: clamp(32px, 7vh, 80px) auto;
  padding: 0;
  background: var(--warm);
}
.login-photo { display: block; align-self: stretch; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.login-panel { align-self: center; padding: clamp(30px, 5.5vw, 84px); }
.login-panel h1 { max-width: 12em; margin-bottom: 28px; font-size: clamp(30px, 3vw, 42px); }
.login .primary { min-height: 46px; margin-top: 6px; }
.login [role=alert], #error, #reason { color: #91391e; font-size: 14px; }

nav { display: flex; gap: 28px; margin: 28px 0 24px; border-bottom: 1px solid var(--line); }
nav button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 0 12px; color: var(--muted); }
nav button[aria-pressed=true] { color: var(--ink); border-color: var(--ink); font-weight: 700; }
.tools { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 20px; background: var(--warm); }
.tools label:first-child { flex: 2; min-width: 180px; }
.tools label { flex: 1; min-width: 128px; }
.tools input, .tools select { height: 44px; }
.section { margin: 36px 0 16px; }
#refresh { min-width: 150px; min-height: 48px; font-size: 16px; font-weight: 700; }
.sheet { overflow-x: auto; border: 1px solid var(--line); }
.order-board { --board-gutter: clamp(12px, 2vw, 32px); }
.order-board header { padding-inline: var(--board-gutter); }
.order-board main { width: 100%; padding-inline: var(--board-gutter); }
.order-board .sheet, #sheet-scrollbar { margin-inline: calc(-1 * var(--board-gutter)); }
.sheet.with-scrollbar { scrollbar-width: none; }
.sheet.with-scrollbar::-webkit-scrollbar { display: none; }
#sheet-scrollbar {
  position: sticky; bottom: 0; z-index: 2; padding: 4px 2px max(4px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: #fff;
}
#sheet-position {
  display: block; appearance: none; padding: 0; border: 0;
  height: 20px; background: var(--warm); border-radius: 10px; cursor: pointer;
}
#sheet-position::-webkit-slider-thumb {
  appearance: none; width: var(--thumb-width); height: 14px; background: var(--edge); border-radius: 8px;
}
#sheet-position::-moz-range-thumb {
  width: var(--thumb-width); height: 14px; border: 0; background: var(--edge); border-radius: 8px;
}
#sheet-position:focus-visible { outline-offset: -2px; }
.sheet table { width: 100%; min-width: 1060px; border-collapse: collapse; text-align: left; font-size: 13px; }
.sheet th, .sheet td { padding: 4px 10px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.sheet th { background: var(--warm); padding-block: 8px; white-space: nowrap; }
.sheet table.resizable { table-layout: fixed; min-width: 0; }
.sheet .resizable th { position: relative; padding-right: 14px; white-space: normal; overflow-wrap: anywhere; }
.sheet .resizable td.date { white-space: normal; }
.sheet .resizable .thumb { max-width: 100%; }
.sheet .resizable .copy-command { min-width: 0; max-width: 100%; }
.column-grip {
  position: absolute; inset: 0 0 0 auto; width: 12px;
  cursor: col-resize; touch-action: none; user-select: none;
}
.column-grip::after {
  content: ''; position: absolute; right: 3px; top: 18%; bottom: 18%;
  width: 1px; background: var(--edge);
}
.column-grip:hover::after, .column-grip:focus-visible::after, .column-grip:active::after {
  width: 3px; background: var(--ink);
}
.sheet th small { font-weight: 400; }
.sheet td:has(.codex-status) { text-align: center; }
.codex-status { display: inline-block; font-weight: 700; }
.codex-status.finished { color: #38623c; font-size: 18px; }
.codex-status.incomplete { color: #984620; }
.codex-status.processing {
  width: 15px; height: 15px; vertical-align: middle; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--ink); animation: codex-spin .8s linear infinite;
}
@keyframes codex-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .codex-status.processing { animation: none; } }
.copy-command { padding: 4px 8px; min-width: 72px; font-size: 12px; white-space: nowrap; }
.sheet tr:has(input[name=engraved]:checked) .plaque-text { color: #707070; }
.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet tbody tr:hover { background: #faf9f7; }
.sheet td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sheet td { overflow-wrap: anywhere; }
.filaments { display: flex; flex-wrap: wrap; gap: 3px 10px; list-style: none; margin: 0; padding: 0; font-size: 12px; }
.filaments li::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 4px; border: 1px solid #0003; border-radius: 50%; background: var(--swatch); }
.sheet .check-heading, .sheet td:has(input[type=checkbox]) { text-align: center; }
.sheet td[colspan] { text-align: left; padding: 12px; }
.order-link { padding: 3px 0; border: 0; color: var(--ink); background: transparent; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.review-flag { display: block; color: #91391e; }
.thumb { width: 96px; height: 72px; padding: 0; border: 0; display: grid; place-items: center; background: var(--warm); color: var(--muted); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.sheet input[type=checkbox] { width: 18px; height: 18px; margin: 0; vertical-align: middle; accent-color: var(--ink); cursor: pointer; }
#notice:not(:empty) { margin: 8px 0; }
.large-preview {
  position: fixed; z-index: 5; pointer-events: none;
  background: white; outline: 1px solid var(--line); box-shadow: 0 8px 28px #18171330;
}
dialog {
  width: min(510px, calc(100vw - 24px)); max-height: 93dvh; padding: 26px;
  border: 1px solid var(--line); color: var(--ink); box-shadow: 0 16px 60px #18171329;
}
dialog::backdrop { background: #24231f99; }
.dialoghead { align-items: start; }
.dialoghead h2 { margin-top: 4px; overflow-wrap: anywhere; }
#close { border: 0; font-size: 26px; line-height: 1; padding: 4px 8px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#links { display: flex; gap: 20px; font-size: 14px; }
#error:empty, #reason:empty { display: none; }
footer { justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 749px) {
  header { min-height: 60px; padding: 12px 4vw; gap: 14px; }
  .studio-name { padding-left: 14px; font-size: 12px; }
  main { padding: 28px 0 60px; }
  .login { display: block; margin: 24px auto; }
  .login-photo { width: 100%; height: auto; aspect-ratio: 8/3; }
  .login-panel { padding: 24px; }
  .login-panel h1 { margin-bottom: 20px; }
  .tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
  .tools label, .tools label:first-child { min-width: 0; }
  .tools label:first-child { grid-column: 1/-1; }
  #refresh { min-width: 110px; }
  .section { margin-top: 28px; }
  .pair { grid-template-columns: 1fr; }
}
