/*
 * まつだ小児科 順番受付システム
 * デザイン方針 推奨案 A「オレンジのやさしい丸み」（docs/デザイン方針.md）
 * 色・角丸・影・余白はすべて下の変数経由で使う（色の直書きをしない）。
 * 状態の色の意味：院内＝水色 / 院外（ネット）＝ピンク / 保留＝黄 / 呼出＝青 / 順番呼出＝緑
 */
:root {
    /* ---- ブランド（ホームページ由来） ---- */
    --brand:            #FF8000; /* 面・線・アイコン用。白文字は載せない */
    --brand-strong:     #C94700; /* 主ボタンの背景・オレンジ色の文字 */
    --brand-strong-hover: #B23F00;
    --brand-soft:       #FFE2BF;
    --brand-tint:       #FFF1D6;
    --logo-red:         #D7261A;

    /* ---- 地・文字・線 ---- */
    --bg:          #FFFBE8;
    --surface:     #FFFFFF;
    --surface-sub: #FFF8EC;
    --ink:         #3D3530;
    --ink-muted:   #6B5F57;
    --line:        #EFE3CC;
    --line-strong: #DCCBAA;
    --footer-bg:   #4A4440;

    /* ---- 状態の色 ---- */
    --ok:          #16804A;
    --ok-tint:     #E8F6EC;
    --ok-ink:      #1E7A3F;
    --danger:      #B42318;
    --danger-tint: #FDECEA;
    --call:        #1A6FA8;
    --hold:        #FFD84D;
    --hold-tint:   #FFF3C4;
    --hold-ink:    #5C4300;

    /* ---- 院内／院外の色分け ---- */
    --walkin:      #3CCFE0;
    --walkin-tint: #E4F8FB;
    --walkin-ink:  #0B4F5A;
    --web:         #FFB3C6;
    --web-tint:    #FFEFF3;
    --web-ink:     #7A1A36;

    --focus: #C94700;

    /* ---- 角丸 ---- */
    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 999px;

    /* ---- 影（オレンジがかった影） ---- */
    --shadow-1: 0 1px 2px rgba(140, 70, 0, .06), 0 2px 8px rgba(140, 70, 0, .05);
    --shadow-2: 0 2px 4px rgba(140, 70, 0, .06), 0 10px 28px rgba(140, 70, 0, .10);

    /* ---- 余白（4 の倍数） ---- */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
    --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-14: 56px;

    /* ---- 文字（丸ゴシックが読み込めなくても代替で崩れないようにする） ---- */
    --font-round: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'BIZ UDPGothic', 'Meiryo', sans-serif;
    --font-body:  'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'BIZ UDPGothic', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', sans-serif;

    /* ---- 動き ---- */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --dur: 160ms;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
    -webkit-text-size-adjust: 100%;
}
main { flex: 1; }

a { color: var(--brand-strong); }
p { text-wrap: pretty; }
strong, b { font-weight: 700; }
code { background: var(--surface-sub); padding: 1px 6px; border-radius: var(--r-xs); font-size: .9em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; fill: currentColor; vertical-align: -.25em; }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.pre { white-space: pre-wrap; }
.inline { display: inline; }

/* ---------- 見出し ---------- */
h1.page-title {
    font-family: var(--font-round);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    margin: 4px 0 16px;
    text-wrap: balance;
}
h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-round);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 12px;
    color: var(--ink);
    text-wrap: balance;
}
h2 .icon { color: var(--brand); }

/* ---------- ヘッダー ---------- */
.header {
    background: var(--surface);
    border-top: 4px solid var(--brand);
    box-shadow: 0 1px 0 var(--line);
}
.header-inner {
    max-width: 560px;
    margin: 0 auto;
    min-height: 52px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.header.is-admin .header-inner { max-width: 1280px; padding: 0 24px; min-height: 60px; }
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--logo-red);
    line-height: 1.2;
}
.brand-name { font-family: var(--font-round); font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.brand-sub {
    display: inline-block;
    font-family: var(--font-round);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--brand-strong);
    background: var(--brand-tint);
    border-radius: var(--r-xs);
    padding: 2px 8px;
    white-space: nowrap;
}
.header-tel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px;
    border-radius: var(--r-md);
    background: var(--brand-tint);
    color: var(--brand-strong);
    font-family: var(--font-round);
    font-weight: 700;
    text-decoration: none;
    transition: background-color var(--dur) var(--ease);
}
.header-tel:hover { background: var(--brand-soft); }
.header-tel-text { display: inline-flex; flex-direction: column; line-height: 1.3; }
.header-tel strong { display: none; font-size: 18px; letter-spacing: .02em; }
.header-tel-label { font-size: 15px; }

.admin-nav { display: flex; align-items: center; justify-content: flex-end; gap: 8px 24px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; }
.tab {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 14px;
    font-family: var(--font-round);
    font-weight: 700;
    font-size: 15px;
    color: var(--ink-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab:hover { background: var(--surface-sub); }
.tab.active { background: var(--brand-tint); color: var(--brand-strong); border-bottom-color: var(--brand); }
.ext-links { display: flex; gap: 16px; font-size: 14px; }
.ext-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-strong); }
.ext-links .icon { width: 16px; height: 16px; }

/* ---------- 本文の枠 ---------- */
.container { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }
.container.wide { max-width: 1280px; padding: 24px 24px 56px; font-size: 15px; line-height: 1.6; }
.wide h1.page-title { font-size: 20px; }
.wide h2 { font-size: 17px; }

/* ---------- カード ---------- */
.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    padding: 16px;
    margin-bottom: 16px;
}
.card > :last-child { margin-bottom: 0; }
.wide .card { padding: 20px; }

/* ---------- お知らせ ---------- */
.notice {
    background: var(--brand-tint);
    border-radius: var(--r-lg);
    box-shadow: inset 6px 0 0 var(--brand);
    padding: 16px 16px 16px 22px;
    margin-bottom: 16px;
    word-break: break-word;
}
.notice-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-round);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
}
.notice-title .icon { color: var(--brand-strong); }
.notice p { margin: 8px 0 0; }
.notice p + p { border-top: 1px solid rgba(201, 71, 0, .15); padding-top: 8px; }
.notice p.red { color: var(--logo-red); font-weight: 700; }
.notice a { color: var(--brand-strong); text-decoration: underline; }

/* ---------- メッセージ ---------- */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: var(--r-md);
    padding: 14px 16px 14px 22px;
    margin-bottom: 16px;
    font-family: var(--font-round);
    font-weight: 700;
    box-shadow: inset 6px 0 0 var(--bar);
}
.flash .icon { width: 24px; height: 24px; margin-top: 1px; }
.flash ul { margin: 0; padding-left: 1.2em; }
.flash.success { background: var(--ok-tint); color: var(--ok-ink); --bar: var(--ok); }
.flash.error { background: var(--danger-tint); color: var(--danger); --bar: var(--danger); }

/* ---------- 状態チップ ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-round);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    min-width: 0;
}
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex-shrink: 0; }
.chip.ok   { background: var(--ok-tint);    color: var(--ok-ink);       --dot: var(--ok); }
.chip.off  { background: #F1ECE6;           color: var(--ink-muted);    --dot: #B8ADA3; }
.chip.hold { background: var(--hold-tint);  color: var(--hold-ink);     --dot: #E0B000; }
.chip.call { background: var(--brand-soft); color: var(--brand-strong); --dot: var(--brand); }
.chip.big { font-size: 18px; padding: 6px 16px; }
.status-line { margin: 0 0 16px; }

.closed-chip {
    display: inline-block;
    font-size: 13px;
    line-height: 1.5;
    background: #F1ECE6;
    color: var(--ink-muted);
    border-radius: var(--r-xs);
    padding: 1px 8px;
    white-space: nowrap;
}

/* ---------- ボタン ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--r-md);
    font-family: var(--font-round);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    color: var(--ink);
    background: var(--surface);
    box-shadow: inset 0 0 0 1.5px var(--line-strong);
    transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn:hover:not(:disabled) { background: var(--surface-sub); }

.btn.primary { min-height: 52px; font-size: 18px; color: #fff; background: var(--brand-strong); box-shadow: var(--shadow-1); }
.btn.primary:hover:not(:disabled) { background: var(--brand-strong-hover); }
.btn.large { min-height: 60px; font-size: 20px; padding: 0 28px; }
.btn.tall { min-height: 52px; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: var(--r-sm); }

.btn.secondary { background: var(--surface); color: var(--ink); }
.btn.text { background: none; box-shadow: none; color: var(--brand-strong); min-height: 44px; padding: 0 12px; }
.btn.text:hover:not(:disabled) { background: none; text-decoration: underline; }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.danger:hover:not(:disabled) { background: #9A1D14; }
.btn.danger-outline { min-height: 44px; color: var(--danger); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn.danger-outline:hover:not(:disabled) { background: var(--danger-tint); }

/* 管理画面の色つきボタン */
.btn.walkin-btn { min-height: 56px; padding: 0 28px; font-size: 20px; background: var(--walkin); color: var(--walkin-ink); box-shadow: var(--shadow-1); }
.btn.walkin-btn:hover:not(:disabled) { background: var(--walkin); filter: brightness(.95); }
.btn.call-btn { width: 100%; min-height: 64px; font-size: 22px; background: var(--ok); color: #fff; box-shadow: var(--shadow-1); }
.btn.call-btn:hover:not(:disabled) { background: var(--ok); filter: brightness(.92); }
.btn.call-btn .icon { width: 24px; height: 24px; }
.btn.hold-btn { width: 100%; min-height: 52px; font-size: 17px; background: var(--hold-tint); color: var(--hold-ink); box-shadow: inset 0 0 0 1.5px #E0B000; }
.btn.hold-btn:hover:not(:disabled) { background: var(--hold); }
.btn.ok   { background: var(--ok);   color: #fff; box-shadow: none; }
.btn.call { background: var(--call); color: #fff; box-shadow: none; }
.btn.hold { background: var(--hold); color: var(--hold-ink); box-shadow: none; }
.btn.ok:hover:not(:disabled), .btn.call:hover:not(:disabled) { filter: brightness(.92); }
.btn.ok:hover:not(:disabled) { background: var(--ok); }
.btn.call:hover:not(:disabled) { background: var(--call); }
.btn.hold:hover:not(:disabled) { background: var(--hold); filter: brightness(.95); }
.btn.row-btn { min-height: 40px; min-width: 64px; padding: 0 12px; font-size: 15px; border-radius: var(--r-sm); }

/* ---------- フォーム ---------- */
label { display: block; font-family: var(--font-round); font-weight: 700; font-size: 15px; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=time], textarea, select {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    font-size: 18px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-sm);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.wide input[type=text], .wide input[type=password], .wide input[type=number], .wide input[type=time], .wide select { height: 44px; font-size: 16px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand-strong); box-shadow: 0 0 0 4px rgba(255, 128, 0, .22); }
input.is-invalid, textarea.is-invalid, select.is-invalid { border-color: var(--danger); }
textarea { height: auto; min-height: 100px; padding: 10px 14px; font-size: 16px; line-height: 1.5; }
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%236B5F57'%3E%3Cpath d='M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}
select.auto-width { width: auto; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand-strong); cursor: pointer; }
.field { margin-bottom: 16px; }
.field .hint { display: block; margin-top: 4px; }
.inline-label { display: inline; margin-right: 8px; }
.hint { font-size: 14px; color: var(--ink-muted); }
.wide .hint { font-size: 13px; }

.person { background: var(--surface-sub); border-radius: var(--r-md); padding: 16px; margin-bottom: 12px; }
.person-title {
    display: inline-block;
    font-family: var(--font-round);
    font-weight: 700;
    font-size: 14px;
    line-height: 1.6;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: var(--r-pill);
    padding: 2px 12px;
    margin-bottom: 12px;
}
.callout {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--hold-tint);
    color: var(--hold-ink);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 15px;
    margin: 0 0 16px;
}
.callout .icon { width: 22px; height: 22px; margin-top: 2px; }

.empty-state { text-align: center; padding: 8px 0; }
.empty-icon { width: 40px; height: 40px; color: var(--line-strong); }
.card .empty-icon { color: var(--brand); }
.empty-title { margin: 8px 0 16px; color: var(--ink-muted); font-family: var(--font-round); font-weight: 700; }
.empty-state .btn { margin-top: 0; }
.back-link { margin-top: 8px; }

/* ---------- ステータスパネル（トップ・待ち状況） ---------- */
.status-panel {
    background: var(--surface);
    position: relative;
    overflow: hidden;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-2);
    padding: 26px 20px 20px;
    margin-bottom: 16px;
}
.status-panel::before, .calling-box::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--brand); }
.status-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.status-top .btn, .status-top .status-time { flex-shrink: 0; white-space: nowrap; }
.status-time { margin-left: auto; font-size: 14px; color: var(--ink-muted); }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; }
.status-cell { text-align: center; padding: 0 8px; }
.status-cell + .status-cell { border-left: 1px solid var(--line); }
.stat-label { font-size: 14px; color: var(--ink-muted); }
.stat-value {
    font-family: var(--font-round);
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--logo-red);
    font-variant-numeric: tabular-nums;
}
.stat-value.dark { color: var(--ink); }
.stat-value small { font-size: 20px; color: var(--ink); margin-left: 2px; }

/* ---------- メニュー ---------- */
.take-cta { margin: 0 0 16px; }
.menu { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); margin-bottom: 16px; overflow: hidden; }
.menu-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 12px 16px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color var(--dur) var(--ease);
}
.menu-btn + .menu-btn { border-top: 1px solid var(--line); }
.menu-btn:hover, .menu-btn:active { background: var(--surface-sub); }
.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--r-sm);
    background: var(--brand-tint);
    color: var(--brand-strong);
}
.menu-icon .icon { width: 22px; height: 22px; }
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-title { font-family: var(--font-round); font-size: 17px; font-weight: 700; line-height: 1.4; }
.menu-desc { font-size: 14px; color: var(--ink-muted); line-height: 1.4; }
.menu-caret { color: var(--ink-muted); }

/* ---------- 本日の受付時間・箇条書き ---------- */
.hours-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.hours-label { width: 3em; font-size: 15px; color: var(--ink-muted); }
.hours-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.today-hours .hours-time { font-family: var(--font-round); font-size: 20px; font-weight: 700; }
.dot-list { list-style: none; margin: 0; padding: 0; }
.dot-list li { position: relative; padding-left: 20px; margin: 6px 0; }
.dot-list li::before { content: ''; position: absolute; left: 4px; top: .8em; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }

/* ---------- 受付票（確認・取消） ---------- */
.card.ticket { padding: 0; overflow: hidden; text-align: center; border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
.ticket.is-calling { box-shadow: 0 0 0 3px var(--brand), var(--shadow-2); }
.ticket-head { background: var(--brand-tint); padding: 16px 20px 20px; }
.ticket-label { font-size: 14px; color: var(--ink-muted); }
.ticket-name { font-size: 16px; }
.ticket-perf { position: relative; height: 0; border-top: 2px dotted var(--line-strong); }
.ticket-perf::before, .ticket-perf::after {
    content: '';
    position: absolute;
    top: -13px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg);
}
.ticket-perf::before { left: -12px; }
.ticket-perf::after { right: -12px; }
.ticket-body { padding: 16px 20px 24px; }
.ticket-number {
    font-family: var(--font-round);
    font-size: 80px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--logo-red);
    font-variant-numeric: tabular-nums;
}
.ticket-number small { font-size: 22px; color: var(--ink); margin-left: 2px; }
.ticket-status { font-size: 16px; margin: 4px 0; }
.ahead-num { font-family: var(--font-round); font-size: 40px; font-weight: 700; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.calling-text { font-family: var(--font-round); font-size: 20px; font-weight: 700; color: var(--brand-strong); margin-top: 8px; }
.deadline { font-family: var(--font-round); font-size: 20px; }
.ticket p { margin: 8px 0; }
.cancel-form { margin-top: 24px; }
.cancel-form .btn { min-height: 48px; }

/* ---------- details（開閉） ---------- */
details.collapse { padding: 4px 20px; }
details.collapse > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    cursor: pointer;
    list-style: none;
    font-family: var(--font-round);
    font-size: 17px;
    font-weight: 700;
}
details.collapse > summary::-webkit-details-marker { display: none; }
.summary-caret { color: var(--ink-muted); transition: transform var(--dur) var(--ease); }
details[open] > summary .summary-caret { transform: rotate(180deg); }
.collapse-body { padding: 4px 0 16px; }
.collapse-body.narrow { max-width: 420px; }
details.danger-zone { margin-top: 40px; }
details.danger-zone > summary { color: var(--danger); }
details.danger-zone[open] { background: var(--danger-tint); }

/* ---------- 表 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--surface-sub); font-family: var(--font-round); font-size: 14px; font-weight: 700; color: var(--ink-muted); white-space: nowrap; }
tbody tr:last-child > td, tbody tr:last-child > th { border-bottom: 0; }

.hours-table th, .hours-table td { text-align: center; padding-left: 8px; padding-right: 8px; }
.hours-table .hours-time { font-size: 15px; }
.hours-table tbody th { background: transparent; font-size: 16px; color: var(--ink); }
.hours-table tbody th.sat { color: #1A6FA8; }
.hours-table tbody th.sun { color: var(--logo-red); }
.hours-table tr.today > th, .hours-table tr.today > td { background: var(--brand-tint); }
.closed-list { list-style: none; margin: 0; padding: 0; }
.closed-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.closed-list li:last-child { border-bottom: 0; }
.closed-date { font-family: var(--font-round); font-weight: 700; }

/* ---------- 番号のならび（待ち状況） ---------- */
.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.numbers span {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    background: var(--surface-sub);
    border-radius: var(--r-sm);
    font-family: var(--font-round);
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.numbers span.next { background: var(--brand-soft); color: var(--brand-strong); }
.numbers span.next::before { content: 'つぎ'; position: absolute; left: 6px; top: 2px; font-size: 11px; line-height: 1.2; }
.numbers.held span { background: var(--hold-tint); color: var(--hold-ink); }

/* ---------- バッジ ---------- */
.badge {
    display: inline-block;
    font-family: var(--font-round);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    padding: 2px 8px;
    border-radius: var(--r-xs);
    background: #F1ECE6;
    color: var(--ink-muted);
    white-space: nowrap;
}
.wide .badge { font-size: 13px; }
.badge.walkin { background: var(--walkin); color: var(--walkin-ink); }
.badge.web { background: var(--web); color: var(--web-ink); }

/* ---------- フッター ---------- */
.footer {
    background: var(--footer-bg);
    border-top: 4px solid var(--brand);
    color: #F4ECE2;
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
    padding: 24px 16px;
}
.footer-name { font-family: var(--font-round); font-size: 16px; font-weight: 700; }
.footer a { color: #FFD9B0; text-decoration: underline; }
.footer .icon { width: 14px; height: 14px; margin-left: 4px; }

/* ================= 管理画面 ================= */
.admin-top { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.walkin-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.walkin-form select { width: 96px; height: 56px; font-size: 20px; padding-left: 14px; }
.walkin-block .hint { margin: 8px 0 0; }

.summary { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.summary-meta { display: flex; align-items: center; gap: 8px; }
.summary .session {
    font-family: var(--font-round);
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: var(--r-pill);
    padding: 2px 12px;
}
.tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.tile { min-width: 120px; background: var(--surface-sub); border-radius: var(--r-md); padding: 10px 14px; }
.tile-label { font-size: 13px; color: var(--ink-muted); line-height: 1.4; }
.tile-value { font-family: var(--font-round); font-size: 28px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: 14px; margin-left: 2px; color: var(--ink); }
.tile.walkin .tile-value { color: var(--walkin-ink); }
.tile.web .tile-value { color: var(--web-ink); }
.tile.hold { background: var(--hold-tint); }
.tile.hold .tile-value { color: var(--hold-ink); }

.dash-grid {
    display: grid;
    grid-template-columns: minmax(340px, 380px) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "calling waiting" "held waiting";
    column-gap: 24px;
    align-items: start;
}
.area-calling { grid-area: calling; }
.area-held { grid-area: held; }
.area-waiting { grid-area: waiting; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.calling-box { position: relative; overflow: hidden; text-align: center; padding-top: 26px !important; border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
.calling-box h2 { justify-content: center; margin-bottom: 0; font-size: 14px; letter-spacing: .1em; color: var(--brand-strong); }
.calling-number {
    font-family: var(--font-round);
    font-size: 96px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--logo-red);
    font-variant-numeric: tabular-nums;
}
.calling-number.is-empty { color: var(--line-strong); }
.calling-who { font-size: 18px; margin-bottom: 20px; }
.calling-actions { display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; }

.admin-table th { font-size: 13px; }
.admin-table td { padding: 6px 10px; }
.admin-table td.num { font-family: var(--font-round); font-size: 24px; font-weight: 700; color: var(--logo-red); white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-table td, .admin-table th { height: 56px; }
.admin-table thead th { height: 40px; }
.admin-table tr.row-walkin > td { background-color: var(--walkin-tint); }
.admin-table tr.row-web > td { background-color: var(--web-tint); }
.admin-table tr.row-walkin > td:first-child { box-shadow: inset 5px 0 0 var(--walkin); }
.admin-table tr.row-web > td:first-child { box-shadow: inset 5px 0 0 var(--web); }
#waiting-table tbody tr:first-child.row-walkin > td { background-color: #CDEFF5; }
#waiting-table tbody tr:first-child.row-web > td { background-color: #FFDCE5; }
.name-cell { min-width: 8em; max-width: 14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-cell { font-variant-numeric: tabular-nums; min-width: 90px; }
.col-time { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.held-list { list-style: none; margin: 0; padding: 0; }
.held-item { padding: 12px 12px 12px 17px; border-radius: var(--r-md); margin-bottom: 8px; }
.held-item:last-child { margin-bottom: 0; }
.held-item.row-walkin { background: var(--walkin-tint); box-shadow: inset 5px 0 0 var(--walkin); }
.held-item.row-web { background: var(--web-tint); box-shadow: inset 5px 0 0 var(--web); }
.held-main { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.held-main .num { font-family: var(--font-round); font-size: 24px; font-weight: 700; color: var(--logo-red); font-variant-numeric: tabular-nums; white-space: nowrap; }
.held-who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.held-left { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; white-space: nowrap; }
.time-left { font-family: var(--font-round); font-size: 18px; font-weight: 700; }
.time-left.urgent { color: var(--danger); }

.row-no { width: 56px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-muted); }
#waiting-table tbody tr:first-child .row-no::before {
    content: 'つぎ';
    display: block;
    width: fit-content;
    margin: 0 auto 2px;
    padding: 0 6px;
    border-radius: var(--r-xs);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-family: var(--font-round);
    font-size: 12px;
    line-height: 1.5;
}
.drag-handle { width: 40px; padding: 0 !important; text-align: center; cursor: grab; color: var(--ink-muted); user-select: none; }
.drag-handle .icon { display: block; margin: 0 auto; }
.drag-handle:hover { background-image: linear-gradient(rgba(0, 0, 0, .04), rgba(0, 0, 0, .04)); }
tr[draggable] { cursor: default; }
#waiting-table tr.dragging { box-shadow: var(--shadow-2); outline: 2px solid var(--brand); outline-offset: -2px; }
#waiting-table tr.dragging > td { background-color: #fff !important; }

.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.row-actions form { margin: 0; }
.held-actions { flex-wrap: wrap; }
.held-actions .held-delete { margin-left: auto; }
.act-sep { width: 1px; height: 28px; margin: 0 2px; background: var(--line-strong); flex-shrink: 0; }
.finished-table td { height: 52px; }

/* ---------- 設定画面 ---------- */
.notice-table td { vertical-align: top; }
.notice-table textarea { min-height: 0; min-width: 320px; width: 100%; font-size: 15px; padding: 8px 10px; }
.notice-table textarea.red-text { color: var(--logo-red); }
.notice-table .col-check { width: 64px; text-align: center; }
.notice-table th.col-check { font-size: 13px; }
.notice-table td.col-check input { margin-top: 10px; }
.notice-table th.col-delete { background: var(--danger-tint); color: var(--danger); }
.notice-table tr:has(input[name$="[delete]"]:checked) > td { background: var(--danger-tint); }
.suspend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 0;
    padding: 12px 14px;
    border-radius: var(--r-md);
    background: var(--surface-sub);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 15px;
    cursor: pointer;
}
.suspend-row:has(input[type=checkbox]:checked) { background: var(--hold-tint); }
.hours-cell { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: nowrap; }
.settings-hours td { padding: 8px 6px; }
input[type=time].time-input { width: 110px; height: 40px; font-size: 15px; padding: 0 8px; }
.hours-cell:has(input[type=checkbox]:not(:checked)) .time-input { opacity: .5; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; align-items: start; }
.save-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 8px;
    padding: 12px 24px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -4px 16px rgba(140, 70, 0, .08);
}
.password-card { margin-top: 40px; }

/* ---------- ログイン ---------- */
.login-wrap { max-width: 400px; margin: 24px auto; }
.login-card { padding: 32px; border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
.wide .login-card { padding: 32px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--logo-red); }
.login-brand .brand-name { font-family: var(--font-round); font-size: 26px; font-weight: 700; letter-spacing: .04em; line-height: 1.3; }
.login-title { font-family: var(--font-round); font-size: 18px; font-weight: 700; text-align: center; margin: 12px 0 20px; }
.login-card input[type=text], .login-card input[type=password] { height: 48px; }

/* ================= 画面幅への対応 ================= */
@media (min-width: 600px) {
    .header-tel-label { display: none; }
    .header-tel strong { display: inline; }
    .header-inner { min-height: 64px; }
}
@media (min-width: 600px) {
    .card { padding: 20px; }
}
@media (max-width: 1360px) {
    .col-time { display: none; }
}
@media (max-width: 1180px) {
    .dash-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas: "calling" "waiting" "held";
    }
    .calling-actions { max-width: 420px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 800px) {
    .rules-grid { grid-template-columns: 1fr; }
    .summary { align-items: flex-start; }
}
@media (max-width: 380px) {
    .hours-table th, .hours-table td { padding-left: 4px; padding-right: 4px; }
    .hours-table .hours-time { font-size: 13px; }
    .brand-name { font-size: 18px; }
    .stat-value { font-size: 42px; }
    .ticket-number { font-size: 72px; }
}

/* 動きを減らす設定の端末では動かさない */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- ゴリラ（クリニックのキャラクター）。元の絵が約 66×75px のため、それより大きく表示しない ---------- */
.brand-mark {
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 50%; background: var(--brand-tint); overflow: hidden;
    display: flex; align-items: flex-end; justify-content: center;
}
.brand-mark img { display: block; width: 30px; height: auto; }
.gorilla { display: block; margin: 0 auto 4px; height: auto; }
.login-brand .gorilla { margin-bottom: 2px; }
