* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f5f7;
    color: #1f2430;
}

/* ---- Authenticated layout: sidebar + content ---- */
.app {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 210px;
    flex: 0 0 210px;
    background: #262d3a;
    color: #fff;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    margin-bottom: 18px;
    font-size: 16px;
}
.sidebar-brand img { width: 30px; height: 30px; border-radius: 6px; }
.sidebar-brand strong { color: #5b9bff; }
.sidebar-user-name { font-weight: 700; font-size: 15px; }
.sidebar-user-role { font-size: 12px; color: #b7bdca; margin-bottom: 20px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
    color: #dfe2ea;
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 14px;
}
.sidebar-nav a:hover { background: #333c4d; }
.sidebar-nav a.active { background: #3a4557; color: #fff; font-weight: 600; }
.sidebar-logout {
    margin-top: auto;
    color: #fff;
    background: #3a4557;
    text-align: center;
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 14px;
}
.sidebar-logout:hover { background: #47536a; }

.content { flex: 1; padding: 26px 32px; overflow-x: auto; }
.content h1 { font-size: 22px; margin: 0 0 18px; }

@media (max-width: 900px) {
    .app { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex: 0 0 auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        padding: 12px 16px;
    }
    .sidebar-brand { margin-bottom: 0; margin-right: 6px; font-size: 14px; }
    .sidebar-brand img { width: 24px; height: 24px; }
    .sidebar-user-name, .sidebar-user-role { display: inline; margin: 0; }
    .sidebar-user-role { margin-right: 8px; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .sidebar-nav a { padding: 6px 9px; }
    .sidebar-logout { margin-top: 0; margin-left: auto; }
    .content { padding: 16px; }
}

@media (max-width: 480px) {
    .auth-card { width: 100%; padding: 24px 20px; }
}

/* ---- Type-to-filter dropdown (searchable-select.js) ----
   Looks like the plain <select> fields elsewhere (same border/radius/chevron); the
   popup list is absolutely positioned and layout-contained so opening it can never
   shift the input or surrounding fields. */
.searchable-select {
    position: relative;
    display: block;
    width: 100%;
}
.searchable-select.ss-open {
    position: relative;
    z-index: 50;
}
.searchable-select .ss-input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid #cfd3dc;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7180' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.searchable-select .ss-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cfd3dc;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    z-index: 30;
}
.searchable-select .ss-option { padding: 8px 10px; font-size: 14px; cursor: pointer; }
.searchable-select .ss-option:hover, .searchable-select .ss-option.ss-highlighted { background: #eef2fb; }
.searchable-select .ss-empty { padding: 8px 10px; font-size: 13px; color: #8a90a0; font-style: italic; }

/* ---- Cards / panels ---- */
.card {
    background: #fff;
    border: 1px solid #e4e6ec;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; color: #444b5a; }

/* ---- Forms ---- */
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; color: #444b5a; }
.field input, .field select {
    padding: 8px 10px;
    border: 1px solid #cfd3dc;
    border-radius: 6px;
    font-size: 14px;
}
.field .hint { font-size: 11px; color: #8a90a0; font-style: italic; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }

button, .btn {
    display: inline-block;
    background: #2f6feb;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .btn:hover { background: #2559c4; }
button.secondary, .btn.secondary { background: #e4e6ec; color: #1f2430; }
button.secondary:hover, .btn.secondary:hover { background: #d3d6e0; }
button.danger, .btn.danger { background: #d64545; }
button.danger:hover, .btn.danger:hover { background: #b43535; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eceef2; }
th { color: #6b7180; font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #f8f9fb; }
.row-actions { display: flex; gap: 8px; }
.row-actions a, .row-actions button { font-size: 12px; padding: 5px 10px; }

/* ---- Responsive tables: stack into cards below tablet width ---- */
@media (max-width: 900px) {
    table, thead, tbody, tr, td { display: block; width: 100%; }
    table { border: none; }
    thead { position: absolute; top: -9999px; left: -9999px; }
    tbody tr {
        margin-bottom: 12px;
        border: 1px solid #e4e6ec;
        border-radius: 8px;
        padding: 4px 0;
        background: #fff;
    }
    tbody tr:hover td { background: transparent; }
    tbody td {
        border: none;
        border-bottom: 1px solid #f0f1f4;
        padding: 8px 12px 8px 44%;
        position: relative;
        min-height: 18px;
    }
    tbody td:last-child { border-bottom: none; }
    tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        top: 8px;
        width: 38%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
        font-size: 11px;
        color: #6b7180;
        text-transform: uppercase;
    }
    tbody td.row-actions {
        padding-left: 12px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }
    tbody td.row-actions::before { content: none; }

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

.status-occupied { background: #ffd6d6; }
.status-available { background: #d6ffdb; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: #fdeaea; color: #a12a2a; border: 1px solid #f3caca; }
.alert-success { background: #e6f7ea; color: #1e7a35; border: 1px solid #c3ecce; }

/* ---- Login / Register ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f5f7;
}
.auth-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e4e6ec;
    padding: 32px 36px;
    width: 360px;
}
.auth-logo { display: block; width: 56px; height: 56px; border-radius: 10px; margin: 0 auto 14px; }
.auth-card h1 { font-size: 19px; margin: 0 0 20px; text-align: center; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .form-actions { flex-direction: column; }
.auth-card button { width: 100%; }
.auth-links { margin-top: 14px; font-size: 13px; text-align: center; }
.auth-hint { font-size: 12px; color: #8a90a0; text-align: center; margin-top: 14px; }
