* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans KR", sans-serif;
  background: #f5f7fb;
  color: #111827;
}

.app {
  max-width: 820px;
  margin: 20px auto;
  padding: 0 14px 24px;
  min-height: calc(100vh - 40px);
}

.top h1 {
  margin: 0;
  font-size: 1.25rem;
  white-space: nowrap;
}

.top-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
}

.top-controls .btn {
  justify-self: end;
  white-space: nowrap;
  padding: 9px 10px;
  font-size: 0.88rem;
}

.vehicle-switch {
  justify-self: start;
  display: inline-flex;
  gap: 6px;
  overflow-x: auto;
}

.top-controls h1 {
  justify-self: center;
}

select,
input,
textarea,
button {
  font: inherit;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.tabs {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.btn {
  text-decoration: none;
  border: 1px solid #0f172a;
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.btn-light {
  background: #fff;
  color: #111827;
  border-color: #d1d5db;
}

.tab {
  white-space: nowrap;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  cursor: pointer;
}

.tab.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.panel {
  margin-top: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel-header {
  margin-bottom: 12px;
}

.spec-grid label span,
.record-form label span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: #374151;
}

.spec-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.86rem;
  line-height: 1.2;
}

#saveSpecBtn {
  margin-top: 10px;
}

hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.record-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
}

.record-form .check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.record-form .check span {
  margin: 0;
}

.record-form .check input {
  width: auto;
}

.actions {
  display: flex;
  gap: 8px;
}

.hidden {
  display: none;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.history-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.line {
  font-size: 0.9rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  margin-left: 6px;
}

.delete {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.edit {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.kv {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f9fafb;
  margin: 0 6px 6px 0;
  font-size: 0.82rem;
}

.kv b {
  display: none;
}

.sub {
  color: #6b7280;
  font-size: 0.82rem;
  margin-top: 2px;
}

.maker-manager {
  display: grid;
  gap: 8px;
}

.maker-manager h3 {
  margin: 0;
}

.maker-form {
  display: flex;
  gap: 8px;
}

.maker-form input {
  flex: 1;
}

.maker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.maker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
}

.group-list {
  display: grid;
  gap: 12px;
}

.group-block h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.group-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f9fafb;
  font-size: 0.78rem;
  line-height: 1.1;
}

.tag-strong {
  font-weight: 600;
  border-color: #cbd5e1;
  background: #eef2ff;
}

.group-row .kv,
.group-row .tag {
  flex: 0 0 auto;
  white-space: nowrap;
}

.plain-item {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #111827;
}

.date-strong {
  font-weight: 700;
}

.plain-sep {
  color: #6b7280;
  font-weight: 600;
  margin: 0 2px;
}

.planned-item {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 3px 8px;
}

@media (max-width: 640px) {
  .top h1 {
    font-size: 1.05rem;
  }

  .top-controls {
    grid-template-columns: auto 1fr auto;
    gap: 6px;
  }

  .top-controls .btn {
    padding: 8px 9px;
    font-size: 0.82rem;
  }

  .vehicle-switch .tab {
    padding: 7px 10px;
    font-size: 0.82rem;
  }

  .record-form {
    grid-template-columns: 1fr;
  }
}
