@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #18181B;
  --muted: #71717A;
  --accent: #0EA5E9;
  --accent-soft: rgba(14, 165, 233, 0.08);
  --success: #10B981;
  --danger: #EF4444;
  --border: #E4E4E7;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

.build-stamp {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.build-logo {
  width: 20px;
  height: 20px;
  display: block;
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 80px 24px 120px;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 40px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  background: var(--ink);
  color: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 12px;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.chat-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.line {
  display: inline-flex;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
}

.line.user {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.prompt-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.prompt-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.prompt-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  transition: border-color 0.2s ease;
}

.prompt-input:focus-within {
  border-bottom-color: var(--accent);
}

.prompt-input input {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
}

.prompt-input input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.toggle {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.toggle:hover {
  background: var(--accent-soft);
}

.prompt-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.primary,
.secondary {
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.primary {
  background: var(--accent);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.primary:hover {
  background: #0284C7;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.primary:active {
  transform: translateY(0);
}

.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.secondary:hover {
  background: var(--bg);
  border-color: var(--ink);
}

.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.ghost-link:hover {
  color: var(--ink);
}

.field-error,
.notice {
  font-size: 13px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  line-height: 1.5;
}

.notice {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(14, 165, 233, 0.2);
}

.notice.error {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.panel {
  padding: 40px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.panel-title {
  margin: 16px 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-subtitle {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.status-line {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 15px;
}

.status-detail {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.inline-form {
  margin-bottom: 16px;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.device-card,
.cal-card {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  animation: fadeIn 0.3s ease both;
  animation-delay: var(--delay, 0s);
  transition: all 0.2s ease;
}

.device-card:hover,
.cal-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-title {
  font-weight: 600;
  font-size: 15px;
}

.card-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.criterion-note {
  font-size: 10px;
  line-height: 1.2;
  margin-top: 6px;
}

.doc-panel {
  margin-bottom: 24px;
}

.page-document {
  max-width: none;
  padding: 48px 0 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-document .doc-panel {
  width: 210mm;
  height: 297mm;
  margin: 0 auto 16px;
  padding: 10mm;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
  --doc-qr-left: 14mm;
  --doc-qr-bottom: 30mm;
  --doc-qr-size: 26mm;
  --doc-qr-safe-left: 32mm;
}

.page-document .doc-panel::before {
  content: "";
  position: absolute;
  left: var(--doc-qr-left, 10mm);
  bottom: var(--doc-qr-bottom, 20mm);
  width: var(--doc-qr-size, 24mm);
  height: var(--doc-qr-size, 24mm);
  background-image: var(--doc-qr-url, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

.page-document .doc-panel::after {
  content: "";
  position: absolute;
  right: 2mm;
  bottom: 10mm;
  width: 60mm;
  height: 60mm;
  background: var(--doc-stamp-url, url("/sello/sello_ecdsl_v2b.png")) no-repeat center / contain;
  opacity: 0.8;
  pointer-events: none;
}

.page-document {
  line-height: 1.45;
}

.page-document .doc-back {
  width: 210mm;
  margin: 0 auto;
  text-align: left;
}

.page-document .doc-hero {
  padding: 10px;
  margin-bottom: 10px;
}

.page-document .doc-title {
  font-size: 15px;
}

.page-document .doc-meta {
  font-size: 10px;
  gap: 6px;
}

.page-document .status-pill {
  font-size: 8px;
  padding: 2px 6px;
}

.page-document .doc-grid {
  gap: 8px;
  margin-bottom: 10px;
}

.page-document .doc-card {
  padding: 8px;
}

.page-document .doc-card h3 {
  font-size: 8px;
}

.page-document .doc-card .value {
  font-size: 14px;
}

.page-document .doc-section {
  margin-bottom: 10px;
}

.page-document .doc-section h2 {
  font-size: 12px;
  margin-bottom: 4px;
}

.page-document .evidence-item {
  padding: 6px;
  border: 1px solid var(--border);
  box-shadow: none;
}

.page-document .evidence-item img {
  height: 86px;
  object-fit: contain;
  background: #fff;
  border: none;
}

.page-document .doc-card > svg {
  height: 88px;
}

.chart-wide {
  width: 100%;
  aspect-ratio: 8 / 1;
}

.chart-wide svg {
  width: 100%;
  height: 100%;
  display: block;
}

.doc-card .chart-wide {
  margin-bottom: 0;
}

.doc-card .chart-wide + .card-meta {
  margin-top: 0;
  line-height: 1.2;
}

.chart-card {
  padding-bottom: 6px;
  padding-top: 0;
}

.chart-card .chart-wide {
  margin-bottom: 0;
  line-height: 0;
  display: block;
}

.chart-card .card-meta {
  margin-top: 0;
  line-height: 1.2;
}

.page-document .doc-card svg {
  display: block;
  width: 100%;
  height: 88px;
}

.doc-hero {
  display: grid;
  gap: 12px;
  padding: 28px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.doc-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.doc-title-model {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.page-document .doc-meta {
  justify-content: space-between;
  gap: 0;
  width: 100%;
}

.page-document .doc-meta span {
  flex: 1 1 0;
}

.page-document .doc-meta span:nth-child(2) {
  text-align: center;
}

.page-document .doc-meta span:nth-child(3) {
  text-align: right;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-pill.fail {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.doc-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.doc-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-card {
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.doc-card:hover {
  border-color: var(--muted);
}

.doc-card h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.doc-card .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc-section {
  margin-bottom: 32px;
}

.doc-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-document .doc-footer .doc-grid {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
  padding-left: calc(16px + var(--doc-qr-safe-left, 32mm));
  border: 1px dashed var(--border);
}

.point-list details {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 14px 18px;
  background: var(--surface);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.point-list details:hover {
  border-color: var(--muted);
}

.point-list summary {
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}

.point-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.doc-table {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface);
}

.doc-table-head,
.doc-table-row {
  display: grid;
  grid-template-columns: 0.5fr 1fr 1fr 0.9fr 0.9fr 1.4fr;
  gap: 10px;
  align-items: center;
}

.doc-table-head {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.doc-table-row {
  font-size: 11px;
  color: var(--ink);
  padding: 2px 0;
}

.doc-table-meta {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.4;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.evidence-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.evidence-item {
  padding: 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  gap: 12px;
  transition: all 0.2s ease;
}

.evidence-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.evidence-item img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.loading {
  font-size: 14px;
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

.doc-back {
  margin-left: 8px;
}

.admin-page {
  max-width: 1280px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.admin-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.admin-meta-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.admin-meta-role {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: center;
}

.admin-status {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.admin-toolbar input,
.admin-toolbar select {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.admin-toolbar input:focus,
.admin-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 20px;
  display: grid;
  gap: 18px;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-card-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  text-transform: none;
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.admin-field-notes button {
  align-self: flex-start;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-tab {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.admin-tab:hover {
  background: var(--bg);
  border-color: var(--muted);
}

.admin-tab.is-active {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}

.admin-tab-panel {
  display: grid;
  gap: 16px;
}

.admin-tab-panel[hidden] {
  display: none;
}

.admin-tab-panel.is-hidden {
  display: none !important;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.admin-row:hover {
  border-color: var(--muted);
}

.admin-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.admin-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  font-weight: 700;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr {
  transition: background-color 0.15s ease;
}

.admin-table tbody tr:hover {
  background: var(--bg);
}

.admin-table tbody tr.is-invalid {
  background: rgba(239, 68, 68, 0.08);
}

.admin-table tbody tr.is-warning {
  background: rgba(245, 158, 11, 0.08);
}

.admin-table input[type="text"],
.admin-table select,
.admin-table textarea {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.admin-table input[type="text"]:focus,
.admin-table select:focus,
.admin-table textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-table input[type="checkbox"] {
  transform: scale(1.15);
  cursor: pointer;
}

.admin-table .card-meta {
  margin-top: 4px;
}

.admin-notes-cell {
  display: grid;
  gap: 10px;
}

.cell-serial a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.cell-serial a:hover {
  color: var(--accent);
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-record-summary {
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  color: var(--muted);
}

.admin-record-grid,
.admin-record-stack {
  display: grid;
  gap: 24px;
  align-items: start;
}

.admin-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  border: 1px solid rgba(15, 23, 42, 0.2);
}

.admin-json-sections {
  display: grid;
  gap: 16px;
}

.admin-json-container {
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100%;
}

.admin-json-section .card-title {
  margin-bottom: 8px;
}

.admin-record-grid > section,
.admin-record-stack > section {
  min-width: 0;
}

.admin-evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.admin-evidence-item {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  background: var(--surface);
  display: grid;
  gap: 10px;
}

.admin-evidence-item img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.admin-template-editor {
  display: grid;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.admin-template-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.admin-code {
  width: 100%;
  min-height: 320px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 12px;
  line-height: 1.5;
  background: #0b1220;
  color: #e2e8f0;
  resize: vertical;
  overflow: auto;
}

.admin-status.error {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.admin-label {
  display: grid;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.admin-label input {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s ease;
}

.admin-label input:focus {
  outline: none;
  border-color: var(--accent);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 48px 20px 80px;
  }

  .chat-shell,
  .panel {
    padding: 28px;
  }

  .panel-title {
    font-size: 24px;
  }

  .prompt-input input {
    font-size: 18px;
  }

  .doc-title {
    font-size: 20px;
  }

  .doc-grid {
    grid-template-columns: 1fr;
  }

  .admin-meta {
    align-items: flex-start;
  }

  .admin-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-record-grid,
  .admin-record-stack {
    grid-template-columns: 1fr;
  }

  .list-grid {
    grid-template-columns: 1fr;
  }

  .page-document {
    padding: 32px 16px 60px;
    align-items: stretch;
  }

  .page-document .doc-panel {
    width: 100%;
    min-height: auto;
    padding: 24px;
  }

  .page-document .doc-back {
    width: 100%;
  }

  .doc-grid-2,
  .doc-grid-3,
  .evidence-grid-3,
  .doc-table-head,
  .doc-table-row {
    grid-template-columns: 1fr;
  }
}

@page {
  size: A4;
  margin: 0mm;
}

@media print {
  :root {
    --bg: #ffffff;
  }

  html,
  body {
    background: #ffffff;
    margin: 0;
    color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .build-stamp,
  .doc-back {
    display: none !important;
  }

  .page {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .panel {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .page-document {
    padding: 0;
    align-items: stretch;
  }

  .page-document .doc-panel {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 10mm;
    border: none;
    box-shadow: none;
  }

  .page-document .doc-panel::after {
    right: 8mm;
    bottom: 10mm;
    width: 60mm;
    height: 60mm;
    opacity: 0.8;
  }

  .doc-panel {
    margin: 0;
  }

  .doc-hero {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
  }

  .doc-title {
    font-size: 18px;
  }

  .doc-meta {
    font-size: 11px;
    gap: 8px;
  }

  .status-pill {
    font-size: 10px;
    padding: 4px 8px;
  }

  .doc-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
  }

  .doc-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .doc-card {
    padding: 12px;
    border-radius: 8px;
  }

  .doc-card h3 {
    font-size: 10px;
  }

  .doc-card .value {
    font-size: 18px;
  }

  .doc-section {
    margin-bottom: 16px;
  }

  .doc-section h2 {
    margin-bottom: 8px;
    font-size: 14px;
  }

  .point-grid {
    gap: 6px;
    font-size: 11px;
  }

  .doc-table {
    padding: 8px;
  }

  .doc-table-head,
  .doc-table-row {
    grid-template-columns: 0.5fr 1fr 1fr 0.9fr 0.9fr 1.4fr;
    gap: 8px;
  }

  .doc-table-head {
    font-size: 8px;
  }

  .doc-table-row {
    font-size: 10px;
  }

  .doc-table-meta {
    font-size: 8px;
  }

  .evidence-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .evidence-item {
    padding: 10px;
    border-radius: 8px;
  }

  .evidence-item img {
    border-radius: 6px;
    height: 86px;
    object-fit: contain;
  }

  .doc-footer .doc-grid {
    padding: 10px;
    padding-left: calc(10px + var(--doc-qr-safe-left, 32mm));
  }

  .chat-lines {
    gap: 8px;
  }

  .line {
    font-size: 11px;
    padding: 6px 10px;
  }

  .chart-wide {
    aspect-ratio: 8 / 1;
  }

  .chart-wide svg {
    height: 100%;
  }

  svg {
    height: 88px;
  }
}
