:root {
  color-scheme: light;
  --bg: linear-gradient(180deg, #fff7fb 0%, #f4f8ff 48%, #eef8f4 100%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-muted: #fffdfd;
  --border: #e2dced;
  --text: #2f2342;
  --muted: #736783;
  --primary: #7c5cff;
  --primary-strong: #5b3ff1;
  --accent: #ff8fb1;
  --mint: #88d9c4;
  --danger: #dc5c74;
  --shadow: 0 18px 44px rgba(98, 82, 153, 0.12);
  font-family: "Inter", "Noto Sans JP", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px;
}

.page-header,
.layout-grid {
  display: grid;
  gap: 20px;
}

.page-header {
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: start;
  margin-bottom: 20px;
}

.title-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-text {
  flex: 1;
  min-width: 0;
}

.page-title-line {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  flex-wrap: wrap;
  margin: 0 0 4px;
}

.page-brand {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.02em;
}

.page-shop {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text);
}

.page-subtitle {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text);
}

.page-logo {
  width: 130px;
  flex-shrink: 0;
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.page-description,
.section-header p,
.label,
.memo-meta,
.slot-meta,
.slot-note,
.zone-kicker {
  color: var(--muted);
}

.layout-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.card,
.dialog-card,
.global-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card {
  padding: 20px;
}

.section-header {
  margin-bottom: 16px;
}

.global-status-card {
  padding: 12px 16px;
}

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

.global-status-card .label {
  font-size: 0.78rem;
}

.global-status-card strong {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
}

.parking-layout {
  display: grid;
  gap: 14px;
}

.site-grid {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: stretch;
}

.simple-site-grid {
  grid-template-columns: minmax(0, 1fr) 92px;
}

.site-context {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border: 1px dashed #d8cdea;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  padding: 12px;
}

.site-context.road {
  background: linear-gradient(90deg, #eef1f6 0%, #e5ebf4 100%);
  border-style: solid;
}

.site-context.vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  min-height: 100%;
  letter-spacing: 0.08em;
}

.parking-area {
  border-radius: 20px;
  padding: 12px 8px;
  background: linear-gradient(180deg, #fffefe 0%, #fdf8ff 100%);
}

.parking-label {
  margin-bottom: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-strong);
}

.parking-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.zone-card {
  border-radius: 20px;
  padding: 10px 6px;
  border: 1px solid #eadff5;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(252,247,255,0.92) 100%);
  min-width: 0;
}

.zone-1 { background: linear-gradient(180deg, #fff7fb 0%, #fff0f7 100%); }
.zone-2 { background: linear-gradient(180deg, #f8f5ff 0%, #f1edff 100%); }
.zone-3 { background: linear-gradient(180deg, #f1f8ff 0%, #eaf4ff 100%); }
.zone-4 { background: linear-gradient(180deg, #f1fff9 0%, #e8fbf3 100%); }

.zone-header {
  margin-bottom: 8px;
  text-align: center;
}

.zone-num {
  font-size: 1.2rem;
  font-weight: 900;
  margin: 0 0 2px;
}

.zone-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0;
}

.zone-slots {
  display: grid;
  gap: 12px;
}

.slot-card {
  border: 1px solid #e6dff2;
  border-radius: 14px;
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  gap: 6px;
  text-align: center;
  width: 100%;
  min-height: 96px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.slot-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(124, 92, 255, 0.14);
}

.slot-card strong {
  font-size: 1rem;
  color: var(--text);
}

.slot-lane {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary-strong);
  margin: 0;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 800;
}

.badge.badge-empty {
  background: #f2f2f7;
  color: #7c8193;
}

.badge.badge-cleaned {
  background: #dcfce7;
  color: #166534;
}

.badge.badge-onsite {
  background: #fef3c7;
  color: #92400e;
}

.badge.badge-hq {
  background: #fee2e2;
  color: #991b1b;
}

.badge.badge-today {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.badge-tomorrow {
  background: #ede9fe;
  color: #6d28d9;
}

.badge.badge-spare {
  background: #d9fbe9;
  color: #0f766e;
}

.badge.badge-waiting {
  background: #ffe4f1;
  color: #b4236a;
}

.side-panel {
  display: grid;
  gap: 20px;
}

.latest-memo {
  display: grid;
  gap: 8px;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
}

.memo-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.field,
.field-group {
  display: grid;
  gap: 8px;
}

.field + .field,
.field + .field-group,
.field-group + .field-group {
  margin-top: 16px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

.autocomplete-field {
  position: relative;
}

.plate-suggestions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.plate-suggestions[hidden] {
  display: none;
}

.plate-option {
  text-align: left;
  background: #fff7fd;
  border: 1px solid #ead8f6;
}

.field-group {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.5);
}

.field-group label {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
}

.status-button-group,
.option-grid,
.usage-button-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-button-group label input,
.option-grid label input,
.usage-button-group label input {
  width: auto;
  margin: 0;
}

.status-pill,
.usage-pill {
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.status-pill span,
.usage-pill span {
  font-weight: 800;
}

.status-cleaned {
  background: #e7f9ee !important;
  color: #166534;
}

.status-onsite {
  background: #fff5d7 !important;
  color: #92400e;
}

.status-hq {
  background: #ffe4e7 !important;
  color: #991b1b;
}

.status-pill:has(input:checked),
.usage-pill:has(input:checked) {
  border-color: rgba(47, 35, 66, 0.16);
  box-shadow: inset 0 0 0 2px rgba(47, 35, 66, 0.08);
  transform: translateY(-1px);
  filter: saturate(1.08) brightness(0.97);
}

.usage-today {
  background: #e4f0ff !important;
  color: #1d4ed8;
}

.usage-tomorrow {
  background: #efe8ff !important;
  color: #6d28d9;
}

.usage-spare {
  background: #dcfaf0 !important;
  color: #0f766e;
}

.usage-waiting {
  background: #ffe4f1 !important;
  color: #b4236a;
}

.action-list,
.dialog-actions {
  display: grid;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: #efeafc;
  color: var(--text);
  font-weight: 800;
}

button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
}

button.primary:hover {
  filter: brightness(0.98);
}

button.danger {
  background: #ffe3ea;
  color: #a61b4d;
}

.slot-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.slot-dialog::backdrop {
  background: rgba(34, 22, 61, 0.35);
}

.dialog-card {
  width: min(560px, calc(100vw - 32px));
  padding: 20px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

.dialog-body {
  display: grid;
  gap: 16px;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
}

@media (max-width: 1120px) {
  .parking-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .page-header,
  .layout-grid {
    grid-template-columns: 1fr;
  }

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

  .slot-card {
    padding: 10px;
    font-size: 0.85rem;
    min-height: 100px;
  }

  .slot-card strong {
    font-size: 1.05rem;
  }

  .simple-site-grid {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .site-context.east {
    font-size: 0.75rem;
    padding: 8px 4px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  .parking-slots {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .slot-card {
    padding: 7px 5px;
    min-height: 80px;
    gap: 5px;
  }

  .slot-card strong {
    font-size: 0.85rem;
  }

  .slot-lane,
  .slot-note {
    font-size: 0.65rem;
  }

  .badge {
    font-size: 0.62rem;
    padding: 3px 6px;
  }

  .slot-id {
    min-width: 20px;
    height: 20px;
    font-size: 0.65rem;
    padding: 0 5px;
  }

  .option-grid,
  .status-button-group,
  .usage-button-group {
    grid-template-columns: 1fr;
  }

  .site-context {
    min-height: 40px;
    font-size: 0.82rem;
  }

  .page-logo {
    width: 90px;
  }
}
