:root {
  --ink: #16212b;
  --muted: #5a6b7a;
  --line: #d3dce4;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --brand: #1b3a5c;
  --brand-soft: #e8eff6;
  --warn-bg: #fff6e0;
  --warn-line: #e3b64a;
  --danger: #a33a2b;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--brand);
  text-underline-offset: 2px;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.35;
  margin: 8px 0 12px;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 10px;
}

h3 {
  font-size: 1rem;
  margin: 0 0 8px;
}

p {
  margin: 0 0 12px;
}

ul,
ol {
  padding-left: 1.2em;
  margin: 0 0 12px;
}

li {
  margin-bottom: 6px;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 14px 48px;
}

.chrome {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.chrome .in {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.brand {
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  font-size: 0.95rem;
}

.chrome nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.88rem;
}

.chrome nav a {
  text-decoration: none;
  padding: 2px 0;
}

.chrome nav a[aria-current="page"] {
  font-weight: 700;
  border-bottom: 2px solid var(--brand);
}

footer.chrome {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  margin-top: 32px;
}

footer.chrome .in {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

footer.chrome section {
  margin-top: 12px;
}

footer.chrome h2 {
  font-size: 0.82rem;
  margin: 0 0 4px;
  color: var(--ink);
}

footer.chrome ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.disc {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.lede {
  font-size: 1rem;
  color: #2b3a47;
}

.breadcrumb {
  margin: 0 0 4px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 0 14px;
}

.panel.warnings {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.steps {
  padding-left: 1.1em;
}

.steps h2 {
  font-size: 1rem;
  margin: 0 0 2px;
}

.steps li {
  margin-bottom: 10px;
}

.cta {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  margin: 4px 0 12px;
}

button {
  font: inherit;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

button.cta,
button#print,
button#add-row,
button#add-vehicle {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 700;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.link {
  border: 0;
  background: none;
  padding: 2px 4px;
  color: var(--brand);
  text-decoration: underline;
}

button.danger {
  color: var(--danger);
}

.links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 14px;
}

legend {
  font-weight: 700;
  padding: 0 6px;
}

label {
  display: block;
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #2b3a47;
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px 8px 0;
}

input,
select {
  font: inherit;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

label.inline input[type="checkbox"],
label.inline input[type="radio"] {
  width: auto;
  margin: 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
}

.row.checks {
  display: flex;
  flex-wrap: wrap;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
}

.hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.card > span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.card strong {
  font-size: 1.1rem;
  display: block;
  word-break: break-all;
}

.card.detail {
  margin-bottom: 12px;
}

.card.detail dl.big {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

dl.big {
  margin: 0 0 8px;
}

dl.big div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

dl.big dt {
  color: var(--muted);
  font-size: 0.88rem;
}

dl.big dd {
  margin: 0;
  font-weight: 700;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  vertical-align: middle;
}

.badge.warn {
  background: var(--warn-bg);
  color: #8a5b00;
  border: 1px solid var(--warn-line);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -4px 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.86rem;
}

th,
td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--brand-soft);
  font-weight: 700;
  font-size: 0.82rem;
}

table.ledger {
  min-width: 640px;
}

table.ledger input {
  min-width: 70px;
  margin: 0;
  padding: 5px 6px;
}

table.ledger td.derived {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.rules td:first-child {
  white-space: nowrap;
  font-weight: 600;
}

.issues li.error {
  color: var(--danger);
}

.issues li.warning {
  color: #8a5b00;
}

.stack {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

details summary {
  cursor: pointer;
  color: var(--brand);
}

details.faq {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

details.faq p {
  margin: 8px 0 0;
}

code {
  background: #eef2f5;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

table.report {
  font-size: 0.75rem;
  margin-bottom: 12px;
}

table.report th,
table.report td {
  padding: 4px 5px;
  white-space: nowrap;
}

table.report caption {
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0 0 6px;
}

.print-totals {
  font-size: 0.9rem;
}

.print-only-note {
  margin-top: 10px;
}

@media (min-width: 640px) {
  h1 {
    font-size: 1.8rem;
  }

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

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

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

  .card.detail dl.big {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  dl.big div {
    display: block;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #fff;
    font-size: 10pt;
  }

  .chrome,
  .breadcrumb,
  .no-print,
  .related,
  main > h1 {
    display: none !important;
  }

  main {
    max-width: none;
    padding: 0;
  }

  #report-body {
    font-size: 8.5pt;
  }

  table.report {
    font-size: 7.5pt;
  }

  .table-wrap {
    overflow: visible;
    margin: 0 0 8px;
  }

  table.report th,
  table.report td {
    padding: 3px 4px;
  }

  .print-totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .print-totals div {
    border: 1px solid #999;
    padding: 4px 6px;
    display: block;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
