:root {
    --blue: #0732bf;
    --blue-deep: #071e7a;
    --blue-soft: #eef3ff;
    --text: #10214a;
    --muted: #63708c;
    --line: #dfe6f3;
    --bg: #f6f9fe;
    --card: #ffffff;
    --green: #55b85a;
    --green-soft: #edf9ee;
    --red: #ef5b5b;
    --red-soft: #fff0f0;
    --shadow: 0 14px 36px rgba(20, 39, 91, 0.08);
    --radius: 8px;
}

[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--blue);
    text-decoration: none;
}

main {
    padding-bottom: 48px;
}

.topbar {
    min-height: 86px;
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 0 48px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(10, 29, 80, 0.04);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    color: var(--blue-deep);
    white-space: nowrap;
}

.brand-logo {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-divider {
    width: 1px;
    height: 38px;
    background: #b9c4dc;
}

.brand-app {
    font-size: 22px;
    font-weight: 800;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.main-nav a {
    color: #26375f;
    font-weight: 700;
    padding: 31px 8px 27px;
    border-bottom: 4px solid transparent;
}

.main-nav a.active,
.main-nav a:hover {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.user-zone {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #1234b8, #33a9d7);
    font-weight: 800;
}

.hello {
    display: grid;
    line-height: 1.15;
}

.hello span {
    color: var(--muted);
    font-size: 12px;
}

.hello strong {
    color: var(--blue-deep);
}

.logout-link {
    border-left: 1px solid var(--line);
    padding-left: 18px;
    color: #4b5878;
    font-weight: 700;
}

.hero {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.1fr);
    min-height: 320px;
    background: #fff;
}

.hero-copy {
    padding: 64px 8vw;
}

.hero h1 {
    margin: 0 0 16px;
    font-size: 56px;
    line-height: 1;
    color: var(--blue-deep);
}

.hero p {
    margin: 0 0 28px;
    color: #435177;
    font-size: 24px;
    max-width: 430px;
}

.hero-actions,
.actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-image {
    min-height: 320px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.25), rgba(255,255,255,0)),
        url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1300&q=80") center / cover;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(7, 50, 191, 0.2);
}

.btn-secondary {
    background: #fff;
    color: var(--blue);
    border-color: #aebbe3;
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: #5a6684;
    border-color: var(--line);
}

.btn-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.btn-wide {
    width: 100%;
}

.dashboard-grid,
.booking-layout {
    max-width: 1180px;
    margin: 28px auto 0;
    padding: 0 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(430px, 1.05fr);
    gap: 24px;
}

.dashboard-home {
    grid-template-columns: minmax(0, 1fr);
}

.dashboard-home .dashboard-left {
    max-width: 980px;
}

.dashboard-left {
    display: grid;
    gap: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

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

.stat-card {
    min-height: 176px;
    padding: 24px;
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 10px 18px;
    align-items: start;
}

.stat-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--blue-soft);
    color: var(--blue);
    position: relative;
}

.stat-icon::before,
.stat-icon::after {
    content: "";
    position: absolute;
    color: currentColor;
}

.icon-desk::before {
    width: 24px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 4px;
    transform: skewX(-8deg);
}

.icon-desk::after {
    width: 18px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-right: 2px solid currentColor;
    bottom: 13px;
}

.icon-calendar::before {
    width: 26px;
    height: 26px;
    border: 2px solid currentColor;
    border-radius: 5px;
}

.icon-calendar::after {
    width: 18px;
    height: 2px;
    background: currentColor;
    top: 18px;
    box-shadow: 0 8px 0 rgba(7, 50, 191, 0.35);
}

.icon-week::before {
    width: 28px;
    height: 28px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.icon-week::after {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 11px 0 0 rgba(7, 50, 191, 0.55), -11px 0 0 rgba(7, 50, 191, 0.55);
}

.stat-card strong {
    font-size: 42px;
    line-height: 1;
    color: var(--blue-deep);
}

.stat-card span {
    grid-column: 2;
    color: #2f3b5c;
}

.stat-card a {
    grid-column: 2;
    align-self: end;
    font-weight: 800;
}

.card {
    padding: 24px;
}

.card h2,
.room-card h2 {
    margin: 0 0 18px;
    color: var(--blue-deep);
    font-size: 20px;
}

.card-title-row,
.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-heading {
    max-width: 1180px;
    margin: 34px auto 20px;
    padding: 0 24px;
}

.page-heading h1 {
    margin: 0;
    color: var(--blue-deep);
    font-size: 36px;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
}

.reservation-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.reservation-line:last-child {
    border-bottom: 0;
}

.reservation-line div {
    display: grid;
    gap: 4px;
}

.reservation-line span,
.muted {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 12px;
}

.badge-success {
    background: var(--green-soft);
    color: #236b28;
}

.badge-info {
    background: var(--blue-soft);
    color: var(--blue);
}

.badge-muted {
    background: #eef1f6;
    color: #657089;
}

.room-shell {
    position: relative;
    min-height: 350px;
    border: 5px solid #516078;
    background: #fff;
    padding: 34px 64px 60px;
    overflow: visible;
}

.room-shell::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid #b7c0d0;
    pointer-events: none;
}

.desks-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(104px, 1fr));
    gap: 24px 42px;
    max-width: 360px;
    margin: 0 auto;
}

.desk {
    position: relative;
    width: min(128px, 100%);
    min-height: 104px;
    justify-self: center;
    border: 2px solid var(--green);
    border-radius: 8px;
    background: var(--green-soft);
    color: #114818;
    cursor: pointer;
    font: inherit;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}

.desk.is-reserved {
    background: var(--red-soft);
    border-color: var(--red);
    color: #b91313;
    cursor: not-allowed;
}

.desk.is-selected {
    background: var(--blue-soft);
    border-color: #4479ff;
    color: var(--blue);
}

.desk-number {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
}

.desk-label {
    font-size: 12px;
    font-weight: 800;
}

.desk-chair {
    position: absolute;
    width: 14px;
    height: 46px;
    border: 2px solid currentColor;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.55;
}

.desk.chair-left .desk-chair {
    left: -17px;
    border-right: 0;
    border-radius: 12px 0 0 12px;
}

.desk.chair-right .desk-chair {
    right: -17px;
    border-left: 0;
    border-radius: 0 12px 12px 0;
}

.desk-computer {
    position: absolute;
    top: 10px;
    width: 40px;
    height: 32px;
    opacity: 0.72;
}

.computer-monitor {
    position: absolute;
    top: 0;
    left: 50%;
    width: 30px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 4px;
    transform: translateX(-50%);
}

.computer-monitor::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 10px;
    height: 6px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateX(-50%);
}

.computer-keyboard {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 36px;
    height: 7px;
    border: 2px solid currentColor;
    border-radius: 3px;
    transform: translateX(-50%);
}

.computer-keyboard::before,
.computer-keyboard::after {
    content: "";
    position: absolute;
    top: 2px;
    width: 4px;
    height: 1px;
    background: currentColor;
    box-shadow: 7px 0 currentColor, 14px 0 currentColor, 21px 0 currentColor;
}

.computer-keyboard::before {
    left: 4px;
}

.computer-keyboard::after {
    left: 7px;
    top: 4px;
}

.desk.chair-left .desk-computer {
    right: 10px;
}

.desk.chair-right .desk-computer {
    left: 10px;
}

.desk-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    min-width: 230px;
    padding: 10px;
    border-radius: 8px;
    background: #13224b;
    color: #fff;
    font-size: 12px;
    text-align: left;
    z-index: 5;
}

.desk:hover .desk-tooltip,
.desk:focus .desk-tooltip {
    display: block;
}

.room-door {
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 90px;
    height: 45px;
    transform: translateX(-50%);
    background: #fff;
    border-top: 3px solid #8390a5;
}

.room-door span {
    position: absolute;
    bottom: 0;
    width: 44px;
    height: 45px;
    border: 2px solid #9ba7ba;
    border-bottom: 0;
}

.room-door span:first-child {
    left: 0;
    border-right: 0;
    border-radius: 45px 0 0 0;
}

.room-door span:last-child {
    right: 0;
    border-left: 0;
    border-radius: 0 45px 0 0;
}

.entrance-label {
    position: absolute;
    left: 50%;
    bottom: -34px;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.plant {
    position: absolute;
    top: 18px;
    color: #70ad76;
    font-size: 34px;
}

.plant-left {
    left: 22px;
}

.plant-right {
    right: 22px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 36px;
    flex-wrap: wrap;
    margin-top: 44px;
    color: #3d4967;
}

.dot {
    width: 14px;
    height: 14px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.dot.free {
    background: var(--green);
}

.dot.reserved {
    background: var(--red);
}

.dot.partial {
    background: #f2a51a;
}

.dot.selected {
    background: #4479ff;
}

.calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.calendar-head h2 {
    margin: 0;
}

.month-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendar-weekday {
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
    text-align: center;
    padding-bottom: 4px;
}

.calendar-day {
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px;
    display: grid;
    gap: 2px;
    color: var(--text);
    background: #fff;
}

.calendar-day strong {
    font-size: 15px;
    line-height: 1;
}

.calendar-day span {
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}

.calendar-day.free {
    background: var(--green-soft);
    border-color: #91d694;
}

.calendar-day.partial {
    background: #fff7e8;
    border-color: #f2a51a;
}

.calendar-day.full {
    background: var(--red-soft);
    border-color: var(--red);
}

.calendar-day.selected {
    outline: 3px solid rgba(68, 121, 255, 0.38);
    border-color: #4479ff;
}

.calendar-day.range-start,
.calendar-day.range-end {
    box-shadow: inset 0 0 0 2px #4479ff;
}

.calendar-day.outside {
    opacity: 0.42;
}

.calendar-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin: 14px 0 22px;
    color: #3d4967;
    font-size: 13px;
}

.form-grid,
.filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.form-grid.compact,
.filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
    display: grid;
    gap: 6px;
    color: #2c3858;
    font-weight: 800;
    font-size: 13px;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #c7d2ea;
    border-radius: 8px;
    padding: 9px 11px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.booking-panel {
    align-self: start;
}

.booking-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.manager-fields {
    display: grid;
    gap: 14px;
}

.mode-switch {
    display: grid;
    gap: 8px;
}

.mode-switch label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #c7d2ea;
    border-radius: 8px;
    background: #fff;
}

.mode-switch input {
    width: auto;
    min-height: auto;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: auto;
    min-height: auto;
}

.beneficiary-fields {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.confirmation-box {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 8px;
    background: var(--blue-soft);
    color: var(--blue-deep);
    border: 1px solid #cbd8ff;
}

.confirmation-box span {
    color: var(--muted);
    font-size: 13px;
}

.confirmation-box.has-error {
    background: var(--red-soft);
    border-color: var(--red);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--blue-deep);
    font-size: 13px;
}

.inline-form {
    display: inline-flex;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 30px;
}

.flash {
    max-width: 1180px;
    margin: 18px auto 0;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 700;
}

.flash-success {
    background: var(--green-soft);
    color: #236b28;
}

.flash-error {
    background: var(--red-soft);
    color: #b91313;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(rgba(246, 249, 254, 0.86), rgba(246, 249, 254, 0.95)),
        url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1400&q=80") center / cover;
}

.login-card {
    width: min(440px, 100%);
    padding: 34px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    margin: 24px 0 8px;
    color: var(--blue-deep);
}

.login-card p {
    color: var(--muted);
    margin-bottom: 24px;
}

@media (max-width: 980px) {
    .topbar {
        padding: 14px 20px;
        min-height: auto;
        flex-wrap: wrap;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .main-nav a {
        padding: 10px 4px;
    }

    .user-zone {
        margin-left: auto;
    }

    .hero,
    .dashboard-grid,
    .booking-layout {
        grid-template-columns: 1fr;
    }

    .hero-copy {
        padding: 44px 24px;
    }

    .hero h1 {
        font-size: 44px;
    }

    .hero-image {
        min-height: 230px;
    }
}

@media (max-width: 680px) {
    .brand-logo {
        font-size: 28px;
    }

    .brand-app {
        font-size: 18px;
    }

    .hello,
    .logout-link {
        display: none;
    }

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

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

    .room-shell {
        padding: 30px 36px 56px;
        min-height: 310px;
    }

    .desks-grid {
        gap: 16px 24px;
        grid-template-columns: repeat(2, minmax(90px, 1fr));
    }

    .desk {
        min-height: 68px;
    }

    .desk-number {
        font-size: 22px;
    }

    .legend {
        gap: 16px;
    }
}
