@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=STIX+Two+Text:ital,wght@0,400;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Emil Kowalski Craft Color Tokens */
  --bg-app: #f6f5f2;
  --paper: #ffffff;
  --ink: #18181b;
  --ink-secondary: #52525b;
  --muted: #71717a;
  --muted-light: #a1a1aa;

  --line-subtle: #f0eee9;
  --line: #e4e2dc;
  --line-strong: #d1cdc4;

  --accent: #800000;
  --accent-hover: #6a0000;
  --accent-active: #540000;
  --accent-soft: #fcf4f4;
  --accent-border: #f0d5d5;

  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning: #b45309;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --info: #0369a1;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;

  --error: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  /* Elevation & Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(24, 24, 27, 0.08), 0 4px 12px -2px rgba(24, 24, 27, 0.04);
  --shadow-focus: 0 0 0 3px rgba(128, 0, 0, 0.15);

  /* Transitions & Curves */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 140ms;
  --duration-normal: 220ms;
}

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

html {
  background: var(--bg-app);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[x-cloak] {
  display: none !important;
}

/* Brand Header Container */
.app-header-brand {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px 0;
}

.brand-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand-logo {
  height: 64px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.brand-logo:hover {
  transform: scale(1.02);
}

/* Layout Shell & Paper Card */
.shell {
  max-width: 1540px;
  margin: 0 auto;
  padding: 32px 24px;
}

.paper {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 28px 36px 36px;
  position: relative;
  transition: box-shadow var(--duration-normal) var(--ease-spring);
}

/* Editor Navigation & Test Tabs */
.editor-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin: -6px 0 24px;
  padding-bottom: 2px;
}

.test-tabs {
  display: flex;
  gap: 32px;
}

.test-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 12px 2px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  position: relative;
  transition: color var(--duration-fast) var(--ease-spring), transform var(--duration-fast) var(--ease-spring);
}

.test-tabs button:hover {
  color: var(--ink);
}

.test-tabs button:active {
  transform: scale(0.97);
}

.test-tabs button.active {
  color: var(--ink);
  font-weight: 600;
}

.test-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  animation: tabSlide var(--duration-normal) var(--ease-spring);
}

@keyframes tabSlide {
  from { opacity: 0; transform: scaleX(0.7); }
  to { opacity: 1; transform: scaleX(1); }
}

.dashboard-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  border: 1px solid var(--line-strong);
  background: #faf9f6;
  border-radius: 6px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast) var(--ease-spring);
}

.dashboard-btn:hover {
  background: #ffffff;
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.dashboard-btn:active {
  transform: scale(0.97);
}

/* Dashboard Navigation */
.dashboard-nav {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin: -6px 0 20px;
  padding-bottom: 12px;
}

.back-btn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  border: 1px solid var(--line-strong);
  background: #ffffff;
  border-radius: 6px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--duration-fast) var(--ease-spring);
}

.back-btn:hover {
  background: #faf9f6;
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.back-btn:active {
  transform: scale(0.97);
}

.back-icon {
  font-size: 14px;
  line-height: 1;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.back-btn:hover .back-icon {
  transform: translateX(-2px);
}

/* Header & Brand */
.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand h1 {
  margin: 4px 0 0;
  font-family: "STIX Two Text", Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Actions & Buttons */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.btn {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: background var(--duration-fast) var(--ease-spring),
              border-color var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-spring),
              transform var(--duration-fast) var(--ease-spring);
  user-select: none;
}

.btn:hover {
  background: #fbfbfb;
  border-color: #999;
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: scale(0.98);
  box-shadow: none;
}

.btn.primary {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn.primary:hover {
  background: #27272a;
  border-color: #27272a;
}

.btn.primary:active {
  background: #09090b;
}

.btn.publish {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(128, 0, 0, 0.2);
}

.btn.publish:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.publish:active {
  background: var(--accent-active);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.rule {
  height: 1px;
  background: var(--line);
  margin: 16px 0 24px;
}

/* Dashboard Controls & Table */
.dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 260px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  background: #fafaf9;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
  transition: all var(--duration-fast) var(--ease-spring);
}

.search-input:focus {
  outline: 0;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: var(--shadow-focus);
}

.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-secondary);
}

.filter-group label {
  font-weight: 500;
}

.filter-group select {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  background: #ffffff;
  transition: border-color var(--duration-fast) var(--ease-spring);
}

.filter-group select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-tensile {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.badge-compressive {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-published {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-draft {
  background: #f4f4f5;
  color: #71717a;
  border: 1px solid #e4e4e7;
}

/* Dashboard Table */
.dashboard-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.dashboard-table th {
  background: #faf9f6;
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-row td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line-subtle);
  font-size: 12.5px;
  text-align: center;
  background: #ffffff;
  transition: background var(--duration-fast) var(--ease-spring);
}

.dashboard-row:hover td {
  background: #fbfaf8;
}

.dashboard-row:last-child td {
  border-bottom: 0;
}

/* Status Line */
.status-line {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.status-line > span + span::before {
  content: "·";
  margin-right: 12px;
  color: var(--line-strong);
  font-weight: 700;
}

.doc-status {
  text-transform: capitalize;
  font-weight: 600;
  color: var(--ink);
}

.dirty {
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dirty::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 2s infinite var(--ease-in-out);
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Metadata Form Grid */
.meta-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(550px, 1.4fr);
  gap: 42px;
  margin-bottom: 28px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0;
  color: var(--ink);
}

.section-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  max-width: 520px;
}

.meta-fields {
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 4px;
}

.meta-fields label,
.meta-fields input,
.meta-fields .meta-select {
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.meta-fields label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
}

.meta-fields input {
  outline: 0;
  font-size: 13.5px;
  color: var(--ink);
  background: transparent;
  min-width: 0;
  width: 100%;
  transition: border-color var(--duration-fast) var(--ease-spring);
}

.meta-fields input::placeholder {
  color: var(--muted-light);
}

.meta-select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 13.5px;
  color: var(--ink);
  outline: 0;
  transition: border-color var(--duration-fast) var(--ease-spring);
}

.meta-select:focus,
.meta-fields input:focus {
  border-bottom-color: var(--accent);
}

/* Failure Guide Section */
.failure-guide {
  display: grid;
  grid-template-columns: minmax(240px, 0.55fr) minmax(480px, 1.25fr);
  gap: 36px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  margin: 0 0 28px;
  background: #fafaf8;
  border-radius: 8px;
  padding: 16px 20px;
}

.failure-guide-copy .section-title {
  font-size: 15px;
}

.failure-guide-copy .section-desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.failure-patterns {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 14px;
  align-items: end;
}

.failure-pattern {
  margin: 0;
  text-align: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 4px 4px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-spring),
              border-color var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-spring);
}

.failure-pattern:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}

.failure-pattern img {
  display: block;
  width: 100%;
  height: 76px;
  object-fit: contain;
}

.failure-pattern figcaption {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

/* Data Table Kicker & Table Wrapping */
.section-kicker {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 8px;
}

.row-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  border-radius: 2px;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}

.tensile-table {
  min-width: 1390px;
}

.compressive-table {
  min-width: 928px;
}

.data-table th {
  font-weight: 600;
  text-align: center;
  font-size: 11px;
  line-height: 1.15;
  padding: 8px 4px;
  vertical-align: middle;
  background: #ffffff;
  color: var(--ink);
}

.data-table thead tr:first-child th.group {
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-secondary);
}

.data-table thead tr:last-child th {
  border-bottom: 1px solid var(--ink);
}

.data-table td {
  padding: 0;
  border-bottom: 1px dotted var(--line);
  vertical-align: middle;
  background: #ffffff;
}

.data-table tbody tr.group-end td {
  border-bottom: 1px solid var(--line-strong);
}

.data-table td input,
.data-table td select {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  outline: 0;
  min-height: 33px;
  font-family: "STIX Two Text", Georgia, serif;
  transition: background var(--duration-fast) var(--ease-spring);
}

.data-table td input:focus,
.data-table td select:focus {
  background: #fff9e6;
  box-shadow: inset 0 0 0 1px #d4b16a;
}

.data-table .sample input {
  text-align: left;
  padding-left: 8px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 500;
}

.data-table .row-actions {
  width: 36px;
  text-align: center;
}

.failure-cell select {
  color: var(--accent);
  font-weight: 600;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted-light);
  font-size: 16px;
  line-height: 1;
  padding: 6px;
  border-radius: 4px;
  transition: all var(--duration-fast) var(--ease-spring);
}

.icon-btn:hover {
  color: var(--error);
  background: var(--error-bg);
}

.icon-btn:active {
  transform: scale(0.92);
}

.add-row-cell {
  padding: 10px !important;
  text-align: center;
  border-top: 1px solid var(--line-strong) !important;
  background: #fafaf8 !important;
}

.add-row {
  border: 1px dashed var(--line-strong);
  background: #ffffff;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  border-radius: 6px;
  min-height: 36px;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast) var(--ease-spring);
}

.add-row:hover {
  background: #ffffff;
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.add-row:active {
  transform: scale(0.98);
}

.unit {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  font-size: 10px;
}

/* Feedback Notifications & Errors */
.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info);
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 20, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  animation: fadeIn var(--duration-normal) var(--ease-spring);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(980px, 95vw);
  max-height: 90vh;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalScaleUp var(--duration-normal) var(--ease-spring);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.jsonbox {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  background: #18181b;
  color: #f4f4f5;
  border-radius: 8px;
  padding: 16px;
  overflow: auto;
  white-space: pre;
  flex: 1;
}

/* Verification Card Shell */
.verify-shell {
  max-width: 1100px;
  margin: 36px auto;
  padding: 0 24px;
}

.verify-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 36px;
  box-shadow: var(--shadow-lg);
}

.verify-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.verify-header-info {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.verify-shield-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.verify-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.verify-head .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.verify-title {
  font-family: "STIX Two Text", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
  color: var(--ink);
}

.verify-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 640px;
}

.verify-meta {
  display: grid;
  grid-template-columns: 190px 1fr;
  margin: 20px 0 28px;
  border-top: 1px solid var(--line-subtle);
}

.verify-meta div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line-subtle);
  font-size: 13px;
}

.verify-meta div:nth-child(odd) {
  color: var(--muted);
  font-weight: 500;
}

.verify-meta div:nth-child(even) {
  color: var(--ink);
  font-weight: 600;
}

.hash {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px !important;
  color: var(--accent) !important;
  word-break: break-all;
}

.readonly-table {
  overflow: auto;
  margin-top: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}

.readonly-table table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1200px;
  font-size: 11px;
}

.readonly-compressive table {
  min-width: 860px;
}

.readonly-table th {
  border-bottom: 1px solid var(--line-strong);
  background: #faf9f6;
  padding: 8px 6px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

.readonly-table td {
  border-bottom: 1px solid var(--line-subtle);
  padding: 7px 6px;
  text-align: center;
  background: #ffffff;
  font-family: "STIX Two Text", Georgia, serif;
  font-size: 12px;
}

.readonly-table tr:last-child td {
  border-bottom: 0;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .shell { padding: 16px; }
  .paper { padding: 22px 20px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .meta-grid { grid-template-columns: 1fr; gap: 20px; }
  .meta-fields { grid-template-columns: 130px 1fr; }
  .failure-guide { grid-template-columns: 1fr; gap: 14px; }
  .failure-patterns { max-width: 620px; }
  .verify-head { align-items: flex-start; flex-direction: column; }
  .section-kicker { align-items: flex-start; }
}

@media (max-width: 600px) {
  html { background: #ffffff; }
  .shell { padding: 0; }
  .paper { border: 0; box-shadow: none; border-radius: 0; padding: 18px 16px 28px; }
  .test-tabs { gap: 0; margin: 0 -16px 20px; padding: 0 16px; }
  .test-tabs button { width: 50%; text-align: left; padding: 12px 4px 10px; font-size: 12px; }
  .topbar { gap: 16px; margin-bottom: 16px; }
  .brand h1 { font-size: 24px; }
  .brand p { font-size: 12px; line-height: 1.4; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .actions .btn { width: 100%; min-height: 44px; padding: 10px 8px; font-size: 12px; }
  .rule { margin: 8px 0 18px; }
  .status-line { flex-wrap: wrap; line-height: 1.4; margin-bottom: 16px; }
  .meta-grid { gap: 16px; margin-bottom: 22px; }
  .section-desc { font-size: 12px; line-height: 1.4; }
  .meta-fields { grid-template-columns: 1fr; }
  .meta-fields label { border-bottom: 0; min-height: auto; padding: 10px 0 2px; font-size: 11px; }
  .meta-fields input { min-height: 38px; padding: 4px 0 8px; font-size: 15px; }

  .failure-guide { margin-left: -16px; margin-right: -16px; padding: 14px 16px; gap: 12px; border-radius: 0; }
  .failure-guide-copy .section-desc { max-width: none; }
  .failure-patterns { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .failure-pattern img { height: 60px; }

  .section-kicker { margin-top: 4px; }
  .table-wrap { margin-left: -16px; margin-right: -16px; scrollbar-width: thin; }
  .data-table td input, .data-table td select { font-size: 13px; padding: 10px 4px; min-height: 38px; }

  .tensile-table thead tr:first-child th:first-child,
  .tensile-table thead tr:last-child th:first-child { position: sticky; left: 0; z-index: 4; }
  .tensile-table thead tr:first-child th:nth-child(2),
  .tensile-table thead tr:last-child th:nth-child(2) { position: sticky; left: 42px; z-index: 4; box-shadow: 1px 0 0 var(--line); }
  .tensile-table tbody td:first-child { position: sticky; left: 0; z-index: 2; width: 42px; }
  .tensile-table tbody td:nth-child(2) { position: sticky; left: 42px; z-index: 2; width: 112px; box-shadow: 1px 0 0 var(--line); }

  .compressive-table thead tr:first-child th:first-child,
  .compressive-table tbody td:first-child { position: sticky; left: 0; z-index: 3; background: #fff; box-shadow: 1px 0 0 var(--line); }
  .compressive-table thead tr:first-child th:first-child { z-index: 4; }

  .icon-btn { min-width: 38px; min-height: 38px; }
  .add-row { min-height: 42px; }

  .modal-backdrop { padding: 0; }
  .modal { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; padding: 16px; }
  .modal-head { gap: 10px; align-items: flex-start; }
  .modal-head .actions { width: auto; display: flex; }
  .modal-head .actions .btn { width: auto; min-height: 38px; }
  .jsonbox { font-size: 11px; padding: 12px; }

  .verify-shell { margin: 0; padding: 0; }
  .verify-card { border: 0; box-shadow: none; border-radius: 0; padding: 22px 16px; min-height: 100dvh; }
  .verify-title { font-size: 20px; }
  .verify-head .btn { min-height: 42px; }
  .verify-meta { grid-template-columns: 110px minmax(0, 1fr); margin: 18px 0; }
  .verify-meta div { font-size: 12px; padding: 8px 0; }
  .readonly-table { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .readonly-table tbody td:first-child { position: sticky; left: 0; background: #fff; z-index: 2; }
  .readonly-table tbody td:nth-child(2) { position: sticky; left: 33px; background: #fff; z-index: 2; box-shadow: 1px 0 0 var(--line); }
  .readonly-compressive tbody td:nth-child(2) { position: static; box-shadow: none; }
}

@media print {
  html { background: #ffffff; }
  .shell { max-width: none; padding: 0; }
  .paper { border: 0; box-shadow: none; padding: 0; }
  .test-tabs, .actions, .status-line, .row-actions, .add-row-cell, .error, .notice, .dashboard-controls { display: none !important; }
  .meta-grid { grid-template-columns: 0.8fr 1.4fr; }
  .failure-guide { grid-template-columns: 0.55fr 1.25fr; }
  .table-wrap { overflow: visible; margin: 0; }
  .data-table { min-width: 0; }
  .data-table thead th, .data-table tbody td:first-child, .data-table tbody td:nth-child(2) { position: static; box-shadow: none; }
}
