:root {
  --accent: #2c8dcc;
  --border: #cfcfcf;
  --text: #33383d;
  --muted: #666c72;
  --surface: #ffffff;
  --page: #f6f7f8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 22px;
  border-bottom: 1px solid #e7e7e7;
  background: #fff;
}

.back-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 40px;
  margin-left: -10px;
  border: 0;
  background: transparent;
  color: #34383d;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.home-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}

.home-brand h1 {
  margin: 0;
  color: #050505;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.drive-form {
  padding: 20px 22px 104px;
}

.menu-view {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: calc(100vh - 60px);
  padding: 18px 16px 92px;
  background: #fff;
}

.main-visual {
  display: block;
  width: min(100%, 398px);
  max-height: calc(100vh - 180px);
  object-fit: contain;
}

.app-loading {
  margin: 18px 0 0;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.field-group {
  margin-bottom: 28px;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 500;
}

label span {
  color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

textarea {
  min-height: 86px;
  padding: 12px 16px;
  resize: vertical;
}

.note-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.note-quick-actions button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(44, 141, 204, 0.2);
}

.select-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #62666b 50%), linear-gradient(135deg, #62666b 50%, transparent 50%);
  background-position: calc(100% - 24px) 24px, calc(100% - 15px) 24px;
  background-size: 9px 9px, 9px 9px;
  background-repeat: no-repeat;
}

.icon-button,
.add-row button,
.clear-search {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.icon-button {
  min-height: 56px;
  color: var(--accent);
  font-size: 24px;
}

.map-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 210px;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--accent);
  background: #f7e2c6;
  cursor: zoom-in;
  user-select: none;
}

.previous-arrival {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin: -10px 0 28px;
  padding: 12px 16px;
  border: 1px solid #d7e7f4;
  border-radius: 4px;
  background: #f3f9fd;
}

.previous-arrival span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.previous-arrival strong {
  color: var(--accent);
  font-size: 18px;
}

input.input-error {
  border-color: #cf3535;
  box-shadow: 0 0 0 2px rgba(207, 53, 53, 0.18);
}

.field-error {
  margin: 8px 0 0;
  color: #cf3535;
  font-size: 14px;
}

.parking-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: center;
  cursor: grab;
}

.parking-canvas.dragging {
  cursor: grabbing;
}

.parking-canvas img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.parking-pin {
  position: absolute;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid #8f2634;
  border-radius: 50% 50% 50% 0;
  background: #e24d69;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -100%) rotate(45deg);
  z-index: 2;
  cursor: grab;
  touch-action: none;
}

.parking-pin.dragging {
  cursor: grabbing;
}

.parking-pin.spark,
.parking-pin[data-preview-pin="스파크"] {
  left: 17%;
  top: 39%;
  background: #ffffff;
  border-color: #777d84;
}

.parking-pin.rayev,
.parking-pin[data-preview-pin="레이EV"] {
  left: 57%;
  top: 64%;
  background: #555b62;
  border-color: #2f343a;
}

.parking-pin.carnival,
.parking-pin[data-preview-pin="카니발"] {
  left: 70%;
  top: 48%;
  background: #9ca3aa;
  border-color: #626970;
}

.parking-pin.starex,
.parking-pin[data-preview-pin="스타렉스"] {
  left: 84%;
  top: 34%;
  background: #d8dadd;
  border-color: #8d9399;
}

.parking-pin::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fffefe;
}

.parking-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: none;
  transform: translate(-50%, 2px) rotate(-45deg) scaleX(1.6);
}

.parking-pin span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  min-width: 54px;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(34, 38, 42, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-45deg);
}

.parking-pin.needs-attention span {
  color: #ff2b2b;
}

.form-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(100%, 430px);
  min-height: 72px;
  margin: 0;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid #e1e1e1;
  background: #fff;
  z-index: 20;
}

.form-actions button {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 20px;
}

.save-button {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 700;
}

.text-button {
  color: var(--accent);
  font-weight: 700;
}

.log-list-view {
  min-height: 100vh;
  padding-bottom: 92px;
  background: #fff;
}

.parking-view {
  min-height: calc(100vh - 60px);
  padding: 0 0 72px;
  background: #fff;
}

.parking-screen-map {
  position: relative;
  width: 100%;
  height: calc(100vh - 132px);
  min-height: 420px;
  overflow: hidden;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  background: #f7e2c6;
  user-select: none;
  touch-action: none;
}

.parking-map-layer {
  position: absolute;
  inset: 0;
  transform-origin: center;
  will-change: transform;
}

.parking-map-layer img {
  position: absolute;
  display: block;
  object-fit: fill;
  transform-origin: center;
  pointer-events: none;
}

.parking-screen-map .parking-pin {
  width: 36px;
  height: 36px;
  z-index: 3;
  cursor: default;
}

.parking-view.editing .parking-screen-map .parking-pin,
.parking-screen-map .parking-pin {
  cursor: grab;
}

.parking-view.editing .parking-screen-map .parking-pin span {
  display: none;
}

.parking-screen-map .parking-pin::before {
  inset: 10px;
}

.parking-screen-map .parking-pin span {
  min-width: 64px;
  font-size: 13px;
}

.parking-action-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 19;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 430px);
  min-height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateX(-50%);
  border-top: 1px solid #d9d9d9;
  background: #fff;
}

.parking-zoom-controls {
  display: contents;
}

.parking-action-tabs button {
  min-width: 0;
  min-height: 72px;
  border: 0;
  border-right: 1px solid #ececec;
  background: #fff;
  color: #333;
  font-size: 20px;
  font-weight: 700;
}

.parking-action-tabs button:last-child {
  border-right: 0;
}

.parking-zoom-controls #parkingZoomReset {
  font-size: 16px;
}

.parking-edit-done {
  color: #1f77b4;
  font-size: 16px;
}

.parking-normal-button {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 5;
  min-width: 68px;
  height: 40px;
  border: 1px solid #6f757c;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  color: #202124;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.18);
}

.parking-view.editing .parking-normal-button {
  display: none;
}

:fullscreen .app-shell {
  width: 100%;
  max-width: none;
}

:fullscreen .parking-view {
  min-height: calc(100vh - 60px);
}

:fullscreen .parking-screen-map {
  height: calc(100vh - 132px);
  min-height: 0;
}

.search-panel {
  position: sticky;
  top: 60px;
  display: grid;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e3e3e3;
  background: #fff;
  z-index: 3;
}

.search-toggle {
  justify-self: end;
  min-width: 72px;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
}

.search-toggle.active {
  background: var(--accent);
  color: #fff;
}

.search-fields {
  display: grid;
  gap: 10px;
}

.search-panel input {
  min-height: 44px;
  font-size: 16px;
}

.name-search-row {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 8px;
}

.date-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.date-filter-row label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.date-filter-row label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}

.clear-search {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log-item {
  width: 100%;
  display: block;
  min-height: 98px;
  padding: 20px 22px 16px;
  border: 0;
  border-bottom: 1px solid #e3e3e3;
  background: #fff;
  text-align: left;
}

.log-item:active {
  background: #f3f7fb;
}

.log-summary {
  display: grid;
  gap: 10px;
}

.log-top-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.log-date {
  display: block;
  color: #202428;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.log-driver {
  display: block;
  color: #3c4146;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}

.log-meta-line {
  display: flex;
  justify-content: flex-end;
}

.log-vehicle-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid #cfe2f3;
  border-radius: 999px;
  background: #f2f8fd;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.log-meter-line {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  color: #161a1e;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}

.log-meter-value {
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-meter-value b {
  color: #161a1e;
  font-weight: 700;
}

.empty-list {
  margin: 0;
  padding: 44px 22px;
  color: var(--muted);
  text-align: center;
}

.loading-list {
  margin: 0;
  padding: 44px 22px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.load-more-area {
  padding: 18px 22px 28px;
  text-align: center;
}

.load-more-area button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.load-more-area button:disabled {
  color: var(--muted);
  background: var(--surface);
}

.main-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: min(100%, 430px);
  min-height: 64px;
  padding: 10px 30px calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid #d9d9d9;
  background: #fff;
  z-index: 18;
}

.main-actions button {
  min-height: 44px;
  border: 0;
  background: #fff;
  color: #050505;
  font-size: 18px;
  font-weight: 800;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 430px);
  min-height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateX(-50%);
  border-top: 1px solid #d9d9d9;
  background: #fff;
  z-index: 18;
}

.bottom-tabs button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #5d6268;
  font-size: 15px;
}

.bottom-tabs button.active {
  color: var(--accent);
  font-weight: 700;
}

.tab-car-icon {
  display: block;
  width: 28px;
  height: 22px;
  object-fit: contain;
  opacity: 0.75;
}

.bottom-tabs button.active .tab-car-icon {
  opacity: 1;
}

.bottom-tabs button.active .tab-pin-icon {
  opacity: 1;
}

.tab-pin-icon {
  display: block;
  width: 24px;
  height: 28px;
  object-fit: contain;
  opacity: 0.78;
}

dialog {
  width: min(calc(100% - 32px), 390px);
  border: 0;
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-card {
  padding: 18px;
}

.dialog-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dialog-card h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-card header button,
.parking-dialog-card header button,
.detail-card header button,
.datetime-card header button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #202124;
  font-size: 28px;
  font-family: Arial, sans-serif;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 8px;
}

.add-row input {
  min-height: 46px;
}

#editableList {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

#editableList li {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid #eee;
}

#editableList button {
  border: 0;
  background: transparent;
  color: #c03d3d;
  font-size: 20px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 82px;
  transform: translateX(-50%);
  min-width: 180px;
  max-width: calc(100% - 40px);
  padding: 10px 14px;
  border-radius: 4px;
  background: rgba(32, 36, 40, 0.9);
  color: white;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#toast.show {
  opacity: 1;
}

.parking-dialog {
  width: min(calc(100% - 18px), 760px);
  max-width: 760px;
  border: 0;
  border-radius: 8px;
  padding: 0;
}

.parking-dialog-card {
  padding: 12px;
  background: #fff;
}

.parking-dialog-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.parking-dialog-card h2 {
  margin: 0;
  font-size: 18px;
}

.parking-large-map {
  position: relative;
  width: 100%;
  aspect-ratio: 691 / 224;
  min-height: 220px;
  overflow: hidden;
  border: 2px solid var(--accent);
  background: #f7e2c6;
  user-select: none;
}

.parking-large-map img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.parking-large-map .parking-pin {
  width: 36px;
  height: 36px;
}

.parking-large-map .parking-pin::before {
  inset: 10px;
}

.parking-large-map .parking-pin span {
  min-width: 64px;
  font-size: 13px;
}

.detail-dialog {
  width: min(calc(100% - 28px), 410px);
  border: 0;
  border-radius: 8px;
  padding: 0;
}

.detail-card {
  padding: 18px;
  background: #fff;
}

.detail-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.detail-card h2 {
  margin: 0;
  font-size: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 10px 14px;
  margin: 0;
  color: var(--text);
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-actions {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.detail-edit-button,
.detail-delete-button {
  min-height: 46px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.detail-delete-button {
  border-color: #cf3535;
  background: #cf3535;
}

.datetime-dialog {
  width: min(calc(100% - 28px), 390px);
  border: 0;
  border-radius: 8px;
  padding: 0;
}

.datetime-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: #fff;
}

.datetime-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.datetime-card h2 {
  margin: 0;
  font-size: 20px;
}

.datetime-card label {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.datetime-card label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.time-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.datetime-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.datetime-actions button {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.datetime-actions button:last-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}



