/*
 * ui-kit.css — shared visual language for the four publishing-QA tools.
 * Each tool sets --accent / --accent-dark on <body> (or overrides here)
 * to get a distinct identity while keeping the same structure, so the
 * four tools are visibly a family and a coder can tell at a glance which
 * one is open.
 *
 * Deliberately NO @import of Google Fonts (or any other remote asset).
 * These tools' entire value proposition is that they make zero network
 * calls, provably — pulling a webfont on load would be a real (if minor)
 * exception to that, and would also just fail silently offline. System
 * font stacks only.
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #1C3557;
  --navy-light: #A8BED4;
  --accent: #B8341B;
  --accent-dark: #8B1A0A;
  --bg: #F4F4F2;
  --panel: #FFFFFF;
  --border: #D0D6DE;
}

body {
  background: var(--bg);
  color: #1A1A1A;
  font-family: 'Noto Sans', 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ── */
#header {
  background: var(--navy);
  border-bottom: 3px solid var(--accent);
  padding: 16px 28px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 100;
}
#logo {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
#header-title {
  font-family: 'Lato', sans-serif;
  font-size: 15px; font-weight: 900;
  letter-spacing: 0.06em; color: #FFFFFF;
  text-transform: uppercase;
}
#header-sub { font-size: 12px; color: var(--navy-light); margin-top: 2px; }
#header-nav { margin-left: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
#header-nav a {
  font-size: 11px; color: var(--navy-light); text-decoration: none;
  padding: 3px 8px; border: 1px solid transparent; border-radius: 3px;
  font-family: 'Lato', sans-serif; font-weight: 700; letter-spacing: 0.03em;
}
#header-nav a:hover { border-color: var(--navy-light); }
#header-nav a.current { color: #fff; background: rgba(255,255,255,0.12); }
#header-actions { margin-left: auto; display: none; gap: 8px; flex-wrap: wrap; }

.btn {
  padding: 8px 16px; border-radius: 3px; cursor: pointer;
  font-size: 13px; font-family: 'Lato', sans-serif; font-weight: 700;
  border: 2px solid var(--navy-light); background: transparent; color: var(--navy-light);
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--navy-light); color: var(--navy); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-blue { border-color: #FFFFFF; color: #FFFFFF; }
.btn-blue:hover { background: #FFFFFF; color: var(--navy); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ── Main ── */
#main { max-width: 900px; margin: 0 auto; padding: 28px 16px 60px; }
#main.wide { max-width: 1180px; }

/* ── Intro / description card ── */
.tool-intro {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 4px; padding: 16px 20px; margin-bottom: 20px;
  font-size: 13px; color: #444; line-height: 1.6;
}
.tool-intro strong { color: #1A1A1A; font-family: 'Lato', sans-serif; }

/* ── Drop zone ── */
.dropzone {
  border: 2px dashed #B0B8C4;
  border-radius: 6px;
  padding: 44px 32px;
  text-align: center;
  cursor: pointer;
  background: var(--panel);
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 14px;
}
.dropzone.over { border-color: var(--navy); background: #EEF2F7; }
.dropzone .dz-icon { font-size: 32px; margin-bottom: 10px; }
.dropzone .dz-label { font-size: 16px; color: #333; margin-bottom: 6px; font-family: 'Lato', sans-serif; font-weight: 700; }
.dropzone .dz-label span { color: var(--navy); }
.dropzone .dz-hint { font-size: 13px; color: #888; }
.dropzone.filled { border-style: solid; border-color: #8EC9A0; background: #F4FAF6; padding: 18px 24px; text-align: left; display: flex; align-items: center; gap: 10px; }
.dropzone.filled .dz-icon { font-size: 20px; margin: 0; }

/* ── Loading ── */
.loading { text-align: center; padding: 60px 0; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 1s linear infinite; font-size: 28px; margin-bottom: 12px; }
.loading .lbl { color: var(--navy); font-size: 14px; font-family: 'Lato', sans-serif; font-weight: 700; letter-spacing: 0.06em; }

/* ── Error ── */
.error-box {
  background: #FFF5F5; border: 2px solid var(--accent); border-radius: 6px;
  padding: 26px; text-align: center; display: none;
}
.error-box .etitle { color: var(--accent); font-size: 16px; font-weight: 700; margin-bottom: 8px; font-family: 'Lato', sans-serif; }
.error-box .emsg { color: #444; font-size: 14px; margin-bottom: 16px; white-space: pre-wrap; text-align: left; }

/* ── Results ── */
.results { display: none; }

/* ── Score bar ── */
.score-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 4px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.score-bar .fname {
  color: var(--navy); font-size: 13px; font-weight: 700;
  font-family: 'Lato', sans-serif;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.score-pill {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 4px 10px; border-radius: 3px;
  font-weight: 700; font-family: 'Lato', sans-serif;
  white-space: nowrap;
}
.pill-err  { background: #FDECEA; color: #8B1A0A; border: 1px solid #E8A89E; }
.pill-warn { background: #FEF6E4; color: #7A4A00; border: 1px solid #E8C97A; }
.pill-pass { background: #EAF4EE; color: #1A5C2A; border: 1px solid #8EC9A0; }
.pill-block { background: #FDECEA; color: #8B1A0A; border: 2px solid var(--accent); font-weight: 900; }

/* ── OUTER sections ── */
.outer-section { border-radius: 4px; margin-bottom: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--panel); }
.outer-section.outer-error   { border-left: 4px solid var(--accent); }
.outer-section.outer-warning { border-left: 4px solid #C47A00; }
.outer-section.outer-info    { border-left: 4px solid var(--navy); }

.outer-header { display: flex; align-items: center; gap: 12px; padding: 15px 18px; cursor: pointer; user-select: none; background: var(--panel); transition: background 0.1s; }
.outer-header:hover { background: #F0F3F7; }
.outer-icon  { font-size: 18px; flex-shrink: 0; }
.outer-title-wrap { flex: 1; }
.outer-title { font-family: 'Lato', sans-serif; font-size: 14px; font-weight: 900; letter-spacing: 0.03em; color: #1A1A1A; text-transform: uppercase; }
.outer-sub { font-size: 12px; color: #666; margin-top: 2px; }
.outer-status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.outer-chips  { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.count-chip { font-size: 11px; padding: 3px 8px; border-radius: 3px; font-weight: 700; font-family: 'Lato', sans-serif; white-space: nowrap; }
.chip-err  { background: #FDECEA; color: #8B1A0A; border: 1px solid #E8A89E; }
.chip-warn { background: #FEF6E4; color: #7A4A00; border: 1px solid #E8C97A; }
.chip-ok   { background: #EAF4EE; color: #1A5C2A; border: 1px solid #8EC9A0; }
.chip-info { background: #E8EEF6; color: var(--navy); border: 1px solid var(--navy-light); }
.big-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; flex-shrink: 0; font-family: 'Lato', sans-serif; }
.dot-error   { background: #FDECEA; color: var(--accent); border: 2px solid var(--accent); }
.dot-warning { background: #FEF6E4; color: #C47A00; border: 2px solid #C47A00; }
.dot-pass    { background: #EAF4EE; color: #1A5C2A; border: 2px solid #2A7A3A; }
.dot-info    { background: #E8EEF6; color: var(--navy); border: 2px solid var(--navy); }
.outer-chevron { font-size: 10px; color: #999; transition: transform 0.2s; flex-shrink: 0; }
.outer-section.open .outer-chevron { transform: rotate(90deg); }
.outer-body { display: none; border-top: 1px solid #E4E8ED; padding: 8px 14px 14px; background: #FAFBFC; }
.outer-section.open .outer-body { display: block; }

/* ── INNER rows ── */
.inner-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border-radius: 4px; margin-bottom: 2px; transition: background 0.1s; }
.inner-row:hover { background: #EEF2F7; }
.inner-row.no-expand { cursor: default; }
.inner-row.expandable { cursor: pointer; }
.inner-status-dot { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; flex-shrink: 0; margin-top: 2px; font-family: 'Lato', sans-serif; }
.idot-fail    { background: #FDECEA; color: var(--accent); border: 2px solid var(--accent); }
.idot-pass    { background: #EAF4EE; color: #1A5C2A; border: 2px solid #2A7A3A; }
.idot-na      { background: #F0F0F0; color: #999; border: 2px solid #CCC; }
.idot-error   { background: #FDECEA; color: var(--accent); border: 2px solid var(--accent); }
.idot-warning { background: #FEF6E4; color: #C47A00; border: 2px solid #C47A00; }
.idot-info    { background: #E8EEF6; color: var(--navy); border: 2px solid #4A7AAE; }
.inner-content { flex: 1; min-width: 0; }
.inner-label { font-size: 14px; color: #1A1A1A; line-height: 1.4; font-weight: 600; }
.inner-label .na { color: #999; font-weight: 400; }
.inner-detail { display: none; margin-top: 8px; padding: 10px 12px; background: #FFFFFF; border-radius: 3px; border-left: 3px solid #B0B8C4; }
.inner-row.open .inner-detail { display: block; }
.detail-line { font-size: 13px; color: #333; line-height: 1.7; white-space: pre-wrap; }
.detail-ex   { font-size: 12px; color: #666; font-family: 'Courier New', monospace; margin-top: 3px; padding-left: 8px; }
.inner-chevron { font-size: 9px; color: #AAA; transition: transform 0.2s; flex-shrink: 0; margin-top: 5px; }
.inner-row.open .inner-chevron { transform: rotate(90deg); }
.inner-row.no-expand .inner-chevron { visibility: hidden; }

/* ── Tooltip ── */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; margin-left: 6px; vertical-align: middle; }
.tooltip-icon { width: 16px; height: 16px; border-radius: 50%; background: #E4E8ED; color: #666; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: help; flex-shrink: 0; border: 1px solid #C0C8D0; font-style: italic; font-family: Georgia, serif; font-weight: 700; }
.tooltip-icon:hover { background: #D0D8E4; color: var(--navy); border-color: var(--navy); }
.tooltip-box { display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--navy); border-radius: 4px; padding: 10px 12px; width: 260px; font-size: 12px; color: #E8EEF6; line-height: 1.6; z-index: 300; pointer-events: none; font-family: 'Noto Sans', sans-serif; font-style: normal; font-weight: 400; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.tooltip-wrap:hover .tooltip-box { display: block; }

/* ── Section label tags ── */
.section-tag { display: inline-block; font-size: 10px; padding: 3px 8px; border-radius: 3px; margin-bottom: 12px; font-weight: 700; font-family: 'Lato', sans-serif; letter-spacing: 0.06em; text-transform: uppercase; }
.tag-1 { background: #FDECEA; color: #8B1A0A; border: 1px solid #E8A89E; }
.tag-2 { background: #FEF6E4; color: #7A4A00; border: 1px solid #E8C97A; }
.tag-3 { background: #E8EEF6; color: var(--navy); border: 1px solid var(--navy-light); }

/* ── Report ── */
.report-section { margin-top: 20px; }
.report-toggle { color: #888; font-size: 12px; cursor: pointer; background: none; border: none; font-family: 'Noto Sans', sans-serif; padding: 0; }
.report-toggle:hover { color: var(--navy); }
.report-pre { display: none; margin-top: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 14px; font-size: 11px; color: #555; overflow: auto; max-height: 320px; white-space: pre; font-family: 'Courier New', monospace; }

.divider { height: 1px; background: #E8ECF0; margin: 4px 0; }

/* ── Generic panel (used for flatten / convert / mapping editors) ── */
.tool-panel { margin-top: 24px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid #5A6E3A; border-radius: 4px; overflow: hidden; }
.tool-panel-header { background: #F5F7F2; padding: 16px 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
.tool-panel-header:hover { background: #EDF0E8; }
.tool-panel-icon { font-size: 20px; }
.tool-panel-title { font-family: 'Lato', sans-serif; font-weight: 900; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: #2A3A1A; }
.tool-panel-sub { font-size: 12px; color: #666; margin-top: 2px; }
.tool-panel-chevron { font-size: 10px; color: #999; transition: transform 0.2s; margin-left: auto; }
.tool-panel.open .tool-panel-chevron { transform: rotate(90deg); }
.tool-panel-body { display: none; padding: 20px; }
.tool-panel.open .tool-panel-body { display: block; }

.caveat-box { background: #FEF6E4; border: 1px solid #E8C97A; border-left: 3px solid #C47A00; border-radius: 3px; padding: 12px 14px; margin-bottom: 18px; font-size: 13px; color: #4A3800; line-height: 1.6; }
.caveat-box strong { font-family: 'Lato', sans-serif; font-weight: 700; }
.block-box { background: #FDECEA; border: 1px solid #E8A89E; border-left: 3px solid var(--accent); border-radius: 3px; padding: 14px 16px; margin-bottom: 18px; font-size: 13px; color: #4A0A00; line-height: 1.7; }
.block-box strong { font-family: 'Lato', sans-serif; font-weight: 700; }
.block-box ul { margin: 8px 0 0 18px; }

/* ── Checklist items (flatten operations) ── */
.checklist-section-label { font-family: 'Lato', sans-serif; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: #666; margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 1px solid #E8ECF0; }
.checklist-section-label:first-of-type { margin-top: 0; }
.checklist-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px; border-radius: 3px; transition: background 0.1s; }
.checklist-item:hover { background: #F5F7F2; }
.checklist-item input[type=checkbox] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; accent-color: #5A6E3A; }
.checklist-item input[type=checkbox]:disabled { opacity: 0.4; cursor: not-allowed; }
.checklist-item-content { flex: 1; }
.checklist-item-label { font-size: 13px; font-weight: 600; color: #1A1A1A; line-height: 1.4; }
.checklist-item-label.na { color: #AAA; font-weight: 400; }
.checklist-item-sub { font-size: 12px; color: #666; margin-top: 2px; line-height: 1.4; }
.checklist-item-sub.manual { color: #7A4A00; font-style: italic; }
.checklist-howto { margin-top: 8px; padding: 9px 12px; background: #F0F4F8; border-left: 3px solid var(--navy); border-radius: 0 3px 3px 0; font-size: 12px; color: #2A3A4A; line-height: 1.6; display: none; }
.checklist-howto-toggle { display: inline-block; margin-top: 5px; font-size: 11px; color: var(--navy); cursor: pointer; font-weight: 700; font-family: 'Lato', sans-serif; background: none; border: none; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.checklist-howto-toggle:hover { color: var(--accent); }
.checklist-item-content.na .checklist-howto-toggle { display: none; }
.checklist-badge { font-size: 10px; padding: 1px 6px; border-radius: 2px; font-family: 'Lato', sans-serif; font-weight: 700; flex-shrink: 0; margin-top: 3px; white-space: nowrap; }
.badge-auto    { background: #EAF4EE; color: #1A5C2A; border: 1px solid #8EC9A0; }
.badge-partial { background: #FEF6E4; color: #7A4A00; border: 1px solid #E8C97A; }
.badge-manual  { background: #F0F0F0; color: #666;    border: 1px solid #CCC; }
.badge-na      { background: #F5F5F5; color: #AAA;    border: 1px solid #DDD; }

.panel-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid #E8ECF0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-primary { background: #5A6E3A; color: #FFFFFF; border: 2px solid #5A6E3A; padding: 10px 22px; border-radius: 3px; font-family: 'Lato', sans-serif; font-weight: 700; font-size: 14px; cursor: pointer; transition: background 0.15s; }
.btn-primary:hover { background: #4A5C2E; border-color: #4A5C2E; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.panel-status { font-size: 13px; color: #666; }

.changelog-box { display: none; margin-top: 16px; background: #F5F7F2; border: 1px solid #C8D4B8; border-radius: 3px; padding: 14px; }
.changelog-box h4 { font-family: 'Lato', sans-serif; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: #3A5020; margin-bottom: 10px; }
.changelog-item { font-size: 12px; color: #333; line-height: 1.6; padding: 2px 0; }
.changelog-item::before { content: '✓ '; color: #5A6E3A; font-weight: 700; }
.changelog-skipped { color: #888; }
.changelog-skipped::before { content: '— '; color: #AAA; }

/* ── Two-file upload (validator) ── */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 700px) { .upload-grid { grid-template-columns: 1fr; } }

/* ── Match table (validator) ── */
.match-row { display: grid; grid-template-columns: 22px 1fr 1fr; gap: 10px; padding: 10px 8px; border-radius: 4px; border-bottom: 1px solid #EEF1F4; }
.match-row:last-child { border-bottom: none; }
.match-col-label { font-size: 10px; font-weight: 700; font-family: 'Lato', sans-serif; text-transform: uppercase; letter-spacing: 0.04em; color: #999; margin-bottom: 3px; }
.match-text { font-size: 13px; color: #333; line-height: 1.5; }
.match-text mark { background: #FFE1B8; color: inherit; padding: 0 1px; border-radius: 2px; }
.match-issue { font-size: 12px; color: var(--accent-dark); margin-top: 4px; }
.match-note  { font-size: 12px; color: #666; margin-top: 4px; font-style: italic; }
.figure-chip { display: inline-block; font-family: 'Courier New', monospace; font-size: 11px; padding: 1px 6px; border-radius: 3px; margin: 2px 3px 0 0; }
.figure-ok      { background: #EAF4EE; color: #1A5C2A; border: 1px solid #8EC9A0; }
.figure-missing { background: #FDECEA; color: var(--accent-dark); border: 1px solid #E8A89E; }
.figure-added   { background: #FEF6E4; color: #7A4A00; border: 1px solid #E8C97A; }

/* ── Responsive ── */
@media (max-width: 600px) {
  #header { padding: 14px 16px; gap: 10px; }
  #header-title { font-size: 13px; }
  #header-sub, #header-nav { display: none; }
  #main { padding: 16px 12px 40px; }
  .dropzone { padding: 32px 16px; }
  .score-bar { gap: 8px; }
  .score-bar .fname { font-size: 12px; }
  .score-pill { font-size: 11px; padding: 3px 7px; }
  .outer-header { padding: 12px 14px; gap: 8px; }
  .outer-title { font-size: 13px; }
  .outer-chips { display: none; }
  .inner-row { padding: 8px 6px; }
  .inner-label { font-size: 13px; }
  .tooltip-box { width: 200px; left: 0; transform: none; }
  #header-actions { gap: 6px; }
  .btn { padding: 6px 10px; font-size: 12px; }
  .match-row { grid-template-columns: 1fr; }
}
