/* Deliberately plain. Legibility and density over styling. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1b1b1b;
  background: #f4f5f7;
}
h1 { font-size: 22px; margin: 4px 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
a { color: #1a55b8; }
p { margin: 0 0 10px; }
.muted { color: #6b7280; }
.hidden { display: none !important; }

/* ---- shell ---- */
.topbar {
  background: #1f2937; color: #fff; padding: 10px 20px;
  display: flex; align-items: baseline; gap: 10px;
}
.brand { color: #fff; text-decoration: none; font-weight: 600; }
.proto { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9ca3af; border: 1px solid #4b5563; padding: 1px 6px; border-radius: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.back { font-size: 13px; text-decoration: none; }

/* ---- buttons ---- */
.btn {
  display: inline-block; font: inherit; font-size: 14px; line-height: 1.2;
  padding: 7px 12px; border: 1px solid #c7ccd4; background: #fff; color: #1b1b1b;
  border-radius: 4px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f0f2f5; }
.btn-sm { font-size: 12.5px; padding: 5px 9px; }
.btn-primary { background: #1a55b8; border-color: #1a55b8; color: #fff; }
.btn-primary:hover { background: #16469b; }
.btn-danger { color: #a01919; border-color: #e0c0c0; }
.btn-danger:hover { background: #fdf0f0; }

/* ---- cards / tables ---- */
.card { background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.empty { color: #6b7280; padding: 14px; background: #fff; border: 1px dashed #d3d8e0; border-radius: 6px; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eceff3; vertical-align: middle; }
.table th { background: #f8f9fb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #55606f; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .actions { white-space: nowrap; text-align: right; }
.status { font-size: 12.5px; background: #eef1f6; border-radius: 3px; padding: 2px 7px; }
.pill { font-size: 12.5px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.pill-good { background: #e3f4e6; color: #1d6b2c; }
.pill-mid { background: #fdf3d8; color: #86620b; }
.pill-low { background: #fbe3e3; color: #97231f; }
.footnote { margin-top: 14px; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- forms ---- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: #3c4658; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid #c7ccd4;
  border-radius: 4px; background: #fff; width: 100%; max-width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #9ec0ff; border-color: #1a55b8; }
.hint { font-size: 12px; color: #6b7280; }
.req { color: #a01919; }
.vis-select { font-size: 11px; padding: 1px 3px; border: 1px solid #d7dbe2; border-radius: 3px; color: #55606f; background: #f8f9fb; font-weight: 400; }
.panel-hint { font-size: 12.5px; margin-top: -4px; }
.row-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ---- editor ---- */
.editor { display: grid; grid-template-columns: 200px minmax(0, 1fr) 230px; gap: 16px; align-items: start; }
.tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; }
.tab { padding: 7px 10px; text-decoration: none; color: #2c3444; border-radius: 4px; font-size: 14px; display: flex; justify-content: space-between; gap: 6px; }
.tab:hover { background: #e9ecf1; }
.tab.active { background: #1f2937; color: #fff; font-weight: 600; }
.tab .count { font-size: 11px; background: rgba(0,0,0,.09); border-radius: 8px; padding: 0 6px; align-self: center; }
.tab.active .count { background: rgba(255,255,255,.22); }
.panel { background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; padding: 16px; }
.item-card { border: 1px solid #e3e7ec; border-radius: 5px; padding: 12px; margin-bottom: 12px; background: #fcfcfd; }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.item-num { font-weight: 600; font-size: 14px; }
.item-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline { font-size: 11.5px; color: #55606f; display: flex; align-items: center; gap: 4px; }
.inline select { font-size: 11.5px; padding: 2px 4px; border: 1px solid #d7dbe2; border-radius: 3px; }
.warning-banner { background: #fdf3d8; border: 1px solid #e8d08a; color: #6d5206; padding: 9px 11px; border-radius: 4px; margin-bottom: 12px; font-size: 13.5px; }
.notice-edit.notice-critical { border-left: 4px solid #a01919; }
.notice-edit.notice-warning { border-left: 4px solid #c07d14; }
.notice-edit.notice-important { border-left: 4px solid #1a55b8; }
.notice-edit.notice-normal { border-left: 4px solid #c7ccd4; }

.editor-side { position: sticky; top: 12px; }
.side-block { background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; padding: 12px; }
.side-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #55606f; margin-bottom: 8px; }
.side-num { font-size: 13px; margin: 6px 0 8px; }
.bar { height: 8px; background: #e9ecf1; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: #2e7d3a; }
.mini-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mini-list li { padding: 3px 0; border-top: 1px solid #f0f2f5; }
.mini-list a { text-decoration: none; color: #2c3444; }
.mini-list a:hover { text-decoration: underline; }
.warn { color: #a01919; font-weight: 700; }
.ok { color: #1d6b2c; font-weight: 700; }
.ok-line { color: #1d6b2c; font-size: 13px; }
.warn-line { color: #8a4b06; font-size: 13.5px; }

/* ---- generator ---- */
.checklist-card .checklist-head { display: flex; justify-content: space-between; align-items: baseline; }
.pct-num { font-size: 20px; font-weight: 700; }
.checklist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; font-size: 13.5px; }
.checklist li { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid #f2f4f7; align-items: baseline; }
.checklist .mark { width: 14px; }
.checklist li.ok .mark { color: #1d6b2c; }
.checklist li.miss .mark { color: #b8860b; }
.checklist .lbl { flex: 0 0 auto; }
.checklist .fix { font-size: 12.5px; color: #8a4b06; text-decoration: none; margin-left: auto; text-align: right; }
.checklist .fix:hover { text-decoration: underline; }
.tpl-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tpl { font: inherit; font-size: 14px; padding: 8px 14px; border: 1px solid #c7ccd4; background: #fff; border-radius: 4px; cursor: pointer; }
.tpl.active { background: #1f2937; border-color: #1f2937; color: #fff; font-weight: 600; }
.tpl-picker p { flex-basis: 100%; margin: 0; font-size: 13px; }
.preview-wrap { background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; padding: 28px 32px; }

/* ---- generated document ---- */
.handover { max-width: 780px; font-size: 14.5px; }
.ho-head { border-bottom: 2px solid #1f2937; padding-bottom: 12px; margin-bottom: 20px; }
.ho-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; color: #55606f; margin: 0; }
.ho-head h1 { font-size: 24px; margin: 4px 0 6px; }
.ho-meta { font-size: 13px; color: #55606f; margin: 0 0 10px; }
.ho-intro { font-size: 13.5px; color: #3c4658; margin: 0; }
.ho-section { margin-bottom: 24px; page-break-inside: avoid; }
.ho-section h2 { font-size: 16px; border-bottom: 1px solid #dfe3e8; padding-bottom: 4px; margin-bottom: 10px; }
.ho-dl { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2px 14px; margin: 8px 0 0; font-size: 13.5px; }
.ho-dl dt { color: #55606f; }
.ho-dl dd { margin: 0; }
.ho-item { border-left: 3px solid #e3e7ec; padding: 6px 0 6px 12px; margin-bottom: 14px; page-break-inside: avoid; }
.ho-item-important { border-left-color: #1a55b8; }
.ho-item-warning { border-left-color: #c07d14; }
.ho-item-critical { border-left-color: #a01919; }
.ho-item h3 { display: flex; align-items: center; gap: 8px; }
.badge { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 3px; font-weight: 700; }
.badge-important { background: #e6edfa; color: #1a55b8; }
.badge-warning { background: #fdf3d8; color: #8a5b06; }
.badge-critical { background: #fbe3e3; color: #97231f; }
.ho-warnings .notice { display: flex; gap: 10px; padding: 9px 11px; border-radius: 4px; margin-bottom: 8px; font-size: 13.5px; page-break-inside: avoid; }
.notice-level { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding-top: 2px; min-width: 62px; }
.notice-critical { background: #fbe3e3; border: 1px solid #eebfbf; color: #7d1a17; }
.notice-warning { background: #fdf3d8; border: 1px solid #e8d08a; color: #6d5206; }
.notice-important { background: #e9f0fb; border: 1px solid #c3d4f0; color: #1a3e78; }
.notice-normal { background: #f4f5f7; border: 1px solid #dfe3e8; color: #3c4658; }
.notice-src { color: inherit; opacity: .75; font-size: 12px; }
.ho-inline-warning { background: #fdf3d8; border: 1px solid #e8d08a; color: #6d5206; padding: 7px 10px; border-radius: 4px; font-size: 13px; }
.ho-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ho-table th, .ho-table td { border: 1px solid #e3e7ec; padding: 5px 8px; text-align: left; }
.ho-table th { background: #f8f9fb; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: #55606f; }
.ho-checklist { list-style: none; padding: 0; font-size: 13.5px; }
.ho-checklist li { padding: 2px 0; }
.ho-checklist .ok { color: #1d6b2c; font-size: 11.5px; }
.ho-checklist .warn { color: #a01919; font-size: 11.5px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 8px; }
.flow-step { background: #eef1f6; border: 1px solid #dbe1ea; border-radius: 3px; padding: 3px 8px; font-size: 12.5px; }
.flow-arrow { color: #55606f; }
.ho-foot { border-top: 1px solid #dfe3e8; padding-top: 10px; font-size: 12px; color: #6b7280; }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; padding: 8px 16px; border-radius: 4px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- responsive ---- */
@media (max-width: 980px) {
  .editor { grid-template-columns: 1fr; }
  .tabs { flex-direction: row; flex-wrap: wrap; position: static; }
  .editor-side { position: static; }
  .grid, .checklist { grid-template-columns: 1fr; }
  .ho-dl { grid-template-columns: 1fr; }
  .ho-dl dt { font-weight: 600; margin-top: 6px; }
  .table, .table thead, .table tbody, .table tr, .table td, .table th { display: block; }
  .table thead { display: none; }
  .table tr { border-bottom: 1px solid #dfe3e8; padding: 6px 0; }
  .table td { border: 0; padding: 3px 10px; }
  .table .actions { text-align: left; white-space: normal; }
  .preview-wrap { padding: 16px; }
}

/* ---- print ---- */
@media print {
  body { background: #fff; }
  .no-print, .topbar, .toast { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .preview-wrap { border: 0; padding: 0; }
  .handover { max-width: none; font-size: 11pt; }
  a { color: #000; text-decoration: none; }
}
