:root { --ink: #16202a; --muted: #5b6875; --line: #dde3e9; --accent: #145c8f; --bg: #f4f6f8; }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; color: var(--ink); background: var(--bg); }
header { background: var(--ink); padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: space-between; }
header a { color: #fff; }
[hidden] { display: none !important; }
#code { font: inherit; padding: 8px; margin: 0 8px 8px 0; max-width: 100%; }
.brand { font-weight: 700; text-decoration: none; }
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
footer { text-align: center; color: var(--muted); padding: 24px 16px; font-size: 14px; }
h1 { line-height: 1.2; }
.actions { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card, .stat, .document { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.card { padding: 4px 20px 20px; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.button { display: inline-block; border: 1px solid var(--accent); border-radius: 6px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; padding: 8px 16px; }
.button.secondary { background: #fff; color: var(--accent); }
.button:disabled { opacity: .5; cursor: default; }
.error { color: #a4161a; }
.notice { background: #fff4d6; padding: 8px 12px; border-radius: 6px; }
.hint, small { color: var(--muted); font-size: 13px; }
progress { width: 100%; }
.stats { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 12px; }
.stat { padding: 10px 12px; display: flex; flex-direction: column; }
.stat strong { font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { background: #e4ebf1; border-radius: 99px; padding: 2px 10px; font-size: 14px; }
.documents { list-style: none; padding: 0; display: grid; gap: 8px; }
.document { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 10px 14px;
  display: grid; gap: 4px 12px; grid-template-columns: 230px 1fr 110px 110px 80px; border-left-width: 6px; }
.document.approved { border-left-color: #2e7d46; }
.document.deviation { border-left-color: #d98a00; }
.document.review { border-left-color: #6a5acd; }
.supplier { font-weight: 600; }
dialog { width: min(1300px, 96vw); max-height: 94vh; border: 0; border-radius: 10px; padding: 0; }
dialog::backdrop { background: rgb(0 0 0 / 55%); }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 16px;
  position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; }
.preview img { width: 100%; border: 1px solid var(--line); margin-top: 8px; }
.comparison { min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 6px 4px; }
td span, td small, td em { display: block; }
td.marked { background: #fdecc8; }
td em { font-size: 12px; font-weight: 700; font-style: normal; color: #8a4b00; }
textarea { width: 100%; font: 14px/1.45 system-ui, sans-serif; padding: 10px; margin-bottom: 8px; }
.ms-card { display: block; margin: 20px 0; padding: 20px 24px; border: 4px solid #c1121f; border-radius: 12px;
  background: #ffd60a; color: #1a1a1a; text-decoration: none; }
.ms-card strong { display: block; color: #9d0208; font-size: clamp(22px, 4vw, 32px); line-height: 1.2; }
.ms-card span { display: block; margin: 8px 0 12px; }
.ms-card em { display: inline-block; background: #c1121f; color: #fff; font-style: normal; font-weight: 700;
  border-radius: 6px; padding: 8px 18px; }
.ms-card:hover, .ms-card:focus-visible { box-shadow: 0 6px 18px rgb(157 2 8 / 35%); }
.flow { list-style: none; padding: 0; counter-reset: step; }
.flow li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.flow li + li { margin-top: 32px; position: relative; }
.flow li + li::before { content: "↓"; position: absolute; top: -30px; left: 50%; font-size: 20px; color: var(--accent); }
.flow strong { display: block; }
#admin table td, #admin table th { display: table-cell; }

@media (max-width: 800px) {
  .document { grid-template-columns: 1fr 1fr; }
  .document .status, .document .supplier { grid-column: 1 / -1; }
  .detail-body { grid-template-columns: 1fr; }
  .comparison { order: -1; }
  .comparison thead { display: none; }
  .comparison tr { display: block; border-bottom: 3px solid var(--line); }
  .comparison td { display: grid; grid-template-columns: 90px 1fr; border: 0; }
  .comparison td::before { content: attr(data-label); color: var(--muted); grid-row: span 3; }
  .comparison td span, .comparison td small, .comparison td em { grid-column: 2; }
}
