:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #dfe4ec;
    --blue: #2563eb;
    --pink: #db2777;
    --green: #059669;
    --yellow: #d97706;
    --cyan: #0891b2;
    --danger: #dc2626;
    --shadow: 0 16px 36px rgba(31, 41, 55, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: 0;
}

button {
    cursor: pointer;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.12), transparent 38%),
        linear-gradient(315deg, rgba(5, 150, 105, 0.12), transparent 42%),
        var(--bg);
}

.login-shell {
    width: min(420px, 100%);
}

.login-brand,
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand {
    justify-content: center;
    margin-bottom: 22px;
}

.login-brand h1 {
    margin: 0;
    font-size: 28px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--ink);
    color: #fff;
    font-weight: 800;
}

.login-card,
.tool-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-card {
    display: grid;
    gap: 14px;
    padding: 22px;
}

.login-card label,
.form-grid label,
.compact-field {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 9px 11px;
    outline: none;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    background: #101827;
    color: #fff;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    color: #aeb8c8;
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 7px;
}

.nav-item,
.logout {
    min-height: 42px;
    border: 0;
    border-radius: var(--radius);
    padding: 10px 12px;
    color: #cbd5e1;
    background: transparent;
    text-align: left;
    text-decoration: none;
}

.nav-item:hover,
.logout:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.nav-item.active {
    color: #fff;
    background: #2563eb;
}

.logout {
    margin-top: auto;
}

.workspace {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compact-field {
    min-width: 180px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpi {
    min-height: 128px;
    display: grid;
    align-content: space-between;
    border-radius: var(--radius);
    padding: 18px;
    color: #fff;
    overflow: hidden;
}

.kpi span {
    font-weight: 700;
}

.kpi strong {
    font-size: 34px;
    line-height: 1;
}

.kpi-blue {
    background: var(--blue);
}

.kpi-pink {
    background: var(--pink);
}

.kpi-green {
    background: var(--green);
}

.kpi-yellow {
    background: var(--yellow);
}

.split-layout,
.section-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.3fr);
    gap: 18px;
    align-items: start;
}

.tool-panel {
    min-width: 0;
    padding: 18px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 18px;
}

.color-panel {
    min-height: 260px;
    display: grid;
    align-content: start;
}

.occupancy-ring {
    width: min(220px, 100%);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin: 10px auto;
    border: 18px solid rgba(37, 99, 235, 0.14);
    border-top-color: var(--blue);
    border-right-color: var(--green);
    border-radius: 50%;
}

.occupancy-ring span {
    font-size: 34px;
    font-weight: 800;
}

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

.form-grid .panel-heading,
.form-grid .wide,
.form-grid button {
    grid-column: 1 / -1;
}

.slim-form {
    box-shadow: none;
    border: 0;
    padding: 0;
}

.check-field {
    align-content: end;
    grid-template-columns: 18px 1fr;
    align-items: center;
    min-height: 40px;
    text-transform: none;
    color: var(--ink);
    font-size: 14px;
}

.check-field input {
    width: 18px;
    min-height: 18px;
    padding: 0;
}

.primary-button,
.ghost-button,
.login-card button {
    min-height: 40px;
    border: 0;
    border-radius: var(--radius);
    padding: 9px 14px;
    font-weight: 800;
}

.primary-button,
.login-card button {
    background: var(--blue);
    color: #fff;
}

.primary-button:hover,
.login-card button:hover {
    background: #1d4ed8;
}

.ghost-button {
    background: #eef2ff;
    color: #1d4ed8;
}

.ghost-button:hover {
    background: #dbeafe;
}

.search-input {
    max-width: 260px;
}

.inline-period,
.report-controls,
.calendar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.report-heading {
    align-items: flex-start;
}

.report-controls select {
    min-width: 250px;
}

.data-table {
    width: 100%;
    overflow: auto;
}

.data-table table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.row-button {
    min-height: 32px;
    border: 0;
    border-radius: 7px;
    padding: 6px 10px;
    background: #ecfeff;
    color: #0e7490;
    font-weight: 800;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 9px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 800;
}

.status-pill.cancelled,
.status-pill.no_show {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill.checked_in {
    background: #dcfce7;
    color: #166534;
}

.status-pill.checked_out {
    background: #f3f4f6;
    color: #374151;
}

.mini-list,
.note-list,
.report-summary {
    display: grid;
    gap: 10px;
}

.mini-item,
.note-item,
.summary-chip {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 12px;
    background: #fff;
}

.note-item {
    align-items: flex-start;
    margin-top: 12px;
}

.note-item.done {
    opacity: 0.6;
}

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

.report-summary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 12px;
}

.summary-chip {
    display: grid;
    gap: 4px;
}

.summary-chip span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-chip strong {
    font-size: 20px;
}

.calendar-grid {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    touch-action: pan-y;
}

.calendar-table {
    display: grid;
    min-width: 980px;
}

.calendar-row,
.calendar-head {
    display: grid;
    grid-template-columns: 160px repeat(var(--days), minmax(78px, 1fr));
    min-height: 50px;
}

.calendar-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
}

.calendar-cell,
.room-cell {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 8px;
}

.room-cell {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    font-weight: 800;
}

.calendar-head .room-cell {
    background: #f8fafc;
    z-index: 3;
}

.calendar-cell {
    min-width: 78px;
}

.reservation-block {
    min-height: 32px;
    border-radius: 7px;
    padding: 6px 7px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10;
    min-width: 220px;
    max-width: min(420px, calc(100vw - 40px));
    min-height: 44px;
    display: none;
    align-items: center;
    border-radius: var(--radius);
    padding: 12px 14px;
    background: #101827;
    color: #fff;
    box-shadow: var(--shadow);
}

.toast.show {
    display: flex;
}

.toast.error {
    background: var(--danger);
}

.notice {
    border-radius: var(--radius);
    padding: 11px 12px;
    font-weight: 700;
}

.notice.danger {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }

    .nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .nav-item,
    .logout {
        text-align: center;
    }

    .logout {
        margin-top: 0;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .split-layout,
    .section-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .workspace {
        padding: 16px;
    }

    .topbar,
    .panel-heading,
    .report-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .kpi {
        min-height: 108px;
    }

    .report-controls,
    .calendar-controls,
    .inline-period {
        align-items: stretch;
    }

    .report-controls > *,
    .calendar-controls > *,
    .inline-period > * {
        flex: 1 1 100%;
    }
}
