:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --green: #10B981;
  --green-dark: #059669;
  --red: #EF4444;
  --red-dark: #DC2626;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.screen {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
}

/* ---- Login Screen ---- */
#lock {
  justify-content: center;
  align-items: stretch;
}

.lock-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
}

.logo-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.app-title {
  font-size: 22px;
  font-weight: 750;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.app-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.unit-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.input-wrap {
  position: relative;
  flex: 1;
}

.input-wrap.full {
  width: 100%;
  margin-bottom: 14px;
}

.input-wrap input {
  width: 100%;
  font-size: 16px;
  padding: 14px 38px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F8FAFC;
  transition: border-color 160ms ease, background 160ms ease;
  outline: none;
}

.input-wrap.full input {
  padding-right: 14px;
}

.input-wrap input:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.unit-label {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.check-wrap {
  margin: 12px 0 20px;
  text-align: left;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.check-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-text {
  font-size: 13px;
  color: var(--text);
}

.check-text strong {
  color: var(--primary);
}

.guide-text {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: left;
  background: #F8FAFC;
  padding: 10px 12px;
  border-radius: 8px;
}

.error-text {
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  min-height: 20px;
  margin: 12px 0 0;
}

/* ---- Main Screen ---- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 4px 2px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title-sm {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.badge {
  background: #EFF6FF;
  color: var(--primary);
  border: 1px solid #BFDBFE;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 140ms ease, color 140ms ease;
}

.link-btn:hover {
  background: #E2E8F0;
  color: var(--text);
}

.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label:first-of-type {
  margin-top: 0;
}

.card input[type="text"],
.card input[type="date"] {
  width: 100%;
  font-size: 18px;
  font-weight: 600;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F8FAFC;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.card input[type="text"]:focus,
.card input[type="date"]:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.date-row {
  display: flex;
  gap: 8px;
}

.date-row input {
  flex: 1;
}

.ghost-btn {
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 0 16px;
  cursor: pointer;
  transition: background 140ms ease;
  white-space: nowrap;
}

.ghost-btn:hover, .ghost-btn:active {
  background: #E2E8F0;
}

.duration-row {
  display: flex;
  gap: 8px;
}

.radio-pill {
  flex: 1;
  cursor: pointer;
  margin: 0 !important;
}

.radio-pill input {
  display: none;
}

.radio-pill span {
  display: block;
  text-align: center;
  padding: 11px 4px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 160ms ease;
}

.radio-pill input:checked + span {
  background: #EFF6FF;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.recent-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.chip-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.chip-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.car-chip {
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.car-chip:hover, .car-chip:active {
  background: #E2E8F0;
  border-color: #CBD5E1;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.primary-btn {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  padding: 15px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 160ms ease, transform 100ms ease, opacity 160ms ease;
}

.primary-btn:active {
  transform: scale(0.985);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.primary-btn.submit {
  background: var(--primary);
  color: #FFFFFF;
}

.primary-btn.submit:hover {
  background: var(--primary-dark);
}

.primary-btn.register {
  flex: 2;
  background: var(--green);
  color: #FFFFFF;
}

.primary-btn.register:hover {
  background: var(--green-dark);
}

.primary-btn.delete {
  flex: 1;
  background: #F1F5F9;
  border: 1px solid var(--border);
  color: var(--red);
}

.primary-btn.delete:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
}

.result {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn 200ms ease-out;
}

.result.ok {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
}

.result.err {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
