.demo-auto {
  --navy: #1B3A4B;
  --orange: #D97B3F;
  --orange-deep: #B25A20;
  --white: #FAFAF7;
  --paper: #F2F0E8;
  --ink: #233138;
  --ink-soft: #5C6B70;
  --line: #DCD8CC;
  --ok: #3C8C5C;
  background: var(--paper);
}
.demo-auto * { box-sizing: border-box; }
.demo-auto main { max-width: 1040px; margin: 0 auto; padding: 32px 20px 80px; }
.demo-auto h1 { font-size: 22px; margin: 0 0 4px; }
.demo-auto .subhead { color: var(--ink-soft); font-size: 13px; margin-bottom: 24px; }

/* タブ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--line);
}
.tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transform: translateY(2px);
  transition: color 0.15s ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--orange-deep);
  border-bottom-color: var(--orange);
}
.tab-panel { display: none; padding-top: 24px; }
.tab-panel.active { display: block; }

section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 28px;
  overflow: hidden;
}
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #FBFAF6;
  flex-wrap: wrap;
  gap: 8px;
}
.sec-head h2 { font-size: 15px; margin: 0; }
.sec-head .date { font-size: 12px; color: var(--ink-soft); }

/* 今日のご予約 */
.res-list { list-style: none; margin: 0; padding: 0; }
.res-item {
  display: grid;
  grid-template-columns: 70px 1fr 110px 100px;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s ease;
}
.res-item:last-child { border-bottom: none; }
.res-item:hover { background: #FBF4EC; }
.res-item.new-row { animation: flashIn 1.2s ease; }
@keyframes flashIn { 0% { background: #DEEFE2; } 100% { background: transparent; } }
.res-time { font-size: 15px; font-weight: 700; color: var(--navy); }
.res-main .name { font-size: 14.5px; font-weight: 700; }
.res-main .sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.res-mechanic { font-size: 12.5px; color: var(--ink-soft); }
.status { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; text-align: center; white-space: nowrap; }
.status.wait { background: #FAF1D6; color: #8A6D14; }
.status.doing { background: #FDE8D8; color: var(--orange-deep); }
.status.done { background: #DEEFE2; color: var(--ok); }

@media (max-width: 600px) {
  .res-item { grid-template-columns: 50px 1fr; grid-template-rows: auto auto; }
  .res-mechanic, .status { grid-column: 2; }
}

.detail-panel {
  display: none;
  padding: 18px 20px;
  background: #FBFAF6;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  line-height: 2;
  color: var(--ink-soft);
}
.detail-panel.open { display: block; }
.detail-panel b { color: var(--ink); }
.detail-panel .hist { margin-top: 8px; padding-left: 16px; }

.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

/* タイムスケジュール */
.sched-wrap { overflow-x: auto; padding: 16px 20px 24px; }
table.sched { border-collapse: collapse; width: 100%; min-width: 974px; font-size: 12.5px; table-layout: fixed; }
table.sched th, table.sched td { border: 1px solid var(--line); text-align: center; height: 78px; width: 96px; }
table.sched th { background: #F4F2EA; font-weight: 700; color: var(--ink-soft); font-size: 11.5px; height: 36px; }
table.sched th.mech-name { background: var(--navy); color: var(--white); text-align: left; padding-left: 14px; width: 110px; }
table.sched td.slot { transition: background 0.12s ease; position: relative; padding: 5px; vertical-align: middle; }
table.sched td.slot:not(.booked) { cursor: pointer; }
table.sched td.slot:not(.booked):hover { background: #EFEFE6; }
table.sched td.slot.booked { background: #FAF1D6; color: #8A6D14; cursor: pointer; transition: filter 0.12s ease; }
table.sched td.slot.booked:hover { filter: brightness(0.96); }
table.sched td.slot.booked.status-doing { background: #FDE8D8; color: var(--orange-deep); }
table.sched td.slot.booked.status-done { background: #DEEFE2; color: var(--ok); }
.slot-card { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.slot-card .s-name { font-weight: 700; font-size: 11.5px; }
.slot-card .s-car { font-size: 10.5px; white-space: normal; word-break: break-word; }
.slot-card .s-detail { font-size: 10.5px; opacity: 0.85; white-space: normal; word-break: break-word; }
.legend { display: flex; gap: 18px; padding: 0 20px 18px; font-size: 12px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dot.empty { background: #fff; border: 1px solid var(--line); }
.dot.wait { background: #FAF1D6; }
.dot.doing { background: #FDE8D8; }
.dot.done { background: #DEEFE2; }

.hint { padding: 10px 20px; font-size: 12px; color: var(--ink-soft); background: #FBFAF6; border-top: 1px solid var(--line); }

/* モーダル */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(27, 58, 75, 0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: 6px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
}
.modal-head {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px;
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head .slot-info { font-size: 12px; color: #CFE0E6; font-weight: 400; margin-top: 4px; }
.modal-close { background: none; border: none; color: var(--white); font-size: 18px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.field select, .field input {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 13.5px; background: var(--white); color: var(--ink); font-family: inherit;
}
.field select:focus, .field input:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px 20px; }
button.btn-cancel {
  background: none; border: 1px solid var(--line); color: var(--ink-soft);
  padding: 9px 18px; border-radius: 4px; font-size: 13px; cursor: pointer; font-family: inherit;
}
button.btn-submit {
  background: var(--orange); color: var(--white); border: none;
  padding: 9px 20px; border-radius: 4px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: background 0.15s ease;
}
button.btn-submit:hover { background: var(--orange-deep); }
button.btn-submit:disabled { background: #E3B891; cursor: default; }

/* 詳細モーダル */
.detail-modal-body { display: flex; flex-direction: column; gap: 0; padding: 4px 20px 8px; }
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.detail-row:last-child { border-bottom: none; }
.d-label { color: var(--ink-soft); font-size: 12.5px; }
.d-value { font-weight: 700; color: var(--ink); text-align: right; }
.detail-actions { flex-wrap: wrap; justify-content: space-between; }
button.btn-delete {
  background: none; border: 1px solid var(--loss, #C44545); color: #C44545;
  padding: 9px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; font-family: inherit;
  transition: background 0.15s ease;
}
button.btn-delete:hover { background: #FBEAEA; }

#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--white); padding: 12px 22px; border-radius: 6px;
  font-size: 13px; opacity: 0; transition: all 0.25s ease; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

