:root {
    color-scheme: light;
    --bg: #f4f7f9;
    --panel: #ffffff;
    --panel-strong: #ffffff;
    --sidebar: #edf3f7;
    --sidebar-active: #dfe7ec;
    --surface-subtle: #f7f9fa;
    --border: #dfe4e8;
    --ink: #202428;
    --muted: #747c84;
    --accent: #111111;
    --accent-strong: #2b2b2b;
    --danger: #e05b63;
    --shadow: 0 8px 24px rgba(25, 35, 45, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", sans-serif;
    font-size: 15px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--ink);
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

textarea {
    resize: vertical;
}

.update-file-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}

.update-file-status > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.update-file-status span { color: var(--muted); font-size: 12px; font-weight: 600; }
.update-file-status code,
.update-file-status a { overflow-wrap: anywhere; font-weight: 500; }
.sync-update-heading { margin-top: 32px; }
.sync-stage-controls { margin: 18px 0 12px; }

.shell {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    grid-template-rows: 58px minmax(0, 1fr);
    min-height: 100vh;
    min-width: 1484px;
}

.topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 26px;
    background: var(--sidebar);
    border-bottom: 1px solid var(--border);
}

.topbar-brand,
.topbar-actions,
.session-bar,
.session-summary {
    display: flex;
    align-items: center;
}

.topbar-brand { gap: 10px; font-size: 16px; }
.topbar-actions { gap: 16px; min-width: 0; }
.topbar-actions .session-bar { order: 1; }
.topbar-actions .language-control { order: 2; }
.brand-icon { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; }
.brand-badge { padding: 2px 8px; border-radius: 5px; background: #eef1f3; color: var(--ink); font-size: 12px; font-weight: 700; }

.session-bar { gap: 14px; min-width: 0; }
.session-summary { gap: 8px; min-width: 0; font-size: 13px; white-space: nowrap; }
.session-label { color: var(--muted); font-size: 12px; }
.session-summary #sessionSummary { overflow: hidden; text-overflow: ellipsis; max-width: 330px; }
.session-bar .session-actions { gap: 8px; flex-wrap: nowrap; }
.session-bar button { min-height: 34px; padding: 6px 11px; font-size: 13px; }

.sidebar {
    grid-column: 1;
    grid-row: 2;
    padding: 20px 16px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand-kicker,
.section-title {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    color: var(--muted);
}

.panel h2,
.workspace h2 {
    margin: 8px 0 0;
    font-size: 24px;
    line-height: 1.1;
}

.sidebar-copy,
.muted,
.message,
small {
    color: var(--muted);
}

.content {
    grid-column: 2;
    grid-row: 2;
    padding: 20px 24px;
    background: var(--panel);
    display: grid;
    gap: 12px;
    align-content: start;
}

.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
}

.workspace {
    min-width: 0;
}

.room-type-management > .panel:not(.modal-panel) {
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.workspace .toolbar {
    margin-bottom: 12px;
}

.card {
    padding: 18px;
}

.panel-header,
.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.toolbar-actions,
.session-actions,
.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink);
    font: inherit;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
    color: var(--ink);
    font-weight: 700;
}

.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, 220px) 140px;
    gap: 12px;
    margin-bottom: 16px;
}

.user-filters {
    grid-template-columns: minmax(240px, 1fr) minmax(360px, 440px) 140px;
}

.form-grid {
    display: grid;
    gap: 16px;
    align-items: start;
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    align-self: start;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--ink);
}

input::placeholder,
textarea::placeholder {
    color: #aeb8c7;
    opacity: 1;
}

.row-actions [data-action="toggle"] {
    display: none;
}

button {
    border: 0;
    border-radius: 8px;
    min-height: 36px;
    padding: 6px 15px;
    font-weight: 600;
    cursor: pointer;
}

button.primary {
    background: var(--accent);
    color: #fff;
}

button.primary:hover {
    background: var(--accent-strong);
}

button.ghost {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

button.ghost.danger {
    color: #fff;
}

button.ghost:hover,
button.ghost:focus-visible {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1320px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 13px;
    color: var(--muted);
    background: var(--surface-subtle);
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    margin: -5px -6px;
    padding: 5px 6px;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
}

.sort-button:hover,
.sort-button:focus-visible {
    color: var(--ink);
    background: var(--sidebar-active);
    outline: none;
}

.sort-indicator {
    display: inline-block;
    width: 10px;
    color: var(--ink);
    font-size: 11px;
    text-align: center;
}

.tag-list,
.checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 10px;
    border-radius: 999px;
    background: #f0f4ff;
    border: 1px solid var(--border);
    font-size: 12px;
}

.tag.expired {
    color: var(--danger);
    background: #fff0f0;
    border-color: #efc4c4;
}

.language-control {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.language-control select {
    min-height: 34px;
    width: 108px;
    padding: 5px 8px;
    font-size: 13px;
}

.hotel-table {
    min-width: 1250px;
}

.hotel-time-cell {
    white-space: nowrap;
}

.hotel-time-cell span {
    display: block;
}

.log-table {
    min-width: 1420px;
}

.log-table td {
    vertical-align: middle;
}

.log-level {
    white-space: nowrap;
}

.log-suggestion {
    min-width: 180px;
}

.user-table {
    min-width: 1220px;
    table-layout: fixed;
}

.user-col-username { width: 145px; }
.user-col-name { width: 145px; }
.user-col-status { width: 78px; }
.user-col-hotels { width: 180px; }
.user-col-roles { width: 130px; }
.user-col-time { width: 128px; }
.user-col-actions { width: 148px; }

.user-table .user-status-cell,
.user-table th:nth-child(3) {
    min-width: 78px;
    white-space: nowrap;
}

.user-table .user-status-cell .tag {
    white-space: nowrap;
}

.user-time-cell {
    white-space: nowrap;
}

.user-time-cell span {
    display: block;
}

.user-table .row-actions {
    flex-wrap: nowrap;
}

.user-table td,
.hotel-table td {
    vertical-align: middle;
}

.user-table .row-actions,
.hotel-table .row-actions {
    align-items: center;
}

.checkbox-list label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
}

.user-roles .checkbox-list {
    align-items: flex-start;
}

.checkbox-list input {
    width: auto;
    margin: 0;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    text-decoration: none;
}

.button-link.ghost {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-weight: 600;
}

.button-link.ghost:hover,
.button-link.ghost:focus-visible {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.room-type-management {
    display: grid;
    gap: 20px;
}

.user-form {
    grid-template-columns: minmax(280px, 0.9fr) minmax(380px, 1.1fr);
    grid-template-areas:
        "phone name"
        "status hotels"
        "defaultHotel hotels"
        "password roles"
        "actions actions";
    column-gap: 20px;
    row-gap: 14px;
}

.user-phone { grid-area: phone; }
.user-name { grid-area: name; }
.user-status { grid-area: status; }
.user-hotels { grid-area: hotels; }
.user-default-hotel { grid-area: defaultHotel; }
.user-password { grid-area: password; }
.user-roles { grid-area: roles; }

.user-form .span-full {
    grid-area: actions;
    grid-column: auto;
}

.user-hotels select {
    min-height: 118px;
    padding: 8px 10px;
}

.user-form small {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
}

.user-form .form-actions {
    margin-top: 4px;
}

.hidden {
    display: none !important;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(25, 35, 52, 0.34);
}

.modal-panel {
    position: fixed;
    z-index: 21;
    top: 50%;
    left: 50%;
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    transform: translate(-50%, -50%);
    box-shadow: 0 22px 56px rgba(25, 35, 52, 0.22);
}

.empty {
    padding: 16px 0 0;
    color: var(--muted);
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(23, 33, 27, 0.96);
    color: #fff;
    box-shadow: var(--shadow);
}

code {
    font-family: Consolas, monospace;
}

@media (max-width: 980px) {
    .shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        min-width: 0;
    }

    .topbar {
        grid-column: 1;
        padding: 10px 18px;
        flex-wrap: wrap;
        min-height: 58px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .sidebar {
        grid-column: 1;
        grid-row: 2;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .content { grid-column: 1; grid-row: 3; }

    .two-columns,
    .user-form,
    .filters {
        grid-template-columns: 1fr;
    }

    .user-form {
        grid-template-areas:
            "phone"
            "name"
            "status"
            "hotels"
            "defaultHotel"
            "roles"
            "password"
            "actions";
    }

    .content {
        padding: 12px;
    }

    .modal-panel {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        padding: 18px;
    }
}
