:root {
    /* Surf palette */
    --turquoise: #00bcd4;
    --turquoise-deep: #00838f;
    --turquoise-light: #4dd0e1;
    --turquoise-soft: #b2ebf2;
    --sky: #4fc3f7;
    --sky-soft: #b3e5fc;
    --sky-deep: #0288d1;
    --sand: #fff8e1;
    --sand-deep: #ffecb3;
    --coral: #ff7043;
    --coral-soft: #ffccbc;

    --sidebar-bg: linear-gradient(165deg, #006064 0%, #00838f 45%, #00acc1 100%);
    --sidebar-flat: #00838f;
    --sidebar-width: 240px;
    --topbar-height: 88px;
    --content-bg: #f0f9fb;
    --card-bg: #ffffff;
    --text-primary: #1a3a4a;
    --text-secondary: #4a6c7a;
    --text-light: #8aa4b0;
    --accent: var(--turquoise);
    --accent-hover: var(--turquoise-deep);

    /* Pastel slot colors (absolute occupancy thresholds) */
    --slot-empty-bg: #f5fbfc;
    --slot-empty-text: #8aa4b0;
    --slot-low-bg: #c8e6c9;
    --slot-low-text: #2e7d32;
    --slot-mid-bg: #fff9c4;
    --slot-mid-text: #b28704;
    --slot-high-bg: #ffccbc;
    --slot-high-text: #d84315;
    --slot-full-bg: #ef9a9a;
    --slot-full-text: #b71c1c;
    --slot-blocked-bg: #eceff1;
    --slot-blocked-text: #90a4ae;

    /* Locations */
    --loc-yacht: #00bcd4;
    --loc-yacht-soft: #b2ebf2;
    --loc-yacht-edge: #00838f;
    --loc-beach: #81d4fa;
    --loc-beach-soft: #e1f5fe;
    --loc-beach-edge: #0288d1;

    /* Generic */
    --green: #2e7d32;
    --green-light: #c8e6c9;
    --yellow: #b28704;
    --yellow-light: #fff9c4;
    --red: #c62828;
    --red-light: #ffcdd2;
    --border: #d6e7ec;
    --radius: 10px;
    --shadow: 0 4px 14px rgba(0, 96, 100, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 96, 100, 0.18);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(1100px 600px at 90% -10%, rgba(77, 208, 225, 0.18), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(255, 248, 225, 0.6), transparent 60%),
        var(--content-bg);
    min-height: 100vh;
    line-height: 1.5;
}

/* ========== LOGIN PAGE ========== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(1200px 800px at 50% -20%, rgba(255, 236, 179, 0.55), transparent 60%),
        linear-gradient(160deg, #004d52 0%, #00838f 45%, #26c6da 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 110px;
    background-repeat: repeat-x;
    background-size: 240px 110px;
    opacity: 0.5;
    pointer-events: none;
}

.login-page::before {
    bottom: -10px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 110'><path fill='%23ffffff' fill-opacity='0.18' d='M0 70 Q 60 30 120 70 T 240 70 V110 H0 Z'/></svg>");
}

.login-page::after {
    bottom: 30px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 110'><path fill='%23ffffff' fill-opacity='0.10' d='M0 60 Q 60 20 120 60 T 240 60 V110 H0 Z'/></svg>");
}

.login-card {
    background: rgba(255, 255, 255, 0.96);
    padding: 40px 36px 32px;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    backdrop-filter: blur(6px);
    position: relative;
    z-index: 1;
}

.login-card h1 {
    font-size: 28px;
    color: var(--turquoise-deep);
    margin-bottom: 4px;
}

.brand-logo {
    display: block;
    max-width: 100%;
    height: auto;
}

.brand-logo-login {
    max-width: 220px;
    margin: 0 auto 12px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.login-card .form-group {
    text-align: left;
}

/* ========== TOPBAR ========== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: linear-gradient(180deg, #ffffff 0%, #f0fbfc 100%);
    border-bottom: 2px solid var(--turquoise-soft);
    box-shadow: 0 4px 18px rgba(0, 96, 100, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    z-index: 200;
}

.brand-logo-top {
    max-height: calc(var(--topbar-height) - 18px);
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 96, 100, 0.15));
}

/* ========== SIDEBAR ========== */

.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--sidebar-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 96, 100, 0.18);
}

.sidebar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 80'><path fill='%23ffffff' fill-opacity='0.06' d='M0 50 Q 60 10 120 50 T 240 50 V80 H0 Z'/></svg>");
    background-size: 240px 80px;
    background-repeat: repeat-x;
    pointer-events: none;
}

.sidebar-header {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    text-align: center;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ffffff;
    margin: 0;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 0;
    position: relative;
    z-index: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

.nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
    border-left-color: var(--sand-deep);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.10);
    position: relative;
    z-index: 1;
}

.user-info {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 6px;
}

.nav-item.logout {
    color: #ffe0b2;
    padding: 6px 0;
    font-size: 13px;
    border: none;
}

.nav-item.logout:hover {
    color: #ffffff;
    background: none;
    border: none;
}

/* ========== CONTENT ========== */

.content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 28px 32px;
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--turquoise-deep);
    letter-spacing: 0.3px;
}

/* ========== GRID CONTROLS ========== */

.grid-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.day-name {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.day-name.weekend {
    color: var(--coral);
    font-weight: 600;
}

/* ========== BUTTONS ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    background: #e8f6f8;
    border-color: var(--turquoise-light);
}

.btn-primary {
    background: linear-gradient(135deg, var(--turquoise) 0%, var(--turquoise-deep) 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--turquoise-deep) 0%, #006064 100%);
    border-color: transparent;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-danger {
    background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c62828 0%, #8e1414 100%);
    border-color: transparent;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
}

/* ========== CLIENTS — BULK + DELETE ========== */

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff4f4 0%, #ffe9e9 100%);
    border: 1px solid #ffc8c8;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(183, 28, 28, 0.06);
}

.bulk-bar.hidden {
    display: none;
}

.bulk-bar #bulk-count {
    font-weight: 600;
    color: #b71c1c;
    margin-right: auto;
}

.data-table .col-check,
.data-table .col-actions {
    width: 36px;
    text-align: center;
}

.data-table tbody td.cell-clickable {
    cursor: pointer;
}

.data-table tbody tr:hover td.cell-clickable {
    background: #f5fbfc;
}

.btn-icon-delete {
    background: transparent;
    border: 1px solid transparent;
    color: #b71c1c;
    font-size: 20px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon-delete:hover {
    background: #ffebee;
    border-color: #ffc8c8;
}

.modal-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* ========== FORMS ========== */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--turquoise);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.18);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
    vertical-align: middle;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.input-lg {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    outline: none;
    transition: border-color var(--transition);
}

.input-lg:focus {
    border-color: var(--turquoise);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.18);
}

.select-sm {
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    outline: none;
}

.search-bar {
    margin-bottom: 20px;
}

/* ========== DATA TABLES ========== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: linear-gradient(180deg, #e0f7fa 0%, #f0fbfc 100%);
}

.data-table th {
    padding: 11px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--turquoise-deep);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--turquoise-soft);
}

.data-table td {
    padding: 10px 14px;
    font-size: 14px;
    border-bottom: 1px solid #eaf3f5;
}

.data-table tbody tr:hover {
    background: #f0fbfc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #e0f7fa !important;
}

/* ========== GRID TABLE ========== */

.grid-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
}

.grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    font-size: 13px;
}

.grid-table th {
    padding: 9px 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    background: #f0fbfc;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.grid-table td {
    padding: 4px 6px;
    text-align: center;
    border: 1px solid var(--border);
    vertical-align: middle;
    min-width: 56px;
    height: 36px;
}

.grid-table .time-cell,
.grid-table .time-header {
    font-weight: 700;
    background: #e0f7fa;
    color: var(--turquoise-deep);
    white-space: nowrap;
    width: 64px;
    font-size: 12px;
}

/* Location header row (top row in thead) */
.grid-table .loc-header {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #ffffff;
    padding: 10px 8px;
    border: none;
}

.grid-table .loc-header.loc-yacht {
    background: linear-gradient(180deg, var(--loc-yacht) 0%, var(--loc-yacht-edge) 100%);
}

.grid-table .loc-header.loc-beach {
    background: linear-gradient(180deg, var(--loc-beach) 0%, var(--loc-beach-edge) 100%);
}

.grid-table .loc-header.loc-other {
    background: linear-gradient(180deg, #90a4ae 0%, #546e7a 100%);
}

/* Service header row (under location) */
.grid-table .svc-header {
    font-size: 12px;
    font-weight: 600;
    padding: 8px 6px;
}

.grid-table .svc-header.loc-yacht {
    background: var(--loc-yacht-soft);
    color: var(--loc-yacht-edge);
    border-top: 2px solid var(--loc-yacht);
}

.grid-table .svc-header.loc-beach {
    background: var(--loc-beach-soft);
    color: var(--loc-beach-edge);
    border-top: 2px solid var(--loc-beach);
}

.grid-table .svc-header.loc-other {
    background: #eceff1;
    color: var(--text-secondary);
    border-top: 2px solid #90a4ae;
}

/* Grid data cells: location-tinted + occupancy color */
.grid-table .grid-cell {
    transition: filter var(--transition), transform var(--transition);
    border-radius: 4px;
}

/* Subtle vertical guide between locations */
.grid-table .grid-cell.loc-yacht {
    border-left-color: var(--loc-yacht-soft);
    border-right-color: var(--loc-yacht-soft);
}

.grid-table .grid-cell.loc-beach {
    border-left-color: var(--loc-beach-soft);
    border-right-color: var(--loc-beach-soft);
}

/* First/last cells of a location group — highlighted side border */
.grid-table .grid-cell.loc-edge-left.loc-yacht {
    border-left: 3px solid var(--loc-yacht);
}

.grid-table .grid-cell.loc-edge-right.loc-yacht {
    border-right: 3px solid var(--loc-yacht);
}

.grid-table .grid-cell.loc-edge-left.loc-beach {
    border-left: 3px solid var(--loc-beach);
}

.grid-table .grid-cell.loc-edge-right.loc-beach {
    border-right: 3px solid var(--loc-beach);
}

/* Occupancy classes (absolute pastel thresholds) */
.cell-empty {
    background: var(--slot-empty-bg);
    color: var(--slot-empty-text);
    font-weight: 500;
    cursor: pointer;
}
.cell-empty:hover { filter: brightness(0.97); }

.cell-low {
    background: var(--slot-low-bg);
    color: var(--slot-low-text);
    cursor: pointer;
    font-weight: 600;
}
.cell-low:hover { filter: brightness(0.96); }

.cell-mid {
    background: var(--slot-mid-bg);
    color: var(--slot-mid-text);
    cursor: pointer;
    font-weight: 600;
}
.cell-mid:hover { filter: brightness(0.96); }

.cell-high {
    background: var(--slot-high-bg);
    color: var(--slot-high-text);
    cursor: pointer;
    font-weight: 700;
}
.cell-high:hover { filter: brightness(0.96); }

.cell-full {
    background: var(--slot-full-bg);
    color: var(--slot-full-text);
    font-weight: 700;
    cursor: pointer;
}
.cell-full:hover { filter: brightness(0.97); }

.cell-blocked {
    background: var(--slot-blocked-bg);
    color: var(--slot-blocked-text);
    font-style: italic;
}

.cell-content {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.cell-count {
    font-variant-numeric: tabular-nums;
}

/* ========== MODAL ========== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 96, 100, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px 32px 32px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--turquoise);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--turquoise-deep);
}

#modal-content h2 {
    margin-bottom: 18px;
    font-size: 20px;
    color: var(--turquoise-deep);
}

#modal-content h3 {
    margin: 16px 0 8px;
    font-size: 16px;
    color: var(--text-primary);
}

/* ========== TOAST ========== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    background: var(--turquoise-deep);
    color: #ffffff;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast.error {
    background: linear-gradient(135deg, var(--coral) 0%, #d84315 100%);
}

.toast.success {
    background: linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== STATUS BADGES ========== */

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-pending {
    background: var(--sand-deep);
    color: #a36b00;
}

.status-confirmed {
    background: var(--turquoise-soft);
    color: var(--turquoise-deep);
}

.status-completed {
    background: var(--green-light);
    color: var(--green);
}

.status-cancelled {
    background: var(--red-light);
    color: var(--red);
}

.status-no_show {
    background: #eceff1;
    color: var(--text-secondary);
}

.status-scheduled {
    background: var(--sky-soft);
    color: var(--sky-deep);
}

/* ========== SHIFT CHIPS ========== */

.shift-chip {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    margin: 2px 0;
    line-height: 1.3;
    cursor: pointer;
}

.shift-chip.status-scheduled {
    background: var(--sky-soft);
    border-left: 3px solid var(--sky);
    color: var(--sky-deep);
}

.shift-chip.status-completed {
    background: var(--green-light);
    border-left: 3px solid #43a047;
    color: var(--green);
}

.shift-chip.status-cancelled {
    background: var(--red-light);
    border-left: 3px solid var(--red);
    opacity: 0.6;
    text-decoration: line-through;
}

.shift-chip small {
    display: block;
    opacity: 0.8;
}

.shifts-table td {
    vertical-align: top;
    min-width: 100px;
}

/* ========== ALERTS ========== */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid #ef9a9a;
}

.alert-success {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid #a5d6a7;
}

.alert-warning {
    background: var(--sand-deep);
    color: #a36b00;
    border: 1px solid #ffd54f;
}

/* ========== CARDS / SETTINGS ========== */

.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.settings-section {
    background: var(--card-bg);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 3px solid var(--turquoise-soft);
}

.settings-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--turquoise-deep);
}

/* ========== TABS ========== */

.modal-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--turquoise-soft); }
.tab { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 14px; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--turquoise-deep); border-bottom-color: var(--turquoise); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== LEGEND ========== */

.grid-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.legend-swatch.s-empty { background: var(--slot-empty-bg); }
.legend-swatch.s-low   { background: var(--slot-low-bg); }
.legend-swatch.s-mid   { background: var(--slot-mid-bg); }
.legend-swatch.s-high  { background: var(--slot-high-bg); }
.legend-swatch.s-full  { background: var(--slot-full-bg); }
.legend-swatch.s-blocked { background: var(--slot-blocked-bg); }
.legend-swatch.l-yacht { background: var(--loc-yacht); border-color: var(--loc-yacht-edge); }
.legend-swatch.l-beach { background: var(--loc-beach); border-color: var(--loc-beach-edge); }

.legend-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    display: inline-block;
}

/* ========== LOADING ========== */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    :root {
        --topbar-height: 64px;
    }

    .sidebar {
        width: 60px;
        overflow: hidden;
    }

    .sidebar-title,
    .nav-item span:not(.nav-icon),
    .sidebar-footer .user-info {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .nav-icon {
        margin: 0;
    }

    .content {
        margin-left: 60px;
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .grid-controls {
        width: 100%;
    }

    .modal-container {
        width: 95%;
        padding: 22px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
    }
}
