/* ======================= */
/* 共通設定                 */
/* ======================= */
:root {
    /* Colors */
    --color-bg: #f3f4f6;
    --color-surface: #ffffff;
    --color-text: #111827;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-border-strong: #d1d5db;
    --color-primary: #2563eb;
    --color-primary-strong: #1f6feb;
    --color-accent: #18a68e;
    --color-accent-strong: #4abaa7;
    --color-danger: #d1242f;
    --color-warning: #d1242f;
    ;
    --color-sidebar-bg: #111827;
    --color-sidebar-text: #ffffff;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Shadow */
    --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.25);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.page {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.main {
    padding: 16px 12px 32px;
}

/* Header */
.site-header {
    background: var(--color-sidebar-bg);
    padding: 16px 12px;
    z-index: 8000;
}

.site-header__title {
    margin: 0;
    text-align: center;
    color: var(--color-sidebar-text);
    font-size: 18px;
    font-weight: 700;
}

/* スタッフ代行入力バッジ */
.site-header__proxy-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    background: var(--color-danger);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 4px;
    margin-bottom: 8px;
    animation: pulse-badge 1.5s ease-in-out infinite;
}

.site-header__proxy-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: -4px;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.site-header__proxy-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* Stepper */
.stepper {
    background: #fff;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.stepper__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 12px;
    color: #6b7280;
}

.stepper__item {
    position: relative;
    padding-right: 14px;
}

.stepper__item::after {
    content: ">";
    position: absolute;
    right: 2px;
    top: 0;
    color: #d1d5db;
}

.stepper__item:last-child {
    padding-right: 0;
}

.stepper__item:last-child::after {
    content: "";
}

.stepper__item.is-current {
    color: #111827;
    font-weight: 700;
}

/* Panel (カード枠) */
.panel {
    max-width: 520px;
    /* 1カラム想定 */
    margin: 0 auto;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 18px 12px 16px;
    box-shadow: var(--shadow-sm);
}

.panel__header {
    margin-bottom: 10px;
}

.panel__title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

/* PCで少し余白UP */
@media (min-width: 768px) {
    .main {
        padding: 24px 16px 40px;
    }

    .panel {
        padding: 22px 18px 18px;
    }

    .panel__title {
        font-size: 20px;
    }
}

th.sortable {
    cursor: pointer;
    text-decoration: underline;
}

th.sortable:hover {
    background: #f9fafb;
}

/* ======================= */
/* 日時選択画面             */
/* ======================= */
/* Month nav */
.month-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin: 10px 0 12px;
}

.month-nav__label {
    text-align: center;
    font-weight: 800;
    font-size: 18px;
}

.month-nav__link {
    font-size: 14px;
    color: #2563eb;
    font-weight: 700;
}

.month-nav__link--prev {
    justify-self: start;
}

.month-nav__link--next {
    justify-self: end;
}

/* PCで少し余白UP */
@media (min-width: 768px) {
    .month-nav__label {
        font-size: 20px;
    }
}

/* Schedule (表) */
.schedule {
    overflow-x: auto;
    padding-bottom: 6px;
}

.schedule__head,
.schedule__row {
    /* 左の時間列 + 7日分 */
    display: grid;
    grid-template-columns: 64px repeat(7, 44px);
    column-gap: 8px;
    align-items: center;
    min-width: calc(64px + (44px * 7) + (8px * 7));
}

.schedule__head {
    margin-bottom: 8px;
}

.schedule__corner {
    height: 1px;
    /* 左上は空 */
}

.schedule__day {
    text-align: center;
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
}

.schedule__date {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.schedule__dow {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.1;
    margin-top: 2px;
}

.schedule__day.is-sat .schedule__dow,
.schedule__day.is-sat .schedule__date {
    color: #2563eb;
}

.schedule__day.is-sun .schedule__dow,
.schedule__day.is-sun .schedule__date {
    color: #ef4444;
}

.schedule__body {
    display: grid;
    row-gap: 8px;
}

.schedule__time {
    font-size: 12px;
    color: #6b7280;
    text-align: right;
    padding-right: 6px;
}

.schedule-menu__title {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Slot button */
.slot {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    user-select: none;
    background: #fff;
}

.slot.is-ok {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
    cursor: pointer;
}

.slot.is-ng {
    background: #d1d5db;
    border-color: #d1d5db;
    color: #fff;
}

/* 代行モード時：占有枠（既存予約が入っている時間帯） */
.schedule[data-staff-proxy-mode="1"] .slot.is-ng.is-ng--occupied {
    background: #d1d5db;
    border-color: #d1d5db;
}

.slot.is-off {
    background: #fff;
    border-color: #d1d5db;
    color: transparent;
}

.slot.is-tel {
    background: #fef9c3;
    border-color: #fde047;
    color: #854d0e;
}

/* クリック可能な枠は指マーク（代行モードで休診・TEL・×枠もクリック可能になるため） */
.slot:not([disabled]) {
    cursor: pointer;
}

.slot:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

/* クリックで選択状態にしたい場合（JSで is-selected を付ける想定） */
.slot.is-selected {
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.25);
}

/* Legend */
.legend {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #374151;
}

.legend__mark {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
}

/* legendは小さく見せたいので上書き */
.legend__mark.slot {
    width: 26px;
    height: 26px;
    font-weight: 900;
    cursor: default;
}

/* 凡例の予約不可(施術中)は占有枠と同じ黒寄りグレー */
.legend__mark.slot.is-ng.is-ng--occupied {
    background: #4b5563;
    border-color: #4b5563;
}

/* ======================= */
/* フォーム（共通）         */
/* ======================= */
/* Form blocks */
.form-block {
    margin-top: 14px;
}

.form-block__label {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 900;
    font-size: 13px;
}

.form-block__value {
    margin-top: 10px;
    padding-left: 6px;
    font-size: 18px;
    font-weight: 900;
    color: #111827;
}

/* Inputs */
.input,
.select {
    width: 100%;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
}

.input:focus-visible,
.select:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.input--full,
.select--full {
    margin-top: 10px;
}

/* Choice list (radio/checkbox) */
.choice-list {
    margin-top: 10px;
    display: grid;
    row-gap: 14px;
    padding-left: 6px;
}

.choice {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    column-gap: 10px;
}

.choice__input {
    width: 18px;
    height: 18px;
    accent-color: #111827;
    /* modern browsers */
}

.choice__text {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
}

.choice:has(.choice__input:disabled) .choice__text {
    color: #9ca3af;
}

/* Textarea */
.textarea {
    width: 100%;
    margin-top: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    background: #fff;
    line-height: 1.5;
}

.textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

/* Actions / Buttons */


/* *********************************************** */
/* ボタンのルール */
/* ボタンは form-actions の中に配置すること */
/* サイズ、位置、スタイルを指定すること */
/* *********************************************** */
.form-actions {
    margin: 12px 0;
    display: flex;
    gap: 12px;
}

.form-actions-nomargin {
    margin: 0;
    display: flex;
    gap: 12px;
}

/* ボタン共通 */
.form-actions button,
.form-actions a,
.form-actions-nomargin a,
.form-actions-nomargin button {
    border: 2px solid transparent;
    cursor: pointer;
    font-weight: 900;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 54px;
    min-width: 120px;
    border-radius: 10px;
    font-size: 16px;
}

.form-actions .left,
.form-actions-nomargin .left {
    margin-right: auto;
}

/* サイズ */

.form-actions .mini,
.form-actions-nomargin .mini {
    height: 36px;
    min-width: 60px;
    border-radius: 8px;
    font-size: 12px;
}

.form-actions .full,
.form-actions-nomargin .full {
    width: 100%;
    height: 54px;
    border-radius: 10px;
    font-size: 16px;
}

/* 種類 */
.form-actions .ghost,
.form-actions-nomargin .ghost {
    background: #fff;
    border-color: #18a68e;
    color: #18a68e;
}

.form-actions .primary,
.form-actions-nomargin .primary {
    background: #4abaa7;
    border-color: #18a68e;
    color: #fff;
}

.form-actions .approve,
.form-actions-nomargin .approve {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.form-actions .reject,
.form-actions-nomargin .reject {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.form-actions .cancel,
.form-actions-nomargin .cancel {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #d1d5db;
    color: #6b7280;
}





/* インフォボックス */
.info-box {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    background: #c8e4df;
    color: #111827;
    font-size: 16px;
    font-weight: 900;
}
.info-box--success {
    background: #d1fae5;
    color: #065f46;
}
.info-box--error {
    background: #fee2e2;
    color: #991b1b;
}


/* 状態 */
.form-actions btn:active,
.form-actions-nomargin btn:active {
    transform: translateY(1px);
}

.form-actions btn:disabled,
.form-actions-nomargin btn:disabled {
    background: #d1d5db;
    border-color: #d1d5db;
    color: #6b7280;
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions btn:focus-visible,
.form-actions-nomargin btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

/*Responsive (PC) */
@media (min-width: 768px) {
    .form-block__value {
        font-size: 20px;
    }
}

/* フォームレイアウト */
.field-grid {
    margin-top: 12px;
    padding-left: 6px;
    display: grid;
    row-gap: 12px;
}

/* label + control row (姓/名, セイ/メイ) */
.field-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    column-gap: 10px;
}

.field-row__label {
    text-align: right;
    font-size: 14px;
    font-weight: 800;
    color: #6b7280;
}

/* Inline choice row (性別・元号) */
.choice-row {
    margin-top: 12px;
    padding-left: 6px;
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
}

.choice--inline {
    grid-template-columns: 22px auto;
}

.choice--inline .choice__text {
    font-size: 14px;
    font-weight: 900;
}

/* Birthday y/m/d */
.birthday {
    margin-top: 4px;
}

.birthday__ymd {
    margin-top: 10px;
    padding-left: 6px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ymd {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.input--ymd {
    width: 64px;
    text-align: center;
    padding: 8px 6px;
}

.ymd__suffix {
    font-size: 14px;
    font-weight: 900;
    color: #111827;
}


/* ======================= */
/* 内容確認画面             */
/* ======================= */
.confirm-section {
    margin-top: 18px;
}

.confirm-section__title {
    margin-top: 6px;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    color: #0b0c0e;
    background-color: #a9d6ce;
    padding: 8px;
    border-radius: 6px;
}

/* 複数行の値（オプション等） */
.confirm-values {
    margin-top: 10px;
    padding-left: 6px;
    display: grid;
    row-gap: 10px;
}

.confirm-values__item {
    font-size: 18px;
    font-weight: 900;
    color: #111827;
}

/* キー/値の2列表示（姓・名など） */
.kv-list {
    margin: 10px 0 0;
    padding: 0 0 0 6px;
    display: grid;
    row-gap: 12px;
}

.kv {
    display: grid;
    grid-template-columns: 60px 1fr;
    align-items: baseline;
    column-gap: 14px;
}

.kv__key {
    margin: 0;
    text-align: left;
    font-size: 14px;
    font-weight: 800;
    color: #6b7280;
}

.kv__val {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: #111827;
}

/* 生年月日（横並び） */
.confirm-birth {
    margin-top: 10px;
    padding-left: 6px;
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 18px;
    font-weight: 900;
    color: #111827;
}

.confirm-birth__era,
.confirm-birth__num {
    display: inline-block;
}


/* ======================= */
/* 仮予約完了画面           */
/* ======================= */

.done-hero {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.done-hero__icon {
    width: 170px;
    height: 170px;
    border-radius: 999px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.done-hero__svg {
    width: 110px;
    height: 110px;
}

.done-message {
    margin: 18px auto 0;
    max-width: 380px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.9;
    color: #111827;
    text-align: left;
}

@media (min-width: 768px) {
    .done-hero__icon {
        width: 190px;
        height: 190px;
    }

    .done-hero__svg {
        width: 120px;
        height: 120px;
    }

    .done-message {
        font-size: 17px;
    }
}

.error-message {
    color: red;
    font-size: 14px;
    font-weight: 800;
    margin-top: 6px;
    padding-left: 6px;
}

.badge {
    display: inline-flex;
    width: 4rem;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    border: 1px solid transparent;
}

.badge--temporary {
    background: #e5e7eb;
    color: #6b7280;
    border-color: #e5e7eb;
}

.badge--approved {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.badge--rejected {
    background: #fa9454;
    color: #fff;
    border-color: #fa9454;
}

.badge--canceled {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.badge--completed {
    background: #9ca3af;
    color: #fff;
    border-color: #9ca3af;
}