:root {
    --bg: #f6f7f8;
    --surface: #ffffff;
    --surface-muted: #f0f3f5;
    --line: #d8dee4;
    --line-strong: #b8c2cc;
    --text: #17202a;
    --muted: #667280;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --accent-soft: #d9f4ef;
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --warning: #b7791f;
    --weekend: #f9f2e7;
    --today: #fff0c2;
    --day-width: 54px;
    --room-width: 220px;
    --row-height: 52px;
    --timeline-min-width: 1512px;
    font-family: "Inter", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 260px),
        var(--bg);
    font-size: 15px;
    line-height: 1.5;
}

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

button {
    cursor: pointer;
}

.app-shell {
    width: min(1500px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0 18px;
}

.eyebrow,
.section-kicker {
    margin: 0 0 2px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 18px;
}

.top-actions,
.toolbar-right,
.date-controls,
.inline-form,
.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-status {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    padding: 0 11px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.save-status[data-tone="ok"] {
    border-color: #b7ddd6;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.save-status[data-tone="warn"] {
    border-color: #f5d49a;
    background: #fff7df;
    color: #8a5a00;
}

.save-status[data-tone="error"] {
    border-color: #f5b5ae;
    background: var(--danger-soft);
    color: var(--danger);
}

.button,
.icon-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    min-height: 40px;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.button.compact {
    min-height: 36px;
    padding-inline: 12px;
}

.button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.button.secondary {
    background: #fff;
}

.button.danger {
    border-color: #f5b5ae;
    background: var(--danger-soft);
    color: var(--danger);
}

.logout-button {
    color: var(--muted);
}

.button:hover,
.icon-button:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.button:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    box-shadow: none;
}

.inline-form {
    min-width: 0;
}

.inline-form input {
    min-width: 0;
}

.inline-form .button {
    flex: 0 0 auto;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
}

.file-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.stat-strip {
    display: grid;
    grid-template-columns: 2fr 2fr 2fr 4fr;
    gap: 10px;
    margin-bottom: 14px;
}

.stat {
    min-height: 78px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 25px;
    letter-spacing: 0;
    text-align: center;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.room-manager,
.schedule-area {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
}

.room-manager {
    padding: 16px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.count-pill {
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 700;
}

.add-room-form {
    display: grid;
    gap: 7px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    min-height: 40px;
    padding: 8px 10px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.room-list {
    display: grid;
    gap: 8px;
    max-height: 650px;
    overflow: auto;
    padding-top: 14px;
}

.room-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    align-items: center;
}

.room-item input {
    min-width: 0;
}

.room-item .button {
    min-width: 58px;
}

.schedule-area {
    min-width: 0;
    overflow: hidden;
}

.schedule-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.date-controls {
    flex-wrap: wrap;
}

.date-controls label {
    margin-left: 4px;
}

#viewStartInput {
    width: 150px;
}

.range-toggle,
.sort-toggle {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.range-toggle {
    grid-template-columns: repeat(3, 62px);
}

.sort-toggle {
    grid-template-columns: 56px 76px 88px;
}

.range-toggle button,
.sort-toggle button {
    min-height: 38px;
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.range-toggle button:last-child,
.sort-toggle button:last-child {
    border-right: 0;
}

.range-toggle button.active,
.sort-toggle button.active {
    background: var(--accent);
    color: #fff;
}

.search-field {
    display: grid;
    grid-template-columns: auto minmax(170px, 220px);
    align-items: center;
    gap: 8px;
}

.chart-frame {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    min-height: 0;
}

.chart {
    width: 100%;
    min-width: calc(var(--room-width) + var(--timeline-min-width));
}

.chart-header,
.chart-row {
    display: grid;
    grid-template-columns: var(--room-width) minmax(0, 1fr);
}

.chart[data-range="14"] {
    --timeline-min-width: 756px;
}

.chart[data-range="28"] {
    --timeline-min-width: 1512px;
}

.chart[data-range="42"] {
    --timeline-min-width: 2268px;
}


.chart-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid var(--line-strong);
}

.room-head,
.room-cell {
    position: sticky;
    left: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--line-strong);
    background: #fff;
}

.room-head {
    min-height: 54px;
    padding: 10px 14px;
    color: var(--muted);
    font-weight: 800;
}

.day-header,
.timeline-row {
    display: grid;
    grid-template-columns: repeat(var(--days, 28), minmax(var(--day-width), 1fr));
}

.day-cell {
    display: grid;
    place-items: center;
    text-align: center;
    min-width: 0;
    min-height: 54px;
    padding: 6px 2px;
    border-right: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.day-cell.weekend {
    background: var(--weekend);
}

.day-cell.today {
    background: var(--today);
    color: #7a5206;
}

.date-main {
    display: block;
    color: var(--text);
    font-size: 13px;
}

.day-label {
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
}

.weekday-main {
    display: block;
    width: 100%;
    text-align: center;
}

.chart[data-range="42"] .day-cell {
    font-size: 12px;
    padding-inline: 2px;
}

.chart[data-range="42"] .date-main {
    font-size: 13px;
}

.chart-row {
    min-height: var(--row-height);
    border-bottom: 1px solid var(--line);
    align-items: stretch;
}

.room-cell {
    min-height: var(--row-height);
    padding: 9px 12px;
    font-weight: 800;
}

.room-meta {
    display: grid;
    gap: 3px;
    min-width: 0;
    width: 100%;
}

.room-name {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.28;
}

.room-status {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.timeline-row {
    position: relative;
    height: auto;
    min-height: calc(var(--row-height) * var(--lanes, 1));
    grid-template-rows: 1fr;
    background: #fff;
}

.timeline-row.move-target {
    box-shadow: inset 0 0 0 3px rgba(15, 118, 110, 0.22);
}

.timeline-day {
    grid-row: 1;
    height: 100%;
    min-height: var(--row-height);
    border-right: 1px solid var(--line);
    pointer-events: none;
}

.timeline-day.weekend {
    background: rgba(249, 242, 231, 0.7);
}

.timeline-day.today {
    background: rgba(255, 240, 194, 0.9);
    box-shadow: inset 2px 0 0 #d79712;
}

.stay-bar {
    position: absolute;
    left: calc(var(--bar-left, 0%) + 2px);
    top: calc(var(--lane, 0) * var(--row-height) + (var(--row-height) - 36px) / 2);
    width: max(14px, calc(var(--bar-width, 0%) - 4px));
    z-index: 2;
    min-width: 0;
    height: 36px;
    margin: 0;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--bar-color, var(--accent));
    box-shadow: 0 5px 12px rgba(23, 32, 42, 0.14);
    overflow: hidden;
    text-align: left;
    cursor: grab;
    user-select: none;
}

.stay-bar.resizing {
    opacity: 0.82;
    outline: 3px solid rgba(15, 118, 110, 0.28);
}

.stay-bar.moving {
    opacity: 0.86;
    outline: 3px solid rgba(15, 118, 110, 0.22);
    cursor: grabbing;
}

.resize-handle {
    position: absolute;
    top: 6px;
    right: 4px;
    bottom: 6px;
    width: 16px;
    border-radius: 999px;
    cursor: ew-resize;
}

.resize-handle::before {
    content: "";
    position: absolute;
    top: 5px;
    right: 6px;
    bottom: 5px;
    width: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
}

.resize-handle:hover {
    background: rgba(255, 255, 255, 0.18);
}

.is-resizing-stay,
.is-resizing-stay * {
    cursor: ew-resize !important;
}

.is-moving-stay,
.is-moving-stay * {
    cursor: grabbing !important;
}

.stay-bar-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 100%;
    padding: 0 24px 0 8px;
}

.stay-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.stay-days {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 7px;
    font-size: 12px;
    font-weight: 800;
}

.chart[data-range="42"] .stay-bar-inner {
    gap: 4px;
    padding-inline: 6px;
}

.chart[data-range="42"] .stay-days {
    padding-inline: 5px;
    font-size: 11px;
}

.stay-bar.outside-start .stay-bar-inner {
    padding-left: 16px;
}

.stay-bar.outside-end .stay-bar-inner {
    padding-right: 16px;
}

.stay-bar.conflict {
    outline: 3px solid #fbbf24;
}

.empty-state {
    margin: 14px;
    padding: 24px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    text-align: center;
    font-weight: 700;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(20, 28, 36, 0.42);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(620px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.stay-form {
    padding: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 6px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.swatch {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--swatch);
}

.swatch[data-color="#0f766e"] {
    --swatch: #0f766e;
}

.swatch[data-color="#2563eb"] {
    --swatch: #2563eb;
}

.swatch[data-color="#e11d48"] {
    --swatch: #e11d48;
}

.swatch[data-color="#7c3aed"] {
    --swatch: #7c3aed;
}

.swatch[data-color="#f97316"] {
    --swatch: #f97316;
}

.swatch[data-color="#16a34a"] {
    --swatch: #16a34a;
}

.swatch.active {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.form-message {
    min-height: 22px;
    margin: 12px 0 0;
    color: var(--warning);
    font-weight: 800;
}

.modal-actions {
    margin-top: 14px;
}

.modal-spacer {
    flex: 1;
}

.login-page {
    min-height: 100vh;
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-panel {
    width: min(430px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    padding: 26px;
    box-shadow: 0 18px 60px rgba(23, 32, 42, 0.12);
}

.login-panel h1 {
    font-size: 25px;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.login-form label {
    display: grid;
    gap: 6px;
}

.login-form .button {
    width: 100%;
    margin-top: 2px;
}

.login-error {
    margin: 0;
    border: 1px solid #f5b5ae;
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--danger);
    padding: 10px 12px;
    font-weight: 800;
}

@media (max-width: 1050px) {

    .topbar,
    .schedule-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions,
    .toolbar-right {
        flex-wrap: wrap;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .room-list {
        max-height: 280px;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 20px, 1500px);
        padding-top: 14px;
    }

    h1 {
        font-size: 23px;
    }

    /* スマホ */
    @media (max-width: 767px) {
        .stat-strip {
            grid-template-columns: repeat(3, 1fr);
        }

        .stat-strip .stat.wide {
            grid-column: 1 / -1;
        }
    }

    .top-actions,
    .date-controls,
    .toolbar-right {
        width: 100%;
    }

    .top-actions .button,
    .file-button {
        flex: 1 1 130px;
    }

    .search-field {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .range-toggle,
    .sort-toggle {
        width: 100%;
    }

    .range-toggle {
        grid-template-columns: repeat(3, 1fr);
    }

    .sort-toggle {
        grid-template-columns: repeat(3, 1fr);
    }

    .chart-frame {
        overflow-x: auto;
        overflow-y: visible;
    }

    :root {
        --room-width: 172px;
        --day-width: 48px;
    }

    .chart[data-range="42"] .day-cell {
        font-size: 11px;
    }

    .chart[data-range="42"] .date-main {
        font-size: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Smartphone compact layout */
@media (max-width: 720px) {
    :root {
        --room-width: 112px;
        --day-width: 34px;
        --row-height: 40px;
        --timeline-min-width: 952px;
    }

    .chart[data-range="14"] {
        --timeline-min-width: 476px;
    }

    .chart[data-range="28"] {
        --timeline-min-width: 952px;
    }

    .chart[data-range="42"] {
        --timeline-min-width: 1428px;
    }

    body {
        font-size: 13px;
        line-height: 1.35;
    }

    .app-shell {
        width: calc(100% - 10px);
        padding: 6px 0 14px;
    }

    .topbar {
        gap: 7px;
        padding: 4px 0 8px;
    }

    .eyebrow,
    .section-kicker {
        font-size: 9px;
    }

    h1 {
        font-size: 19px;
    }

    h2 {
        font-size: 15px;
    }

    .top-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .top-actions .save-status {
        grid-column: 1 / -1;
        min-height: 26px;
        justify-content: center;
        padding: 0 7px;
        font-size: 10px;
    }

    .top-actions .button,
    .top-actions .file-button {
        min-height: 32px;
        padding: 0 6px;
        font-size: 11px;
    }

    /* スマホ */
    @media (max-width: 767px) {
        .stat-strip {
            grid-template-columns: repeat(3, 1fr);
        }

        .stat-strip .stat.wide {
            grid-column: 1 / -1;
        }
    }

    .stat {
        min-height: 49px;
        padding: 6px 8px;
        border-radius: 6px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat strong {
        margin-top: 1px;
        font-size: 16px;
        line-height: 1.2;
    }

    .workspace {
        gap: 7px;
    }

    .room-manager {
        padding: 8px;
    }

    .panel-head {
        margin-bottom: 6px;
    }

    .count-pill {
        padding: 3px 7px;
        font-size: 10px;
    }

    .add-room-form {
        gap: 4px;
        padding-bottom: 7px;
    }

    label {
        font-size: 11px;
    }

    input,
    select,
    textarea {
        min-height: 34px;
        padding: 4px 7px;
        border-radius: 6px;
        font-size: 13px;
        line-height: 1.15;
        touch-action: manipulation;
    }

    .button {
        min-height: 34px;
        padding: 0 9px;
        border-radius: 6px;
        font-size: 11px;
    }

    .button.compact {
        min-height: 30px;
        padding-inline: 8px;
    }

    .room-list {
        gap: 4px;
        max-height: 128px;
        padding-top: 7px;
    }

    .room-item {
        gap: 4px;
    }

    .room-item .button {
        min-width: 42px;
        padding-inline: 5px;
        font-size: 10px;
    }

    .schedule-toolbar {
        gap: 6px;
        padding: 7px;
    }

    .date-controls {
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr) 32px 46px;
        gap: 4px;
    }

    .date-controls label {
        display: none;
    }

    #viewStartInput {
        width: 100%;
        min-width: 0;
    }

    .icon-button {
        width: 32px;
        min-height: 32px;
        border-radius: 6px;
        font-size: 19px;
    }

    .toolbar-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .range-toggle,
    .sort-toggle {
        width: 100%;
        border-radius: 6px;
    }

    .range-toggle button,
    .sort-toggle button {
        min-height: 30px;
        padding: 0 3px;
        font-size: 10px;
    }

    .search-field {
        grid-column: 1 / -1;
        display: block;
    }

    .search-field>span {
        display: none;
    }

    .chart-frame {
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .room-head,
    .day-cell {
        min-height: 40px;
    }

    .room-head {
        padding: 5px 6px;
        font-size: 10px;
    }

    .day-cell {
        min-height: 40px;
        padding: 3px 1px;
        font-size: 9px;
    }

    .date-main,
    .chart[data-range="42"] .date-main {
        font-size: 10px;
    }

    .weekday-main,
    .chart[data-range="42"] .weekday-main {
        margin-top: 1px;
        font-size: 8px;
        line-height: 1;
    }

    .chart[data-range="42"] .day-cell {
        font-size: 9px;
    }

    .room-cell {
        padding: 4px 5px;
        font-size: 10px;
    }

    .room-meta {
        gap: 1px;
    }

    .room-name {
        line-height: 1.15;
    }

    .room-status {
        font-size: 9px;
        line-height: 1.15;
    }

    .stay-bar {
        height: 28px;
        margin: 0;
        top: calc(var(--lane, 0) * var(--row-height) + (var(--row-height) - 28px) / 2);
        border-radius: 5px;
        box-shadow: 0 2px 6px rgba(23, 32, 42, 0.12);
    }

    .stay-bar-inner,
    .chart[data-range="42"] .stay-bar-inner {
        gap: 3px;
        padding: 0 16px 0 5px;
        font-size: 10px;
    }

    .stay-days,
    .chart[data-range="42"] .stay-days {
        padding: 1px 4px;
        font-size: 8px;
    }

    .resize-handle {
        top: 4px;
        right: 1px;
        bottom: 4px;
        width: 13px;
    }

    .modal-backdrop {
        padding: 6px;
    }

    .modal {
        max-height: calc(100vh - 12px);
        border-radius: 7px;
    }

    .modal-head {
        padding: 9px;
    }

    .stay-form {
        padding: 9px;
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .form-grid label {
        gap: 3px;
    }

    .form-grid label:first-child,
    .form-grid label:nth-child(2),
    .form-grid .full {
        grid-column: 1 / -1;
    }

    .form-grid textarea {
        min-height: 56px;
    }

    .color-row {
        gap: 5px;
        margin-top: 8px;
    }

    .swatch {
        width: 27px;
        height: 27px;
        border-radius: 6px;
    }

    .form-message {
        min-height: 16px;
        margin-top: 6px;
        font-size: 10px;
    }

    .modal-actions {
        gap: 5px;
        margin-top: 7px;
    }
}

/* Date/time inputs: the whole field opens the native picker. */
input[type="date"],
input[type="time"] {
    cursor: pointer;
}

/* Header / mobile navigation */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-menu-button,
.mobile-menu,
.mobile-menu-backdrop {
    display: none;
}

body.mobile-menu-open {
    overflow: hidden;
}

@media (max-width: 1050px) and (min-width: 721px) {
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .topbar>div:first-child {
        min-width: 0;
    }

    .header-actions {
        flex: 0 0 auto;
        gap: 6px;
    }

    .header-actions>.top-actions {
        display: none;
    }

    .add-stay-main {
        min-height: 34px;
        padding: 0 10px;
        font-size: 11px;
    }

    .mobile-menu-button {
        display: inline-flex;
        width: 36px;
        height: 34px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: #fff;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
    }

    .mobile-menu-button span {
        display: block;
        width: 17px;
        height: 2px;
        border-radius: 999px;
        background: var(--text);
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 40;
        display: block;
        background: rgba(23, 32, 42, 0.42);
    }

    .mobile-menu-backdrop[hidden] {
        display: none;
    }

    .mobile-menu {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 41;
        display: flex;
        flex-direction: column;
        width: min(92vw, 390px);
        height: 100dvh;
        padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
        background: var(--surface);
        box-shadow: -16px 0 50px rgba(23, 32, 42, 0.22);
        overflow: hidden;
    }

    .mobile-menu[hidden] {
        display: none;
    }

    .mobile-menu-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 12px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }

    .mobile-menu-content {
        display: grid;
        gap: 10px;
        padding: 10px;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .mobile-menu-content .top-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        padding: 0 0 10px;
        border-bottom: 1px solid var(--line);
    }

    .mobile-menu-content .top-actions .save-status {
        grid-column: 1 / -1;
        min-height: 30px;
        justify-content: center;
    }

    .mobile-menu-content .top-actions .button,
    .mobile-menu-content .top-actions .file-button {
        width: 100%;
        min-height: 34px;
        font-size: 11px;
    }

    .mobile-menu-content .room-manager {
        display: block;
        width: 100%;
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 10px;
    }

    .mobile-menu-content .room-list {
        max-height: none;
        overflow: visible;
    }

    .workspace {
        display: block;
    }

    .workspace>.room-manager {
        display: none;
    }

    .schedule-area>.schedule-toolbar {
        display: grid;
        width: 100%;
        gap: 8px;
        padding: 10px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }

    .schedule-area>.schedule-toolbar::before {
        content: "表示・検索設定";
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
    }

    .schedule-area>.schedule-toolbar .date-controls,
    .schedule-area>.schedule-toolbar .toolbar-right {
        width: 100%;
    }

    .schedule-area {
        border-radius: 8px;
    }
}

/* v12: smartphone toolbar alignment */
@media (max-width: 720px) {
    .schedule-area>.schedule-toolbar {
        box-sizing: border-box;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        justify-items: stretch;
        align-items: stretch;
        width: 100% !important;
        max-width: none !important;
        gap: 10px;
        padding: 12px;
    }

    .schedule-area>.schedule-toolbar::before {
        display: block;
        width: 100%;
        margin: 0;
        line-height: 1.2;
    }

    .schedule-area>.schedule-toolbar .date-controls {
        display: grid !important;
        grid-template-columns: 40px minmax(0, 1fr) 40px 64px;
        align-items: stretch;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        gap: 6px;
        margin: 0;
    }

    .schedule-area>.schedule-toolbar .date-controls>* {
        min-width: 0;
        margin: 0;
    }

    .schedule-area>.schedule-toolbar #viewStartInput {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .schedule-area>.schedule-toolbar .date-controls .icon-button,
    .schedule-area>.schedule-toolbar #todayButton {
        width: 100% !important;
        min-width: 0;
        padding-inline: 4px;
    }

    .schedule-area>.schedule-toolbar .toolbar-right {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        gap: 6px;
        margin: 0;
    }

    .schedule-area>.schedule-toolbar .range-toggle,
    .schedule-area>.schedule-toolbar .sort-toggle {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        margin: 0;
    }

    .schedule-area>.schedule-toolbar .range-toggle button,
    .schedule-area>.schedule-toolbar .sort-toggle button {
        width: 100%;
        min-width: 0;
        padding-inline: 2px;
        white-space: nowrap;
    }

    .schedule-area>.schedule-toolbar .search-field {
        grid-column: 1 / -1;
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        margin: 0;
    }

    .schedule-area>.schedule-toolbar .search-field input {
        display: block;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        margin: 0;
    }
}


/* Sales demo environment */
.demo-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    background: #fffbeb;
    color: #713f12;
}

.demo-notice>div {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.demo-notice strong {
    flex: 0 0 auto;
    font-size: 13px;
}

.demo-notice span {
    font-size: 12px;
    line-height: 1.6;
}

.login-demo-note {
    margin: 5px 0 18px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .demo-notice {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 10px;
        padding: 10px;
    }

    .demo-notice>div {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .demo-notice .button {
        width: 100%;
    }
}



.system-list-link {
  margin-top: 16px;
}

.system-list-link .button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}

.button.secondary {
  background: #fff;
  color: #333;
  border: 1px solid #d8dce3;
}

.button.secondary:hover {
  background: #f5f7fa;
}