/* Shared visual refresh for admin pages: white, simple, no background image. */
:root {
    --admin-bg: #f6f7fb;
    --admin-surface: #ffffff;
    --admin-surface-soft: #f9fafb;
    --admin-line: #e5e7eb;
    --admin-text: #111827;
    --admin-muted: #6b7280;
    --admin-primary: #2563eb;
    --admin-primary-hover: #1d4ed8;
    --admin-neutral: #6b7280;
    --admin-neutral-hover: #4b5563;
    --admin-danger: #dc2626;
    --admin-danger-hover: #b91c1c;
    --admin-warning: #b45309;
    --admin-shadow: 0 10px 24px rgba(17, 24, 39, 0.07);
    --admin-sticky-table-top: 0px;
}

body {
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Hiragino Sans", "Yu Gothic", "Meiryo", Arial, sans-serif;
    letter-spacing: 0;
}

html:lang(zh-CN) body,
html:lang(zh-Hans) body {
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", Arial, sans-serif;
}

html:lang(zh-TW) body,
html:lang(zh-Hant) body {
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans CJK TC", "Source Han Sans TC", "Segoe UI", Arial, sans-serif;
}

html:lang(ja) body {
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", "Noto Sans CJK JP", "Segoe UI", Arial, sans-serif;
}

html:lang(ko) body {
    font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans CJK KR", "Segoe UI", Arial, sans-serif;
}

html:lang(th) body {
    font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", "Segoe UI", Arial, sans-serif;
}

.container {
    min-height: 100vh;
    height: auto;
    background: var(--admin-bg);
}

.sidebar {
    position: sticky;
    top: 0;
    width: 208px;
    min-width: 208px;
    height: 100vh;
    padding: 20px 18px;
    border-right: 1px solid var(--admin-line);
    background: var(--admin-surface);
    box-shadow: 8px 0 22px rgba(17, 24, 39, 0.04);
}

.sidebar::before {
    display: none;
}

.sidebar .logo {
    margin-bottom: 20px;
    color: var(--admin-text);
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.25;
}

.sidebar li {
    margin: 6px 0;
}

.sidebar li a {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    color: #374151;
    font-weight: 700;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.sidebar-link-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.sidebar-alert-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    margin-left: auto;
    padding: 0 7px;
    border: 2px solid var(--admin-surface);
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.24);
}

.sidebar-alert-badge[hidden],
.sidebar-alert-badge.is-hidden {
    display: none !important;
}

tr.row-new-notification > td {
    background: #fff7ed !important;
}

tr.row-new-notification > td:first-child {
    box-shadow: inset 4px 0 #f97316;
}

tr.row-new-notification:hover > td {
    background: #ffedd5 !important;
}

.admin-new-entry-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 20px;
    margin-left: 8px;
    padding: 2px 8px;
    border: 1px solid #f97316;
    border-radius: 999px;
    background: #ffffff;
    color: #c2410c;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

.sidebar li.active a,
.sidebar li a:hover {
    background: #eef4ff;
    color: var(--admin-primary);
    transform: translateX(2px);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 24px;
    overflow: visible;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-height: 38px;
    margin-bottom: 18px;
    color: var(--admin-muted);
    font-size: 13px;
}

.admin-language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.admin-language-switcher label {
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 700;
}

.admin-language-switcher select {
    min-width: 150px;
    min-height: 34px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    background-color: var(--admin-surface);
    color: var(--admin-text);
    font-weight: 800;
}

.admin-notification {
    position: relative;
    display: inline-flex;
}

.admin-notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 6px;
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    background: var(--admin-surface);
    color: var(--admin-text);
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.06);
}

.admin-notification-bell:hover {
    border-color: #bfdbfe;
    color: var(--admin-primary);
    background: #f8fbff;
}

.admin-notification-bell__icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
}

.admin-notification-bell__icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-notification-bell__count {
    position: absolute;
    top: -7px;
    right: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid var(--admin-surface);
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.admin-notification-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    z-index: 1000;
    width: min(320px, calc(100vw - 32px));
    padding: 14px 12px;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: var(--admin-surface);
    box-shadow: 0 18px 42px rgba(17, 24, 39, 0.18);
}

.admin-notification-popover::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-top: 1px solid var(--admin-line);
    border-left: 1px solid var(--admin-line);
    background: var(--admin-surface);
    transform: rotate(45deg);
}

.admin-notification-popover__title {
    display: block;
    padding: 4px 8px 10px;
    color: var(--admin-text);
    font-size: 14px;
    font-weight: 900;
}

.admin-notification-popover__list {
    display: grid;
    gap: 4px;
}

.admin-notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 38px;
    padding: 8px;
    border-radius: 8px;
    color: var(--admin-text);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.admin-notification-item:hover {
    background: #f3f6fb;
    color: var(--admin-primary);
}

.admin-notification-item__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.admin-notification-popover__empty {
    padding: 8px;
    color: var(--admin-muted);
    font-size: 13px;
    font-weight: 700;
}

.cards {
    gap: 18px;
}

.card {
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: var(--admin-surface);
    box-shadow: var(--admin-shadow);
}

.card h3,
.table-section h2,
.main-content > h1,
.main-content > h2 {
    color: var(--admin-text);
    font-weight: 900;
}

.card p,
.metric-number {
    color: var(--admin-primary);
}

table {
    border: 1px solid var(--admin-line);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: visible;
    background: var(--admin-surface);
    box-shadow: var(--admin-shadow);
}

thead th {
    position: sticky;
    top: var(--admin-sticky-table-top, 0px);
    z-index: 30;
    padding-top: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--admin-line);
    background: #f3f6fb;
    background-clip: padding-box;
    color: var(--admin-text);
    font-weight: 900;
    box-shadow: 0 1px 0 var(--admin-line), 0 8px 18px rgba(17, 24, 39, 0.08);
}

thead th:first-child {
    border-top-left-radius: 8px;
}

thead th:last-child {
    border-top-right-radius: 8px;
}

tbody td {
    border-bottom: 1px solid var(--admin-line);
    color: var(--admin-text);
}

tbody tr:hover td {
    background: #f9fafb;
}

input,
select,
textarea,
.status-select {
    border-color: #d1d5db;
    border-radius: 8px;
    color: var(--admin-text);
}

input:focus,
select:focus,
textarea:focus,
.status-select:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.status-select {
    min-height: 28px;
    font-weight: 700;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-delete,
.btn-del,
.clean-del,
.room-del,
.g-del,
.btn-submit,
#mail-import-btn,
#newRecordBtn,
#modalCancel,
#modalOk,
#modalSave,
#prevMonth,
#nextMonth,
.topbar button[type="submit"],
button.btn,
a.btn {
    border-radius: 8px;
    letter-spacing: 0;
}

.btn-primary,
.btn-success,
.btn-submit,
.btn.primary,
#mail-import-btn,
#modalOk,
#modalSave,
#newRecordBtn,
button.edit-btn,
button.detail-btn {
    background: var(--admin-primary) !important;
    border-color: var(--admin-primary) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-success:hover,
.btn-submit:hover,
.btn.primary:hover,
#mail-import-btn:hover,
#modalOk:hover,
#modalSave:hover,
#newRecordBtn:hover,
button.edit-btn:hover,
button.detail-btn:hover {
    background: var(--admin-primary-hover) !important;
    border-color: var(--admin-primary-hover) !important;
}

.btn-secondary,
#modalCancel,
#prevMonth,
#nextMonth,
.topbar button[type="submit"] {
    background: var(--admin-neutral) !important;
    border-color: var(--admin-neutral) !important;
    color: #ffffff !important;
}

.btn-secondary:hover,
#modalCancel:hover,
#prevMonth:hover,
#nextMonth:hover,
.topbar button[type="submit"]:hover {
    background: var(--admin-neutral-hover) !important;
    border-color: var(--admin-neutral-hover) !important;
}

.btn-danger,
.btn-delete,
.btn-del,
.clean-del,
.room-del,
.g-del,
button.delete-btn,
button.btn-danger,
button.btn-delete,
button.btn-del,
button.clean-del,
button.room-del,
button.g-del {
    background: var(--admin-danger) !important;
    border-color: var(--admin-danger) !important;
    color: #ffffff !important;
}

.btn-danger:hover,
.btn-delete:hover,
.btn-del:hover,
.clean-del:hover,
.room-del:hover,
.g-del:hover,
button.delete-btn:hover,
button.btn-danger:hover,
button.btn-delete:hover,
button.btn-del:hover,
button.clean-del:hover,
button.room-del:hover,
button.g-del:hover {
    background: var(--admin-danger-hover) !important;
    border-color: var(--admin-danger-hover) !important;
}

dialog,
dialog#room-edit,
dialog#reservationModal {
    border: 1px solid var(--admin-line);
    border-radius: 8px !important;
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.18);
}

#room-edit input[type="text"],
#room-edit input[type="number"],
#reservationModal input[type="text"],
#reservationModal input[type="number"],
#reservationModal input[type="datetime-local"],
#reservationModal select {
    border-radius: 8px;
}

.status-select.reserved {
    background-color: #eef4ff;
    color: #1d4ed8;
}

.status-select.checkedin {
    background-color: #edf7ff;
    color: #0369a1;
}

.status-select.not_checkedin {
    background-color: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.status-select.unconfirmed {
    background-color: #fef2f2;
    color: #b42318;
    border-color: #fca5a5;
    box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.12);
}

.status-select.uncleaned,
.status-select.cancelled {
    background-color: #fef2f2;
    color: var(--admin-danger-hover);
}

.status-select.changed {
    background-color: #f5f3ff;
    color: #5b21b6;
}

.status-select.completed {
    background-color: #f3f4f6;
    color: #4b5563;
}

body.admin-confirm-open {
    overflow: hidden;
}

.admin-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    transition: opacity 0.14s ease;
}

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

.admin-confirm-backdrop.is-open {
    opacity: 1;
}

.admin-confirm-dialog {
    width: min(480px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 22px 24px 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    color: var(--admin-text, #111827);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.14s ease;
}

.admin-confirm-backdrop.is-open .admin-confirm-dialog {
    transform: translateY(0) scale(1);
}

.admin-confirm-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 900;
}

.admin-confirm-message {
    min-height: 48px;
    color: var(--admin-text, #111827);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    white-space: pre-line;
}

.admin-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.admin-confirm-button {
    min-width: 70px;
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    padding: 0 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
}

.admin-confirm-primary {
    background: #b91c1c;
    color: #ffffff;
}

.admin-confirm-primary:hover {
    background: #991b1b;
}

.admin-confirm-cancel {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
}

.admin-confirm-cancel:hover {
    background: #f8fafc;
}

.admin-confirm-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

@media (max-width: 520px) {
    .admin-confirm-backdrop {
        align-items: flex-end;
        padding: 16px;
    }

    .admin-confirm-dialog {
        width: 100%;
        max-height: calc(100vh - 32px);
        padding: 20px 18px 16px;
    }

    .admin-confirm-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-confirm-button {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .container {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 14px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--admin-line);
        box-shadow: 0 8px 20px rgba(17, 24, 39, 0.05);
    }

    .sidebar .logo {
        margin-bottom: 10px;
        font-size: 1.25rem;
    }

    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .sidebar li {
        margin: 0;
    }

    .sidebar li a {
        max-width: calc(100vw - 32px);
        padding: 7px 10px;
        white-space: normal;
    }

    .sidebar-link-text {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .sidebar li.active a,
    .sidebar li a:hover {
        transform: none;
    }

    .main-content {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .admin-language-switcher {
        width: 100%;
        margin-right: 0;
    }

    .cards {
        flex-direction: column;
    }
}
