/* ── reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f5f5f2;
  padding: 1.5rem;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
}

h1 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

/* ── drop zone ─────────────────────────────────────────────────────────────── */
.drop {
  border: 1.5px dashed #bbb;
  border-radius: 12px;
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
  background: #eee;
}
.drop:hover,
.drop.over { background: #e0e0da; }
.drop input { display: none; }
.drop p { font-size: 13px; color: #666; margin-top: 4px; }

/* ── layout sections ───────────────────────────────────────────────────────── */
.section { margin-top: 1.5rem; }

.section-title {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

/* ── cards ─────────────────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 1rem;
}
.card { background: #e8e8e4; border-radius: 8px; padding: 0.75rem 1rem; }
.card-label { font-size: 12px; color: #666; margin-bottom: 4px; }
.card-val   { font-size: 20px; font-weight: 500; }
.card-sub   { font-size: 12px; color: #999; margin-top: 2px; }

/* ── generic table chrome ──────────────────────────────────────────────────── */
.table-wrap {
  border: 0.5px solid #d0d0c8;
  border-radius: 8px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  font-weight: 500;
  font-size: 12px;
  color: #666;
  text-align: left;
  padding: 7px 12px;
  background: #eee;
  border-bottom: 0.5px solid #d0d0c8;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th:hover { color: #1a1a1a; }
th .sa { display: inline-block; margin-left: 4px; opacity: 0.4; font-size: 10px; }
th.sorted .sa { opacity: 1; }

td {
  padding: 6px 12px;
  border-bottom: 0.5px solid #e8e8e4;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f0f0ec; }
tfoot tr td { border-bottom: none; }

/* ── badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}
.b-blue   { background: #E6F1FB; color: #0C447C; }
.b-teal   { background: #E1F5EE; color: #085041; }
.b-amber  { background: #FAEEDA; color: #633806; }
.b-gray   { background: #E8E8E4; color: #444;    }
.b-purple { background: #EEEDFE; color: #3C3489; }
.b-coral  { background: #FAECE7; color: #712B13; }

/* ── bar charts ────────────────────────────────────────────────────────────── */
.bar-wrap { display: flex; align-items: center; gap: 8px; }
.bar-bg   { flex: 1; height: 5px; background: #ddd; border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar-fill { height: 100%; border-radius: 3px; }

/* ── complexity score ──────────────────────────────────────────────────────── */
.score-wrap {
  border: 0.5px solid #d0d0c8;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
}
.score-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}
.insight { font-size: 13px; color: #555; line-height: 1.6; margin-top: 0.5rem; }
.insight li { margin-left: 1rem; margin-bottom: 3px; }

/* ── utility ───────────────────────────────────────────────────────────────── */
.err      { color: #c0392b; font-size: 13px; margin-top: 0.75rem; }
.mono     { font-family: ui-monospace, monospace; font-size: 12px; }
.num      { font-family: ui-monospace, monospace; font-size: 12px; text-align: right; }
.pct-cell { font-family: ui-monospace, monospace; font-size: 12px; color: #666; }
.warn     { color: #8a5c00; font-weight: 500; }

/* ── accordion ─────────────────────────────────────────────────────────────── */
.acc-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 0.6rem 0.9rem;
  background: #eee;
  border: 0.5px solid #d0d0c8;
  border-radius: 8px;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s;
}
.acc-hdr:hover { background: #e4e4de; }
.acc-hdr.open  { border-radius: 8px 8px 0 0; }

.chevron {
  font-size: 11px;
  opacity: 0.5;
  transition: transform 0.18s;
  display: inline-block;
}

.acc-body {
  border: 0.5px solid #d0d0c8;
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

/* ── names editor toolbar ──────────────────────────────────────────────────── */
.names-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0.5rem 0.75rem;
  background: #f5f5f2;
  border-bottom: 0.5px solid #e0e0d8;
}
.names-info { font-size: 12px; color: #666; }

.names-toolbar button {
  font-size: 12px;
  padding: 4px 12px;
  border: 0.5px solid #bbb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.names-toolbar button:hover { background: #f0f0ec; }
.names-toolbar button.pri   { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.names-toolbar button.pri:hover { background: #333; }
.names-toolbar button.dng   { color: #c0392b; border-color: #e8b4b0; }
.names-toolbar button.dng:hover { background: #fdf2f1; }

/* ── save bar ──────────────────────────────────────────────────────────────── */
.save-bar {
  padding: 0.75rem;
  background: #f0f8f4;
  border-top: 0.5px solid #c0ddd0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.save-bar input {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  padding: 5px 9px;
  border: 0.5px solid #bbb;
  border-radius: 6px;
  font-family: inherit;
}
.save-bar button {
  font-size: 13px;
  padding: 5px 16px;
  border: none;
  border-radius: 6px;
  background: #1a7a52;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.save-bar button:hover { background: #155e3d; }
.save-note { font-size: 12px; color: #555; }

/* ── names table ───────────────────────────────────────────────────────────── */
table.ntbl th { cursor: default; }
table.ntbl td.vc { max-width: 300px; word-break: break-word; }

table.ntbl td.vc input {
  width: 100%;
  font-size: 13px;
  padding: 3px 7px;
  border: 1px solid #85b7eb;
  border-radius: 4px;
  font-family: inherit;
  background: #fff;
  outline: none;
}
table.ntbl td.vc input:focus { border-color: #378ADD; }
table.ntbl tr.edited td      { background: #f0f8f4; }
table.ntbl tr.edited td.vc input { border-color: #1a7a52; }

/* ── change indicator dot ──────────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a7a52;
  vertical-align: middle;
}

/* ── head table section ────────────────────────────────────────────────────── */
#head-body table tbody tr:hover td { background: #f0f0ec; }
#head-body table tbody td { border-bottom: 0.5px solid #e8e8e4; }
#head-body table tbody tr:last-child td { border-bottom: none; }

/* ── version sync panel ─────────────────────────────────────────────────────── */
.head-sync-panel {
  border-top: 0.5px solid #e0e0d8;
  background: #f5f5f2;
}
.head-sync-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0.6rem 0.9rem;
  border-bottom: 0.5px solid #e0e0d8;
}
.head-sync-body {
  padding: 0.75rem 0.9rem;
}
.head-sync-empty {
  padding: 0.6rem 0.9rem;
  border-top: 0.5px solid #e0e0d8;
  background: #f5f5f2;
}
.ver-input {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  padding: 5px 9px;
  border: 1px solid #bbb;
  border-radius: 6px;
  width: 120px;
  outline: none;
}
.ver-input:focus { border-color: #378ADD; }
.btn-ver-apply {
  font-size: 13px;
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.btn-ver-apply:hover { background: #333; }
.btn-ver-clear {
  font-size: 12px;
  padding: 5px 10px;
  border: 0.5px solid #e8b4b0;
  border-radius: 6px;
  background: #fff;
  color: #c0392b;
  cursor: pointer;
  font-family: inherit;
}
.btn-ver-clear:hover { background: #fdf2f1; }
.ver-preview {
  margin-top: 8px;
  padding: 6px 10px;
  background: #f0f8f4;
  border: 0.5px solid #c0ddd0;
  border-radius: 6px;
  font-size: 12px;
}
