:root {
  color-scheme: light;
  --paper: #f2efe6;
  --paper-bright: #fffdf7;
  --paper-deep: #dfdbcf;
  --ink: #111413;
  --ink-soft: #343a37;
  --muted: #66706b;
  --red: #cc382f;
  --red-dark: #99271f;
  --teal: #087965;
  --teal-dark: #045346;
  --blue: #2d68ad;
  --yellow: #f2bd46;
  --line: #111413;
  --line-soft: #bdb9ae;
  --danger: #b72f2a;
  --warning: #9b6200;
  --shadow: 8px 8px 0 var(--ink);
  --shadow-small: 4px 4px 0 var(--ink);
  --font-display: Bahnschrift, "Arial Narrow", "Microsoft YaHei UI", sans-serif;
  --font-ui: Inter, "Segoe UI", "Microsoft YaHei UI", Arial, sans-serif;
  --font-mono: "Cascadia Code", Consolas, monospace;
  font-family: var(--font-ui);
}

*, *::before, *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] { display: none !important; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--font-ui);
  isolation: isolate;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("manga-halftone.png");
  content: "";
  pointer-events: none;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .52; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.login-view {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(390px, .72fr);
  align-items: center;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(28px, 4vw, 64px);
  background: var(--ink);
}

.login-view::before {
  position: absolute;
  inset: clamp(24px, 3.2vw, 52px) 35% clamp(24px, 3.2vw, 52px) clamp(24px, 3.2vw, 52px);
  border: 5px solid var(--paper-bright);
  background: var(--paper) url("manga-control.png") center / cover no-repeat;
  box-shadow: 14px 14px 0 var(--red);
  content: "";
}

.login-view::after {
  position: absolute;
  top: 9%;
  left: 3%;
  width: clamp(180px, 24vw, 420px);
  height: 18px;
  background: var(--blue);
  content: "";
  transform: rotate(-7deg);
}

.login-panel {
  position: relative;
  z-index: 1;
  grid-column: 2;
  width: min(440px, 100%);
  margin-left: auto;
  padding: clamp(30px, 4vw, 48px);
  border: 5px solid var(--ink);
  border-radius: 0;
  background: var(--paper-bright);
  box-shadow: 14px 14px 0 var(--red);
}

.login-panel::before {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 92px;
  height: 28px;
  border: 4px solid var(--ink);
  background: var(--yellow);
  content: "V2 / 02";
  font: 900 11px/20px var(--font-mono);
  text-align: center;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 0;
  background: var(--red);
  color: var(--paper-bright);
  box-shadow: var(--shadow-small);
  font: 900 16px/1 var(--font-display);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-width: 3px;
  box-shadow: 3px 3px 0 var(--paper-bright);
  font-size: 11px;
}

.eyebrow {
  margin: 24px 0 5px;
  color: var(--teal);
  font: 900 11px/1.2 var(--font-mono);
  text-transform: uppercase;
}

.login-panel h1,
.workspace-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.05;
}

.login-panel h1 { font-size: clamp(31px, 4vw, 43px); }

.segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 30px 0 22px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--paper-deep);
}

.segment-button {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 850;
}

.segment-button + .segment-button { border-left: 3px solid var(--ink); }
.segment-button:hover { background: var(--paper-bright); }
.segment-button.active { background: var(--ink); color: var(--paper-bright); }

.form-stack,
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.wide { grid-column: 1 / -1; }

label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper-bright);
  color: var(--ink);
  outline: 0;
  padding: 11px 12px;
  transition: box-shadow 140ms, transform 140ms, background-color 140ms;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover { background: #fff; }

input:focus,
select:focus,
textarea:focus {
  background: #fff;
  box-shadow: 4px 4px 0 var(--teal);
  transform: translate(-1px, -1px);
}

.primary,
.secondary,
.text-button {
  min-height: 42px;
  padding: 9px 15px;
  border-radius: 0;
  font-weight: 900;
  white-space: nowrap;
  transition: box-shadow 120ms, transform 120ms, background-color 120ms, color 120ms;
}

.primary {
  border: 3px solid var(--ink);
  background: var(--red);
  color: var(--paper-bright);
  box-shadow: var(--shadow-small);
}

.primary:hover:not(:disabled) { background: var(--red-dark); }

.secondary {
  border: 2px solid var(--ink);
  background: var(--paper-bright);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.secondary:hover:not(:disabled) { background: var(--yellow); }

.primary:active:not(:disabled),
.secondary:active:not(:disabled) {
  box-shadow: 0 0 0 transparent;
  transform: translate(3px, 3px);
}

.text-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 5px 8px;
}

.text-button:hover { background: var(--red); color: var(--paper-bright); }

.inline-form {
  display: flex;
  align-items: end;
  gap: 10px;
}

.inline-form input { min-width: 0; }
.inline-form button { flex: 0 0 auto; }

.card-source {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  height: 100vh;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 16px;
  border-right: 5px solid var(--ink);
  background: var(--ink);
  color: var(--paper-bright);
}

.sidebar::after {
  position: absolute;
  right: -28px;
  bottom: 34px;
  width: 170px;
  height: 170px;
  border: 18px solid var(--red);
  border-radius: 50%;
  background-image: url("manga-halftone.png");
  content: "";
  opacity: .72;
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  min-height: 58px;
  gap: 13px;
  padding: 0 7px 14px;
  border-bottom: 2px solid #4d5451;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand strong {
  overflow: hidden;
  font: 900 16px/1.15 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  color: #aeb6b2;
  font: 700 9px/1.2 var(--font-mono);
  text-transform: uppercase;
}

.sidebar nav {
  position: relative;
  z-index: 1;
  display: grid;
  counter-reset: manga-nav;
  gap: 5px;
  margin-top: 22px;
}

.nav-button {
  position: relative;
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  align-items: center;
  min-height: 43px;
  padding: 7px 10px;
  border: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #c5ccc8;
  text-align: left;
  counter-increment: manga-nav;
}

.nav-button::before {
  color: #77817c;
  content: counter(manga-nav, decimal-leading-zero);
  font: 800 10px/1 var(--font-mono);
}

.nav-button::after {
  position: absolute;
  top: 7px;
  right: -18px;
  bottom: 7px;
  width: 6px;
  background: var(--red);
  content: "";
  opacity: 0;
}

.nav-button:hover {
  border-color: #606965;
  background: #252a28;
  color: #fff;
}

.nav-button.active {
  border-color: var(--paper-bright);
  background: var(--paper-bright);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--red);
  transform: translate(-2px, -2px);
}

.nav-button.active::before { color: var(--red); }
.nav-button.active::after { opacity: 1; }

.session-block {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 15px 7px 4px;
  border-top: 2px solid #4d5451;
  color: #dce2df;
  font: 700 11px/1.3 var(--font-mono);
}

.session-block > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  width: 100%;
  min-width: 0;
  padding: 0 clamp(18px, 3vw, 46px) 72px;
  overflow-x: hidden;
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  border-bottom: 5px solid var(--ink);
  background: rgba(242, 239, 230, .96);
}

.workspace-header::after {
  position: absolute;
  right: 0;
  bottom: -5px;
  width: clamp(70px, 12vw, 180px);
  height: 5px;
  background: var(--red);
  content: "";
}

.workspace-header .eyebrow { margin: 0 0 5px; }
.workspace-header h1 { font-size: clamp(26px, 3vw, 37px); }

.view {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 24px;
  padding-top: 37px;
}

.view::before {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 108px;
  padding: 5px 11px;
  border: 2px solid var(--ink);
  background: var(--blue);
  color: #fff;
  content: attr(data-chapter);
  font: 900 10px/1.2 var(--font-mono);
  text-align: center;
}

.view::after {
  position: absolute;
  top: 8px;
  left: 103px;
  width: 48px;
  height: 5px;
  background: var(--red);
  content: "";
  transform: rotate(-8deg);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .78fr);
  gap: 24px;
}

.panel {
  position: relative;
  min-width: 0;
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--paper-bright);
  box-shadow: var(--shadow);
}

.panel::before {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 68px;
  height: 7px;
  background: var(--teal);
  content: "";
}

.panel.compact {
  border-color: var(--ink);
  background: var(--ink-soft);
  color: var(--paper-bright);
  box-shadow: 8px 8px 0 var(--teal);
}

.panel.compact::before { background: var(--yellow); }
.panel.compact label { color: #e1e6e3; }
.panel.compact input,
.panel.compact select,
.panel.compact textarea { border-color: var(--paper-bright); }

.panel.compact .secondary {
  border-color: var(--paper-bright);
  box-shadow: 3px 3px 0 var(--paper-bright);
}

.panel > h2,
.section-heading h2 {
  margin: 0;
  font: 900 18px/1.2 var(--font-display);
}

.panel > h2 {
  display: inline-block;
  margin: 0 0 20px;
  padding: 4px 9px;
  background: var(--ink);
  color: var(--paper-bright);
}

.panel.compact > h2 { background: var(--paper-bright); color: var(--ink); }
.panel.compact > h2:not(:first-child) { margin-top: 28px; }

.section-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--ink);
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  scrollbar-color: var(--red) var(--paper-deep);
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 12px 13px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  text-align: left;
}

th:last-child,
td:last-child { border-right: 0; }
tr:last-child td { border-bottom: 0; }

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink);
  color: var(--paper-bright);
  font-weight: 900;
}

tbody tr:nth-child(even) { background: #f1eee5; }
tbody tr:hover { background: #f8e4a9; }

.empty {
  padding: 42px 22px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.list {
  display: grid;
  margin-top: 16px;
  border-top: 2px solid currentColor;
}

.list-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid currentColor;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #d9f0e8;
  color: var(--teal-dark);
  font: 900 10px/1 var(--font-mono);
  box-shadow: 2px 2px 0 var(--ink);
}

.badge.warn { background: #ffe4a3; color: var(--warning); }
.badge.error { background: #ffd5d1; color: var(--danger); }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 3px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: var(--shadow);
}

.panel .summary-strip {
  margin-bottom: 22px;
  box-shadow: 5px 5px 0 var(--teal);
}

.summary-item {
  position: relative;
  min-width: 0;
  padding: 21px 19px;
  border-right: 2px solid var(--ink);
}

.summary-item::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 6px;
  background: var(--red);
  content: "";
}

.summary-item:nth-child(2n)::before { background: var(--teal); }
.summary-item:last-child { border-right: 0; }
.summary-item strong { display: block; margin-top: 7px; font: 900 29px/1 var(--font-display); }
.summary-item span { color: var(--muted); font-size: 11px; font-weight: 800; }

.secret-output {
  display: block;
  margin-top: 15px;
  padding: 13px;
  overflow-wrap: anywhere;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: var(--shadow-small);
  font: 700 11px/1.5 var(--font-mono);
}

.section-note { color: var(--muted); font-size: 12px; font-weight: 700; }

.work-queue { display: grid; gap: 10px; }
.work-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px; border: 2px solid var(--ink); background: var(--paper-bright); }
.work-item strong, .work-item span { display: block; }
.work-item span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.stock-filters { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(130px, 1fr)); gap: 12px; margin: 18px 0 12px; }
.audit-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.audit-filter-actions { display: flex; align-items: end; gap: 10px; }
.audit-list { display: grid; border: 2px solid var(--ink); background: #fff; }
.audit-list article { display: grid; grid-template-columns: 150px minmax(160px, 1fr) minmax(180px, 1fr) minmax(0, 2fr); gap: 12px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
.audit-list article:last-child { border-bottom: 0; }
.audit-list time, .audit-list small { color: var(--muted); font: 700 11px/1.4 var(--font-mono); overflow-wrap: anywhere; }
.audit-list strong, .audit-list span { overflow-wrap: anywhere; }
.audit-pagination { display: flex; justify-content: center; margin-top: 16px; }
.selection-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; padding: 10px 12px; border: 2px solid var(--ink); background: var(--yellow); font-weight: 800; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-label input, td input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal); }
.batch-preview { display: grid; gap: 7px; max-height: 160px; overflow: auto; padding: 11px; border: 2px dashed var(--ink); background: var(--paper-bright); color: var(--ink-soft); font: 700 12px/1.4 var(--font-mono); }

.action-dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 4px solid var(--ink); border-radius: 0; background: var(--paper); box-shadow: 10px 10px 0 var(--red); }
.action-dialog::backdrop { background: rgb(17 20 19 / .62); }
.action-dialog form { padding: 24px; }
.action-dialog h2 { margin: 0; font-family: var(--font-display); font-size: 24px; }
.dialog-summary { margin: 0; padding: 11px; border-left: 5px solid var(--teal); background: var(--paper-bright); color: var(--ink-soft); font-weight: 750; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 17px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--teal);
  color: #fff;
  box-shadow: 6px 6px 0 var(--ink);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) rotate(-1deg);
  transition: opacity 160ms, transform 160ms;
}

.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); }

@media (max-width: 1120px) {
  .split-layout { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr); }
  .workspace { padding-inline: 26px; }
}

@media (max-width: 900px) {
  .login-view {
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
    padding: 26px;
  }

  .login-view::before { inset: 26px 26px 39% 26px; }
  .login-panel { grid-column: 1; width: min(500px, 100%); margin: 0 0 0 auto; padding: 30px; }

  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }

  .sidebar {
    position: sticky;
    height: auto;
    min-height: 0;
    padding: 10px 14px 12px;
    border-right: 0;
    border-bottom: 4px solid var(--ink);
  }

  .sidebar::after { display: none; }
  .brand { width: fit-content; min-height: 44px; padding: 0; border: 0; }

  .sidebar nav {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 7px;
    order: 3;
    margin-top: 10px;
    overflow-x: auto;
    padding: 2px 4px 7px 2px;
    scrollbar-width: thin;
  }

  .nav-button {
    display: inline-flex;
    min-width: max-content;
    min-height: 39px;
    gap: 8px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .nav-button::after { display: none; }

  .session-block {
    position: absolute;
    top: 13px;
    right: 14px;
    max-width: 48%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .workspace { padding: 0 17px 46px; }
  .workspace-header { min-height: 88px; margin-bottom: 20px; }
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(-n + 2) { border-bottom: 2px solid var(--ink); }
  .stock-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .login-view { align-items: center; padding: 16px; }
  .login-view::before { inset: 16px 16px auto; height: 34%; opacity: .68; }
  .login-view::after { top: 4%; left: -10%; width: 58%; }
  .login-panel { margin-top: 23vh; padding: 28px 20px 24px; box-shadow: 8px 8px 0 var(--red); }
  .login-panel::before { width: 76px; }
  .login-panel h1 { font-size: 31px; }
  .brand-mark { width: 50px; height: 50px; }

  .brand-subtitle { display: none; }
  .session-block { max-width: 57%; }
  .session-block > span { max-width: 120px; }
  .workspace-header { align-items: center; gap: 12px; }
  .workspace-header h1 { font-size: 25px; }
  .workspace-header .secondary { min-height: 38px; padding-inline: 11px; }

  .view { gap: 18px; padding-top: 35px; }
  .view::after { width: 34px; }
  .panel { padding: 17px 14px; box-shadow: 5px 5px 0 var(--ink); }
  .panel.compact { box-shadow: 5px 5px 0 var(--teal); }
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .section-heading .secondary { min-height: 36px; }
  .form-grid,
  .card-source { grid-template-columns: minmax(0, 1fr); }
  .wide { grid-column: auto; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .work-item, .selection-bar { align-items: stretch; flex-direction: column; }
  .work-item .secondary { width: 100%; }
  .stock-filters { grid-template-columns: minmax(0, 1fr); }
  .audit-filters { grid-template-columns: minmax(0, 1fr); }
  .audit-filter-actions { align-items: stretch; }
  .audit-filter-actions button { flex: 1; }
  .audit-list article { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 13px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }

  .summary-strip { grid-template-columns: minmax(0, 1fr); box-shadow: 5px 5px 0 var(--ink); }
  .summary-item { border-right: 0; border-bottom: 2px solid var(--ink); }
  .summary-item:last-child { border-bottom: 0; }
  .summary-item strong { font-size: 26px; }

  th, td { padding: 11px 10px; }
  .toast { top: 14px; right: 14px; }
}

@media (max-width: 360px) {
  .login-view::before { height: 29%; }
  .login-panel { margin-top: 16vh; padding: 20px 16px 18px; }
  .login-panel .brand-mark { width: 46px; height: 46px; }
  .login-panel .eyebrow { margin-top: 18px; }
  .login-panel .segment { margin: 24px 0 18px; }
  .sidebar { padding-inline: 10px; }
  .brand { gap: 9px; }
  .brand strong { font-size: 14px; }
  .session-block > span { max-width: 84px; }
  .workspace { padding-inline: 12px; }
  .workspace-header h1 { font-size: 22px; }
  .panel { padding-inline: 11px; }
}

@media (prefers-reduced-motion: no-preference) {
  .view:not([hidden]) { animation: panel-enter 220ms ease-out both; }
  .nav-button { transition: background-color 120ms, color 120ms, box-shadow 120ms, transform 120ms; }
}

@keyframes panel-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.login-language {
  position: absolute;
  top: clamp(24px, 3vw, 48px);
  right: clamp(24px, 3vw, 48px);
  z-index: 3;
}

.locale-switch {
  display: inline-flex;
  border: 3px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: var(--shadow-small);
}

.locale-switch button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: 850 11px/1 var(--font-ui);
}

.locale-switch button + button { border-left: 2px solid var(--ink); }
.locale-switch button[aria-pressed="true"] { background: var(--yellow); }
.locale-switch.compact { border-width: 2px; box-shadow: none; }
.locale-switch.compact button { min-height: 27px; padding-inline: 7px; color: var(--ink); }
.segment-button { display: grid; place-items: center; }

.job-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, .45fr));
  gap: 12px;
  margin: 0 0 16px;
}

.dynamic-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dynamic-fields .card-contract-segment {
  grid-column: 1 / -1;
  margin: 0;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check-field input { width: 19px; height: 19px; accent-color: var(--teal); }

.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  background: var(--paper-deep);
  font: 800 10px/1 var(--font-mono);
}

.status-running,
.status-confirming { background: #c9ddf3; }
.status-succeeded { background: #b9dfd4; }
.status-failed,
.status-cancelled { background: #f2b9b4; }
.status-outcome_unknown { background: var(--yellow); }

.detail-grid {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  margin: 0;
  border: 2px solid var(--ink);
  background: var(--paper-bright);
}

.detail-grid dt,
.detail-grid dd { min-width: 0; margin: 0; padding: 9px 11px; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.detail-grid dt { color: var(--muted); font-weight: 800; }
.detail-grid dd { font-family: var(--font-mono); font-size: 11px; }
.danger-button { min-height: 42px; padding: 0 16px; border: 3px solid var(--ink); border-radius: 0; background: var(--red); color: #fff; box-shadow: var(--shadow-small); font-weight: 900; }
.event-list { display: grid; gap: 0; margin: 0; padding: 0; border: 2px solid var(--ink); list-style: none; background: var(--paper-bright); }
.event-list li { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 10px; border-bottom: 1px solid var(--line-soft); }
.event-list li:last-child { border-bottom: 0; }
.event-list time { color: var(--muted); font: 700 10px/1.4 var(--font-mono); }
.event-list code { grid-column: 1 / -1; overflow-wrap: anywhere; font-size: 11px; }

@media (max-width: 720px) {
  .job-filters,
  .dynamic-fields { grid-template-columns: minmax(0, 1fr); }
  .login-language { top: 18px; right: 18px; }
  .session-block > span { display: none; }
}

.toast { top: auto; bottom: 22px; }

@media (max-width: 560px) {
  .toast { top: auto; right: 14px; bottom: 14px; }
  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }
  .nav-button { width: 100%; min-width: 0; white-space: normal; }
  .nav-button.active { transform: none; }
  .nav-button:last-child { grid-column: 1 / -1; }
}
