@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --rail: #f3f6fc;
  --wash: #e8eefd;
  --line: #dde4f0;
  --line-strong: #bcc8dc;
  --ink: #12203a;
  --ink-2: #4c5b75;
  --ink-3: #5f6e87;
  --blue: #1e4fd8;
  --blue-hover: #1a43b8;
  --blue-press: #15379a;
  --red: #c81e1e;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.875rem/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blue);
  scrollbar-color: var(--line-strong) transparent;
}

::selection { background: #c9d8fb; color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: var(--blue); text-underline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: 1.375rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.012em; }
h2 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.008em; }
h3 { font-size: 0.875rem; font-weight: 700; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.8125rem; }

.icon { width: 16px; height: 16px; flex: none; }

/* Controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: 600 0.875rem/1 var(--sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}
.btn:hover { background: var(--rail); border-color: var(--ink-3); }
.btn:active { background: var(--wash); }
.btn:disabled { color: var(--ink-3); background: var(--rail); border-color: var(--line); cursor: not-allowed; }

.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-primary:active { background: var(--blue-press); border-color: var(--blue-press); }
.btn-primary:disabled { background: var(--line); border-color: var(--line); color: var(--ink-3); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--wash); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: #fdeeee; border-color: var(--red); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 0.8125rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-block { width: 100%; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label, .field-label { font-size: 0.8125rem; font-weight: 600; color: var(--ink); }
.hint { font-size: 0.8125rem; color: var(--ink-2); }
.req { color: var(--red); font-weight: 500; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.875rem/1.5 var(--sans);
  transition: border-color 150ms, box-shadow 150ms;
}
input, select { height: 36px; padding: 0 10px; }
select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2716%27 height=%2716%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%234c5b75%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27m6 9 6 6 6-6%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
textarea { padding: 8px 10px; resize: vertical; min-height: 76px; display: block; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #1e4fd829; }

.form-error { color: var(--red); font-size: 0.8125rem; font-weight: 500; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper);
  font-size: 0.75rem;
  line-height: 18px;
  text-align: center;
}

/* Status stamps */

.stamp {
  --ink-stamp: var(--ink-2);
  display: inline-block;
  padding: 1px 7px;
  border: 1.5px solid var(--ink-stamp);
  border-radius: 2px;
  color: var(--ink-stamp);
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
[data-status='draft'] { --ink-stamp: #5f6e87; border-style: dashed; }
[data-status='ready'] { --ink-stamp: #1e4fd8; }
[data-status='in_progress'] { --ink-stamp: #1e4fd8; }
[data-status='review'] { --ink-stamp: #12203a; }
[data-status='fix'] { --ink-stamp: #a84c06; }
[data-status='done'] { --ink-stamp: #157a3a; }
[data-status='failed'] { --ink-stamp: #c81e1e; }
[data-status='decline'] { --ink-stamp: #4c5b75; }

.stamp-struck { --ink-stamp: var(--ink-3); border-width: 1px; font-weight: 700; text-decoration: line-through; text-decoration-thickness: 1px; }
.stamp-plain { --ink-stamp: var(--ink-2); }

.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { position: relative; display: inline-flex; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pick .stamp { padding: 4px 9px; transition: background-color 150ms, border-color 150ms, color 150ms; }
.pick:hover .stamp { background: var(--wash); }
.pick input:focus-visible + .stamp { outline: 2px solid var(--blue); outline-offset: 2px; }
.pick input:checked + .stamp { background: var(--blue); border-color: var(--blue); border-style: solid; color: #fff; }

.stamp-cap {
  position: relative;
  padding: 5px 15px;
  border-width: 2.5px;
  font-size: 1.0625rem;
  letter-spacing: 0.1em;
  transform: rotate(-2deg);
}
.stamp-cap::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid var(--ink-stamp);
  border-style: inherit;
  border-radius: 1px;
  pointer-events: none;
}
.stamp-press { animation: press 260ms var(--ease); }
@keyframes press {
  from { transform: rotate(-5deg) scale(1.5); opacity: 0; filter: blur(2px); }
  60% { transform: rotate(-2deg) scale(0.97); opacity: 1; filter: blur(0); }
  to { transform: rotate(-2deg) scale(1); }
}

/* Login */

.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.login { width: 100%; max-width: 340px; text-align: center; }
.login .form { margin-top: 28px; text-align: left; }
.login-sub { color: var(--ink-2); margin-top: 8px; font-weight: 500; }
.login-logo img { display: block; width: 240px; max-width: 100%; height: auto; margin: 0 auto; }

/* Shell */

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100dvh; }
.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--rail);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  color: var(--ink);
  text-decoration: none;
}
.brand-logo { display: block; height: 52px; width: auto; flex: none; }
.brand-sub { font-size: 0.75rem; font-weight: 500; line-height: 1.25; color: var(--ink-2); }

.rail-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; display: flex; flex-direction: column; gap: 1px; }
.rail-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms;
}
.rail-link:hover { background: var(--wash); }
.rail-link[aria-current='page'] { background: var(--blue); color: #fff; }
.rail-link[aria-current='page'] .rail-count { color: #fff; }
.rail-filters { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 8px; }
.rail-filter { padding-left: 33px; font-weight: 500; min-height: 29px; color: var(--ink-2); }
.rail-count { margin-left: auto; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); }
.rail-attn { color: var(--ink); font-weight: 600; }
.rail-attn .rail-count { color: var(--red); font-weight: 700; }

.rail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px 10px 16px;
  border-top: 1px solid var(--line);
}
.whoami { font-weight: 600; font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; }

.view { min-width: 0; min-height: 0; }

/* Requests workspace */

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 480px; height: 100%; }
.list-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; container-type: inline-size; }
.page-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; }
.page-head h1 { flex: 1; min-width: 0; }
.page-head .tally { color: var(--ink-2); font-weight: 500; margin-left: 8px; font-size: 1rem; }
.toolbar { padding: 0 20px 12px; }
.search { position: relative; max-width: 360px; }
.search .icon { position: absolute; left: 10px; top: 10px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 32px; }

.table-wrap { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 12px;
  background: var(--paper);
  box-shadow: inset 0 -1px var(--line);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }

.req-row { cursor: pointer; transition: background-color 120ms; }
.req-row:hover { background: var(--rail); }
.req-row.is-selected { background: var(--wash); }
td.col-code { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap; }
.col-title { width: 100%; min-width: 180px; }
.col-title a { color: var(--ink); font-weight: 600; text-decoration: none; }
.col-title a:hover { text-decoration: underline; }
.row-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.8125rem;
  margin-top: 1px;
}
.col-priority, .col-agent, .col-time { white-space: nowrap; color: var(--ink-2); }
td.col-time { font-size: 0.8125rem; }
.p-high { color: var(--ink); font-weight: 600; }
.p-urgent { color: var(--red); font-weight: 700; }

.row-flag { display: none; margin-left: 8px; color: var(--red); font-size: 0.75rem; font-weight: 700; }

@container (max-width: 760px) {
  .col-priority, .col-agent { display: none; }
  .row-flag { display: inline; }
}

.more { padding: 12px 20px; display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 0.8125rem; }

.skel { display: block; height: 12px; border-radius: 2px; background: var(--rail); animation: skel 1.2s ease-in-out infinite alternate; }
@keyframes skel { to { background: var(--line); } }

.empty { padding: 56px 24px; display: grid; gap: 6px; justify-items: center; text-align: center; color: var(--ink-2); }
.empty strong { color: var(--ink); font-size: 1rem; }
.empty p { max-width: 42ch; }
.empty .btn { margin-top: 10px; }

/* Detail panel */

.detail-pane { min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--paper); }
.detail-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px 0 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.detail-code { flex: 1; font-family: var(--mono); font-weight: 600; font-size: 0.8125rem; color: var(--ink-2); }
.detail-body { padding: 18px 20px 28px; display: grid; gap: 20px; }
.detail-head { display: grid; gap: 14px; justify-items: start; }
.detail-head h2 { overflow-wrap: anywhere; font-size: 1.25rem; }

.meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.meta > div { background: var(--paper); padding: 7px 10px; }
.meta dt { color: var(--ink-2); font-size: 0.75rem; }
.meta dd { font-weight: 600; overflow-wrap: anywhere; font-size: 0.8125rem; }

.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; }
.prose-empty { color: var(--ink-2); }

.composer { padding-top: 18px; border-top: 1px solid var(--line); }

.trail { padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.trail ol { display: grid; gap: 16px; }
.trail li { position: relative; display: grid; grid-template-columns: 27px minmax(0, 1fr); gap: 10px; }
.trail li:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 27px; bottom: -16px; width: 1px; background: var(--line); }
.paraf {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 800;
}
.paraf-agent { border-color: var(--blue); color: var(--blue); }
.trail-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-height: 27px; padding-top: 3px; }
.trail-who { font-weight: 700; }
.trail-role { color: var(--ink-2); font-size: 0.8125rem; }
.trail-time { margin-left: auto; font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap; }
.trail-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--ink-2); font-size: 0.8125rem; margin-top: 2px; }
.trail-note { margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; }

.guide { height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 32px; text-align: center; color: var(--ink-2); }
.guide-lead { display: grid; justify-items: center; gap: 12px; }
.guide .icon { width: 28px; height: 28px; color: var(--line-strong); }
.guide strong { color: var(--ink); font-size: 1rem; }
.guide dl { display: grid; grid-template-columns: auto auto; gap: 7px 12px; margin-top: 6px; text-align: left; font-size: 0.8125rem; }
.guide dd { align-self: center; }

/* Standalone pages */

.page { height: 100%; overflow-y: auto; }
.page-inner { max-width: 860px; margin-inline: auto; padding: 28px 20px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.page-inner > h1 { margin-bottom: -10px; }
.lede { max-width: 70ch; color: var(--ink-2); }

.key-form { display: flex; gap: 8px; align-items: end; }
.user-form { display: grid; grid-template-columns: 1fr 1fr 150px; gap: 12px; align-items: start; }
.user-form .form-error, .user-form .form-actions { grid-column: 1 / -1; }
.password-row { display: flex; gap: 6px; }
.password-row input { flex: 1; min-width: 0; }
.password-row .btn-icon { height: auto; }
.reveal-credentials { white-space: pre-wrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.user-form-even { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.key-form .field { flex: 1; }

.reveal { padding: 14px 16px; background: var(--wash); border-radius: 4px; display: grid; gap: 8px; }
.reveal code { overflow-wrap: anywhere; font-weight: 600; }
.reveal-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; }

.data-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.data-wrap th:first-child, .data-wrap td:first-child { padding-left: 0; }
.data-wrap th:last-child, .data-wrap td:last-child { padding-right: 0; }
.data-wrap td { vertical-align: middle; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-2); }
.key-revoked td { color: var(--ink-3); }

.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; }
.docs section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.docs p { max-width: 70ch; }
.docs h3 { margin-top: 8px; }
.code-block { position: relative; }
.code-block pre {
  margin: 0;
  padding: 12px 44px 12px 14px;
  background: var(--rail);
  border-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.code-block .btn { position: absolute; top: 6px; right: 6px; }
.method { font-family: var(--mono); font-size: 0.75rem; font-weight: 700; color: var(--blue); }
.method-get { color: var(--ink-2); }
td code { overflow-wrap: anywhere; }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 9px 14px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 6px 20px #12203a33;
}
.toast-error { background: var(--red); }

/* Photos */

.photos { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.photos-head { display: flex; align-items: center; gap: 8px; }
.photos-head .btn { margin-left: auto; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--rail); }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: #12203ad9;
  color: #fff;
  cursor: pointer;
  transition: background-color 150ms;
}
.photo-remove:hover { background: var(--red); }
.photo-remove .icon { width: 14px; height: 14px; }
.photo-remove-armed { width: auto; padding: 0 7px; background: var(--red); font: 700 0.75rem/1 var(--sans); }

.row-photos { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; color: var(--ink-2); font-size: 0.75rem; }
.row-photos .icon { width: 13px; height: 13px; }

.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #fff; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: #0b1426eb; }
.lightbox img { max-width: calc(100vw - 136px); max-height: calc(100dvh - 96px); object-fit: contain; }
.lightbox-count { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); font-size: 0.8125rem; }
.lightbox-btn { position: fixed; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 4px; background: #ffffff1f; color: #fff; cursor: pointer; transition: background-color 150ms; }
.lightbox-btn:hover { background: #ffffff3d; }
.lightbox-btn .icon { width: 22px; height: 22px; }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: calc(50% - 22px); }
.lightbox-next { right: 16px; top: calc(50% - 22px); }
.lightbox :focus-visible { outline-color: #fff; }

.chips { display: none; }

/* Tablet: the detail opens as a sheet over the list */

@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .detail-pane { display: none; }
  .workspace[data-open='true'] .detail-pane {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 100%);
    z-index: 20;
    box-shadow: -10px 0 30px #12203a26;
  }
}

/* Phone: top bar, bottom navigation, cards instead of tables */

@media (max-width: 820px) {
  .app {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: 'brand foot' 'view view' 'nav nav';
  }
  .rail { display: contents; }
  .view { grid-area: view; }

  .brand { grid-area: brand; padding: 8px 16px; background: var(--rail); border-bottom: 1px solid var(--line); }
  .brand-logo { height: 40px; }
  .rail-foot { grid-area: foot; padding: 8px; background: var(--rail); border-top: 0; border-bottom: 1px solid var(--line); }
  .whoami { display: none; }

  .rail-nav {
    grid-area: nav;
    flex-direction: row;
    gap: 0;
    overflow: visible;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--line);
  }
  .rail-filters, .wide-only { display: none; }
  .rail-link {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    color: var(--ink-2);
    font-size: 0.6875rem;
  }
  .rail-link > .icon { width: 21px; height: 21px; }
  .rail-link:hover { background: transparent; }
  .rail-link[aria-current='page'], .rail-link.in-section { background: transparent; color: var(--blue); font-weight: 700; }

  .chips { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
  .chip {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
  }
  .chip[aria-current='page'] { background: var(--blue); border-color: var(--blue); color: #fff; }
  .chip[aria-current='page'] .rail-count { color: #fff; }
  .chip .rail-count { margin-left: 0; }

  .page-head { padding: 14px 16px 10px; }
  .toolbar { padding: 0 16px 10px; }
  .search { max-width: none; }
  .search .icon { top: 14px; }

  .btn-new {
    position: fixed;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 10;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 6px 18px #1e4fd859;
  }
  .btn-new .icon { width: 24px; height: 24px; }
  .btn-new .btn-label { display: none; }

  .list-pane table, .list-pane tbody { display: block; }
  .list-pane thead { display: none; }
  .req-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'code status' 'title title' 'time time';
    gap: 4px 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .req-row td, .req-row td:first-child, .req-row td:last-child { display: block; padding: 0; border: 0; }
  .req-row td.col-priority, .req-row td.col-agent { display: none; }
  .req-row td.col-code { grid-area: code; align-self: center; }
  .req-row td.col-status { grid-area: status; }
  .req-row td.col-title { grid-area: title; min-width: 0; font-size: 0.9375rem; }
  .req-row td.col-time { grid-area: time; }
  .row-note { -webkit-line-clamp: 2; font-size: 0.875rem; margin-top: 3px; }
  .table-wrap { padding-bottom: 84px; }
  .more { padding-bottom: 84px; }

  .workspace[data-open='true'] .detail-pane { width: 100%; box-shadow: none; border-left: 0; }
  .detail-bar { padding: 0 8px 0 16px; }
  .detail-body { padding: 16px 16px 40px; }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-actions .btn { flex: 1; }
  .pick .stamp { padding: 7px 11px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-remove { width: 30px; height: 30px; }

  .btn { height: 44px; }
  .btn-sm { height: 38px; }
  .btn-icon { width: 44px; height: 44px; }
  input, select { height: 44px; }
  input, select, textarea { font-size: 1rem; }

  .page-inner { padding: 18px 16px 32px; }
  .field-row, .user-form { grid-template-columns: minmax(0, 1fr); }
  .key-form { flex-direction: column; align-items: stretch; }
  .user-form .form-actions .btn, .key-form .btn { width: 100%; }

  .data-wrap { overflow: visible; }
  .data-wrap table, .data-wrap tbody { display: block; }
  .data-wrap thead { display: none; }
  .data-wrap tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .data-wrap td, .data-wrap td:first-child, .data-wrap td:last-child { display: block; padding: 2px 0; border: 0; }
  .data-wrap td[data-label] { display: flex; justify-content: space-between; gap: 16px; }
  .data-wrap td[data-label]::before { content: attr(data-label); flex: none; color: var(--ink-2); font-family: var(--sans); }
  .data-wrap .nowrap { white-space: normal; }
  .data-wrap td .btn { width: 100%; margin-top: 8px; }
  .row-actions .btn { flex: 1; width: auto; }

  .lightbox img { max-width: 100vw; max-height: calc(100dvh - 140px); }
  .lightbox-prev, .lightbox-next { top: auto; bottom: 12px; }
  .lightbox-count { bottom: 26px; }

  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); width: max-content; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
