.reservation-entry-btn{
  border:none;
  border-radius:999px;
  background:#003f91;
  color:#fff;
  padding:calc(14px * var(--top-control-scale, 1)) calc(24px * var(--top-control-scale, 1));
  min-height:calc(50px * var(--top-control-scale, 1));
  font-size:calc(19px * var(--top-control-scale, 1));
  font-weight:900;
  cursor:pointer;
  box-shadow:0 3px 9px rgba(0,63,145,0.2);
  line-height:1;
}
.reservation-entry-btn:hover{ background:#002f6c; }
body.reservation-board-open{ overflow:hidden; }
body.reservation-board-resizing{
  cursor:nwse-resize;
  user-select:none;
}
body.reservation-board-resizing *{
  user-select:none;
}

.reservation-board-overlay{
  position:fixed;
  inset:0;
  z-index:2900;
  background:rgba(15,23,42,0.5);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:clamp(14px, 2vw, 36px);
  box-sizing:border-box;
}
.reservation-board-panel{
  --reservation-title-scale:1;
  --reservation-department-scale:1;
  --reservation-table-scale:1;
  --reservation-patient-scale:1;
  --reservation-calendar-scale:1;
  --reservation-form-scale:1.3;
  --reservation-title-font-min:36px;
  --reservation-title-font-vw:2.8vw;
  --reservation-title-font-max:62px;
  --reservation-date-font-min:18px;
  --reservation-date-font-vw:1.1vw;
  --reservation-date-font-max:24px;
  --reservation-room-empty-font:20px;
  --reservation-room-tab-min-width:64px;
  --reservation-room-tab-min-height:54px;
  --reservation-room-tab-padding-y:12px;
  --reservation-room-tab-padding-x:16px;
  --reservation-room-tab-font:22px;
  --reservation-calendar-column-min:360px;
  --reservation-calendar-column-max:540px;
  --reservation-calendar-padding-min:22px;
  --reservation-calendar-padding-vw:1.8vw;
  --reservation-calendar-padding-max:42px;
  --reservation-calendar-control-size:58px;
  --reservation-calendar-header-gap:12px;
  --reservation-calendar-header-margin:18px;
  --reservation-calendar-title-font-min:25px;
  --reservation-calendar-title-font-vw:1.7vw;
  --reservation-calendar-title-font-max:42px;
  --reservation-calendar-month-font:30px;
  --reservation-calendar-grid-gap:8px;
  --reservation-calendar-weekday-margin:10px;
  --reservation-calendar-weekday-font:18px;
  --reservation-calendar-weekday-height:30px;
  --reservation-calendar-date-height:58px;
  --reservation-calendar-date-font:21px;
  --reservation-form-width:728px;
  --reservation-form-gap:23px;
  --reservation-form-padding:36px;
  --reservation-form-title-font:42px;
  --reservation-form-summary-gap:13px;
  --reservation-form-summary-padding:18px;
  --reservation-form-summary-label-font:21px;
  --reservation-form-summary-value-font:25px;
  --reservation-form-label-gap:10px;
  --reservation-form-label-font:26px;
  --reservation-form-input-padding-y:18px;
  --reservation-form-input-padding-x:21px;
  --reservation-form-input-font:26px;
  --reservation-form-textarea-min-height:120px;
  --reservation-form-message-min-height:36px;
  --reservation-form-message-font:23px;
  --reservation-form-actions-gap:16px;
  --reservation-form-button-min-height:70px;
  --reservation-form-button-padding-y:18px;
  --reservation-form-button-padding-x:29px;
  --reservation-form-button-font:26px;
  --reservation-row-height:48px;
  --reservation-schedule-head-font:22px;
  --reservation-slot-time-font:21px;
  --reservation-slot-patient-font:25px;
  --reservation-slot-treatment-font:24px;
  --reservation-slot-memo-font:21px;
  --reservation-empty-state-font:22px;
  --reservation-mobile-table-font:18px;
  --reservation-mobile-patient-font:18px;
  --reservation-status-button-scale:1.3;
  --reservation-schedule-min-width:720px;
  --reservation-time-column-min:190px;
  --reservation-patient-column-min:140px;
  --reservation-treatment-column-min:170px;
  --reservation-memo-column-min:160px;
  --reservation-status-column-min:210px;
  --reservation-time-column:250px;
  --reservation-patient-column:320px;
  --reservation-treatment-column:320px;
  --reservation-memo-column:300px;
  --reservation-status-column:300px;
  position:relative;
  width:84vw;
  height:84vh;
  min-width:min(700px, calc(100vw - 28px));
  min-height:min(450px, calc(100vh - 28px));
  max-width:calc(100vw - 28px);
  max-height:calc(100vh - 28px);
  background:#f8fafc;
  border-radius:8px;
  box-shadow:0 24px 70px rgba(15,23,42,0.38);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.reservation-board-header{
  display:grid;
  grid-template-columns:minmax(240px, 1fr) auto auto auto;
  gap:clamp(16px, 1.5vw, 30px);
  align-items:center;
  padding:clamp(18px, 1.5vw, 34px) clamp(22px, 2vw, 46px);
  background:#fff;
  border-bottom:1px solid #dce5ef;
  flex:0 0 auto;
}
.reservation-board-title-group{
  min-width:0;
}
.reservation-board-title-group h3{
  margin:0;
  color:#002f6c;
  font-size:clamp(var(--reservation-title-font-min), var(--reservation-title-font-vw), var(--reservation-title-font-max));
  line-height:1.08;
  font-weight:1000;
  letter-spacing:0;
}
.reservation-board-title-group p{
  margin:8px 0 0;
  color:#536171;
  font-size:clamp(var(--reservation-date-font-min), var(--reservation-date-font-vw), var(--reservation-date-font-max));
  line-height:1.25;
  font-weight:800;
}
.reservation-room-tabs{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.reservation-room-empty{
  color:#607083;
  font-size:var(--reservation-room-empty-font);
  line-height:1.25;
  font-weight:900;
}
.reservation-room-tab{
  border:2px solid #d8e0ea;
  border-radius:8px;
  background:#fff;
  color:#25364a;
  min-width:var(--reservation-room-tab-min-width);
  min-height:var(--reservation-room-tab-min-height);
  padding:var(--reservation-room-tab-padding-y) var(--reservation-room-tab-padding-x);
  font-size:var(--reservation-room-tab-font);
  line-height:1;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
}
.reservation-room-tab.on{
  background:#0d6efd;
  color:#fff;
  border-color:#0d6efd;
  box-shadow:0 0 0 3px rgba(13,110,253,0.18);
}
.reservation-board-close{
  border:none;
  border-radius:8px;
  background:#eef4fb;
  color:#25364a;
  width:64px;
  height:64px;
  font-size:42px;
  line-height:1;
  font-weight:900;
  cursor:pointer;
}
.reservation-board-maximize{
  border:none;
  border-radius:8px;
  background:#eef4fb;
  color:#25364a;
  width:64px;
  height:64px;
  font-size:42px;
  line-height:1;
  font-weight:900;
  cursor:pointer;
}
.reservation-board-maximize{
  font-size:34px;
}
.reservation-board-close:hover{
  background:#ffecec;
  color:#9b1c1c;
}
.reservation-board-maximize:hover{
  background:#dce9fb;
  color:#003f91;
}
.reservation-board-body{
  display:grid;
  grid-template-columns:minmax(var(--reservation-calendar-column-min), var(--reservation-calendar-column-max)) minmax(0, 1fr);
  min-height:0;
  flex:1 1 auto;
  overflow:auto;
}
.reservation-calendar-panel{
  border-right:1px solid #dce5ef;
  background:#fff;
  padding:clamp(var(--reservation-calendar-padding-min), var(--reservation-calendar-padding-vw), var(--reservation-calendar-padding-max));
  overflow:auto;
}
.reservation-calendar-header{
  display:grid;
  grid-template-columns:var(--reservation-calendar-control-size) minmax(0, 1fr) var(--reservation-calendar-control-size);
  gap:var(--reservation-calendar-header-gap);
  align-items:center;
  margin-bottom:var(--reservation-calendar-header-margin);
}
.reservation-calendar-header h4{
  margin:0;
  text-align:center;
  color:#25364a;
  font-size:clamp(var(--reservation-calendar-title-font-min), var(--reservation-calendar-title-font-vw), var(--reservation-calendar-title-font-max));
  line-height:1.15;
  font-weight:1000;
  white-space:nowrap;
  min-width:max-content;
}
.reservation-month-btn{
  border:none;
  border-radius:8px;
  background:#e9eef5;
  color:#25364a;
  min-width:var(--reservation-calendar-control-size);
  min-height:var(--reservation-calendar-control-size);
  font-size:var(--reservation-calendar-month-font);
  line-height:1;
  font-weight:900;
  cursor:pointer;
}
.reservation-month-btn:hover{ background:#dce9fb; }
.reservation-weekdays,
.reservation-calendar-grid{
  display:grid;
  grid-template-columns:repeat(7, minmax(0, 1fr));
  gap:var(--reservation-calendar-grid-gap);
}
.reservation-weekdays{
  margin-bottom:var(--reservation-calendar-weekday-margin);
  color:#607083;
  font-size:var(--reservation-calendar-weekday-font);
  font-weight:900;
  text-align:center;
}
.reservation-weekdays span{
  min-height:var(--reservation-calendar-weekday-height);
  display:flex;
  align-items:center;
  justify-content:center;
}
.reservation-date-cell{
  border:2px solid transparent;
  border-radius:8px;
  background:#f2f6fb;
  color:#25364a;
  min-height:var(--reservation-calendar-date-height);
  font-size:var(--reservation-calendar-date-font);
  line-height:1;
  font-weight:900;
  cursor:pointer;
}
.reservation-date-cell:hover{
  border-color:#9ebbe3;
  background:#eaf2ff;
}
.reservation-date-cell.is-muted{
  color:#a5b0bd;
  background:#f8fafc;
}
.reservation-date-cell.is-today{
  border-color:#ff9800;
  color:#9b4b00;
}
.reservation-date-cell.is-selected{
  background:#003f91;
  border-color:#003f91;
  color:#fff;
  box-shadow:0 0 0 3px rgba(0,63,145,0.18);
}
.reservation-date-cell.is-selected.is-today{
  border-color:#003f91;
  color:#fff;
}
.reservation-schedule-panel{
  min-width:0;
  padding:clamp(22px, 1.8vw, 42px);
  padding-bottom:calc(clamp(22px, 1.8vw, 42px) + 42px);
  overflow-y:auto;
  overflow-x:auto;
}
.reservation-schedule-head,
.reservation-slot-row{
  display:grid;
  grid-template-columns:minmax(var(--reservation-time-column-min), var(--reservation-time-column)) minmax(var(--reservation-patient-column-min), var(--reservation-patient-column)) minmax(var(--reservation-treatment-column-min), var(--reservation-treatment-column)) minmax(var(--reservation-memo-column-min), var(--reservation-memo-column)) minmax(var(--reservation-status-column-min), var(--reservation-status-column));
  gap:14px;
  align-items:center;
  box-sizing:border-box;
  min-width:var(--reservation-schedule-min-width);
  width:100%;
}
.reservation-schedule-head > *,
.reservation-slot-row > *{
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
  overflow:hidden;
}
.reservation-schedule-head{
  position:sticky;
  top:0;
  z-index:1;
  background:#002f6c;
  color:#fff;
  border-radius:8px 8px 0 0;
  padding:18px 25px;
  font-size:var(--reservation-schedule-head-font);
  line-height:1;
  font-weight:1000;
}
.reservation-schedule-list{
  display:grid;
  gap:8px;
}
.reservation-slot-row{
  min-height:var(--reservation-row-height);
  padding:14px 22px;
  border:1px solid #dce5ef;
  background:#fff;
}
.reservation-slot-row.is-open{
  cursor:pointer;
}
.reservation-slot-row.is-open:hover,
.reservation-slot-row.is-open:focus{
  border-color:#9ebbe3;
  background:#f6faff;
  outline:none;
}
.reservation-slot-row:first-child{
  border-top:none;
}
.reservation-slot-row.has-reservation{
  border-color:#bfd4f2;
  background:#eef6ff;
  cursor:pointer;
}
.reservation-slot-row.status-visit{
  border-color:rgba(34, 197, 94, 0.34);
  background:rgba(34, 197, 94, 0.12);
}
.reservation-slot-row.status-noshow{
  border-color:rgba(107, 114, 128, 0.32);
  background:rgba(107, 114, 128, 0.12);
}
.reservation-slot-row.status-cancel{
  border-color:rgba(239, 68, 68, 0.34);
  background:rgba(239, 68, 68, 0.12);
}
.reservation-slot-row.has-reservation:hover,
.reservation-slot-row.has-reservation:focus{
  border-color:#7ca8df;
  background:#e3f0ff;
  outline:none;
}
.reservation-slot-row.status-visit:hover,
.reservation-slot-row.status-visit:focus{
  border-color:rgba(22, 163, 74, 0.55);
  background:rgba(34, 197, 94, 0.18);
}
.reservation-slot-row.status-noshow:hover,
.reservation-slot-row.status-noshow:focus{
  border-color:rgba(75, 85, 99, 0.48);
  background:rgba(107, 114, 128, 0.18);
}
.reservation-slot-row.status-cancel:hover,
.reservation-slot-row.status-cancel:focus{
  border-color:rgba(220, 38, 38, 0.55);
  background:rgba(239, 68, 68, 0.18);
}
.reservation-slot-time{
  color:#25364a;
  font-size:var(--reservation-slot-time-font);
  line-height:1.15;
  font-weight:1000;
  overflow:hidden;
  text-overflow:clip;
  white-space:nowrap;
}
.reservation-slot-patient{
  color:#111827;
  font-size:var(--reservation-slot-patient-font);
  line-height:1.2;
  font-weight:1000;
  white-space:normal;
  overflow-wrap:break-word;
  word-break:keep-all;
}
.reservation-slot-treatment{
  color:#003f91;
  font-size:var(--reservation-slot-treatment-font);
  line-height:1.2;
  font-weight:900;
  white-space:normal;
  overflow-wrap:break-word;
  word-break:keep-all;
}
.reservation-slot-memo{
  color:#536171;
  font-size:var(--reservation-slot-memo-font);
  line-height:1.2;
  font-weight:800;
  white-space:normal;
  overflow-wrap:break-word;
  word-break:keep-all;
}
.reservation-slot-empty{
  color:#b1bbc8;
}
.reservation-slot-patient{
  display:flex;
  align-items:center;
  gap:10px;
}
.reservation-slot-patient > span:first-child{
  min-width:0;
}
.reservation-department-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  border:1px solid rgba(15,23,42,0.16);
  border-radius:999px;
  padding:4px 10px;
  color:#111827;
  font-size:.62em;
  line-height:1;
  font-weight:1000;
  white-space:nowrap;
}
.reservation-status-actions{
  display:flex;
  align-items:center;
  gap:calc(8px * var(--reservation-status-button-scale));
  min-width:0;
}
.reservation-status-btn{
  border:2px solid transparent;
  border-radius:999px;
  padding:calc(7px * var(--reservation-status-button-scale)) calc(11px * var(--reservation-status-button-scale));
  min-height:calc(34px * var(--reservation-status-button-scale));
  color:#25364a;
  font-size:clamp(15px, calc(var(--reservation-slot-memo-font) * .72 * var(--reservation-status-button-scale)), 32px);
  line-height:1;
  font-weight:1000;
  cursor:pointer;
  white-space:nowrap;
}
.reservation-status-btn.status-visit{
  border-color:rgba(34, 197, 94, 0.32);
  background:rgba(34, 197, 94, 0.10);
}
.reservation-status-btn.status-noshow{
  border-color:rgba(107, 114, 128, 0.30);
  background:rgba(107, 114, 128, 0.10);
}
.reservation-status-btn.status-cancel{
  border-color:rgba(239, 68, 68, 0.32);
  background:rgba(239, 68, 68, 0.10);
}
.reservation-status-btn.status-visit.is-selected{
  border-color:rgba(22, 163, 74, 0.75);
  background:rgba(34, 197, 94, 0.28);
  color:#14532d;
}
.reservation-status-btn.status-noshow.is-selected{
  border-color:rgba(75, 85, 99, 0.72);
  background:rgba(107, 114, 128, 0.26);
  color:#374151;
}
.reservation-status-btn.status-cancel.is-selected{
  border-color:rgba(220, 38, 38, 0.75);
  background:rgba(239, 68, 68, 0.28);
  color:#7f1d1d;
}
.reservation-empty-state{
  border:1px dashed #b8c6d8;
  border-radius:8px;
  background:#fff;
  color:#536171;
  padding:24px;
  font-size:var(--reservation-empty-state-font);
  line-height:1.35;
  font-weight:900;
}
.reservation-resize-handle{
  position:absolute;
  right:0;
  bottom:0;
  width:48px;
  height:48px;
  border:none;
  border-radius:8px 0 8px 0;
  background:transparent;
  cursor:nwse-resize;
  touch-action:none;
  z-index:4;
}
.reservation-resize-handle::before{
  content:"";
  position:absolute;
  right:10px;
  bottom:10px;
  width:24px;
  height:24px;
  border-right:5px solid #607083;
  border-bottom:5px solid #607083;
  box-sizing:border-box;
}
.reservation-resize-handle::after{
  content:"";
  position:absolute;
  right:21px;
  bottom:10px;
  width:13px;
  height:13px;
  border-right:4px solid rgba(96,112,131,0.65);
  border-bottom:4px solid rgba(96,112,131,0.65);
  box-sizing:border-box;
}
.reservation-resize-handle:hover{
  background:rgba(0,63,145,0.08);
}
.reservation-board-panel.is-maximized .reservation-resize-handle{
  opacity:.45;
}
.reservation-form-overlay,
.reservation-detail-overlay{
  position:absolute;
  inset:0;
  z-index:6;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(15,23,42,0.22);
  box-sizing:border-box;
}
.reservation-detail-overlay{
  z-index:7;
}
.reservation-form-dialog{
  width:min(var(--reservation-form-width), 100%);
  max-height:calc(100% - 24px);
  overflow:auto;
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  gap:var(--reservation-form-gap);
  background:#fff;
  border:1px solid #dce5ef;
  border-radius:8px;
  box-shadow:0 18px 48px rgba(15,23,42,0.32);
  padding:var(--reservation-form-padding);
}
.reservation-form-dialog h4{
  margin:0;
  color:#002f6c;
  font-size:var(--reservation-form-title-font);
  line-height:1.15;
  font-weight:1000;
}
.reservation-form-summary{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:var(--reservation-form-summary-gap);
  padding:var(--reservation-form-summary-padding);
  border-radius:8px;
  background:#f2f6fb;
}
.reservation-form-summary div{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:calc(5px * var(--reservation-form-scale));
}
.reservation-form-summary span{
  color:#607083;
  font-size:var(--reservation-form-summary-label-font);
  line-height:1.1;
  font-weight:900;
}
.reservation-form-summary strong{
  color:#25364a;
  font-size:var(--reservation-form-summary-value-font);
  line-height:1.2;
  font-weight:1000;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.reservation-form-dialog label{
  display:flex;
  flex-direction:column;
  gap:var(--reservation-form-label-gap);
  color:#25364a;
  font-size:var(--reservation-form-label-font);
  line-height:1.25;
  font-weight:900;
}
.reservation-form-dialog input,
.reservation-form-dialog textarea{
  width:100%;
  box-sizing:border-box;
  border:2px solid #d8e0ea;
  border-radius:8px;
  padding:var(--reservation-form-input-padding-y) var(--reservation-form-input-padding-x);
  font:inherit;
  font-size:var(--reservation-form-input-font);
  line-height:1.25;
}
.reservation-form-dialog textarea{
  resize:vertical;
  min-height:var(--reservation-form-textarea-min-height);
}
.reservation-form-message{
  min-height:var(--reservation-form-message-min-height);
  color:#536171;
  font-size:var(--reservation-form-message-font);
  line-height:1.35;
  font-weight:800;
}
.reservation-form-message.error{ color:#b42318; }
.reservation-form-message.ok{ color:#137333; }
.reservation-form-actions{
  display:flex;
  justify-content:flex-end;
  gap:var(--reservation-form-actions-gap);
  flex-wrap:wrap;
}
.reservation-form-secondary,
.reservation-form-save{
  border:none;
  border-radius:8px;
  min-height:var(--reservation-form-button-min-height);
  padding:var(--reservation-form-button-padding-y) var(--reservation-form-button-padding-x);
  font-size:var(--reservation-form-button-font);
  line-height:1;
  font-weight:900;
  cursor:pointer;
}
.reservation-form-secondary{
  background:#e9eef5;
  color:#25364a;
}
.reservation-form-save{
  background:#0d6efd;
  color:#fff;
}
.reservation-form-save:disabled,
.reservation-form-secondary:disabled,
.reservation-delete:disabled{
  opacity:.6;
  cursor:not-allowed;
}
.reservation-detail-actions{
  display:flex;
  justify-content:space-between;
  gap:var(--reservation-form-actions-gap);
  align-items:center;
  flex-wrap:wrap;
}
.reservation-detail-save-actions{
  display:flex;
  justify-content:flex-end;
  gap:var(--reservation-form-actions-gap);
  flex-wrap:wrap;
}
.reservation-delete{
  border:none;
  border-radius:8px;
  min-height:var(--reservation-form-button-min-height);
  padding:var(--reservation-form-button-padding-y) var(--reservation-form-button-padding-x);
  font-size:var(--reservation-form-button-font);
  line-height:1;
  font-weight:900;
  cursor:pointer;
  background:#ffecec;
  color:#9b1c1c;
  border:1px solid #f5b3b3;
}
.reservation-delete:hover{
  background:#ffdede;
}

@media (max-width:900px){
  .reservation-board-panel{
    width:96vw;
    height:94vh;
  }
  .reservation-board-header{
    grid-template-columns:minmax(0, 1fr) auto auto;
  }
  .reservation-room-tabs{
    grid-column:1 / -1;
    grid-row:2;
    justify-content:flex-start;
  }
  .reservation-board-maximize{
    grid-column:2;
    grid-row:1;
  }
  .reservation-board-close{
    grid-column:3;
    grid-row:1;
  }
  .reservation-board-body{
    grid-template-columns:1fr;
  }
  .reservation-calendar-panel{
    border-right:none;
    border-bottom:1px solid #dce5ef;
    max-height:40vh;
  }
  .reservation-schedule-head,
  .reservation-slot-row{
    grid-template-columns:minmax(var(--reservation-time-column-min), var(--reservation-time-column)) minmax(var(--reservation-patient-column-min), var(--reservation-patient-column)) minmax(var(--reservation-treatment-column-min), var(--reservation-treatment-column)) minmax(var(--reservation-memo-column-min), var(--reservation-memo-column)) minmax(var(--reservation-status-column-min), var(--reservation-status-column));
    gap:10px;
  }
  .reservation-slot-row{
    padding:12px 14px;
  }
  .reservation-slot-time,
  .reservation-slot-treatment,
  .reservation-slot-memo{
    font-size:var(--reservation-mobile-table-font);
  }
  .reservation-slot-patient{
    font-size:var(--reservation-mobile-patient-font);
  }
  .reservation-form-summary{
    grid-template-columns:1fr;
  }
  .reservation-form-dialog{
    padding:min(var(--reservation-form-padding), 20px);
  }
  .reservation-detail-actions,
  .reservation-detail-save-actions{
    align-items:stretch;
  }
}
