:root {
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    color: #243247;
    background: #f3f6fb;
    font-size: 15px;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;

    --primary: #173b63;
    --primary-dark: #102c4a;
    --accent: #0d9488;
    --accent-light: #e7f6f3;
    --text: #243247;
    --muted: #718096;
    --border: #e2e8f0;
    --surface: #ffffff;
    --background: #f3f6fb;
    --danger: #b42318;
    --success: #18794e;
    --shadow: 0 5px 18px rgba(25, 45, 75, .055);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    background: var(--background);
}

a {
    transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(25, 45, 75, .035);
    padding: 15px max(20px, calc((100% - 1200px) / 2));
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.brand {
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -.35px;
    color: var(--primary);
    text-decoration: none;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-header nav a,
.link-button {
    color: #46566c;
    text-decoration: none;
    font: inherit;
    font-size: .92rem;
    font-weight: 600;
    padding: 8px 11px;
    border-radius: 7px;
}

.site-header nav a:hover {
    color: var(--primary);
    background: #edf3f9;
}

.container {
    width: min(1200px, calc(100% - 36px));
    margin: 34px auto;
}

.narrow {
    max-width: 480px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.page-heading h1 {
    margin: 0 0 5px;
    color: var(--primary-dark);
    font-size: clamp(1.65rem, 3vw, 2.1rem);
    letter-spacing: -.7px;
}

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

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: var(--shadow);
}

.panel h1,
.panel h2 {
    margin-top: 0;
    color: var(--primary-dark);
}

.panel h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 17px;
    margin: 22px 0;
}

.stat {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 21px;
    box-shadow: var(--shadow);
}

.stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
}

.stat strong {
    display: block;
    color: var(--primary-dark);
    font-size: 1.8rem;
    font-weight: 750;
    margin-top: 9px;
    overflow-wrap: anywhere;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.module-grid a,
.button-link {
    display: block;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--primary);
    text-decoration: none;
    background: #fff;
    font-weight: 650;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.module-grid a:hover,
.button-link:hover {
    background: #f8fbff;
    border-color: #9bb5d0;
    box-shadow: 0 5px 14px rgba(25, 45, 75, .07);
    transform: translateY(-2px);
}

label {
    display: block;
    color: #34445a;
    font-weight: 650;
    margin: 15px 0 7px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

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

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .13);
}

button {
    border: 0;
    border-radius: 8px;
    padding: 11px 19px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    margin-top: 16px;
    transition: background .2s ease, transform .2s ease;
}

button:hover {
    background: var(--primary-dark);
}

button:active {
    transform: translateY(1px);
}

.inline-form {
    display: inline;
}

.link-button {
    background: transparent;
    padding: 8px 11px;
    margin: 0;
    cursor: pointer;
}

.link-button:hover {
    color: var(--primary-dark);
    background: #edf3f9;
}

.notice {
    padding: 13px 17px;
    margin: 16px auto;
    width: min(1200px, calc(100% - 36px));
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
}

.notice.error {
    border-color: #f0b7b2;
    color: var(--danger);
    background: #fff6f5;
}

.notice.success {
    border-color: #a9d9bd;
    color: var(--success);
    background: #f2fbf5;
}

.site-footer {
    text-align: center;
    padding: 28px 18px;
    color: var(--muted);
    font-size: .88rem;
    border-top: 1px solid var(--border);
    margin-top: 50px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

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

th,
td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid #edf0f5;
    vertical-align: middle;
}

th {
    background: #f5f8fc;
    color: #34445a;
    font-size: .87rem;
    font-weight: 750;
    white-space: nowrap;
}

td {
    color: #46566c;
    font-size: .93rem;
}

tbody tr:hover {
    background: #f9fbfe;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.actions {
    white-space: nowrap;
}

.actions form {
    display: inline;
}

.actions a {
    margin-right: 10px;
    color: var(--primary);
    font-weight: 600;
}

.button-danger {
    background: var(--danger);
    padding: 7px 11px;
    margin: 0;
}

.button-danger:hover {
    background: #8f1d14;
}

.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 30px;
    border: 1px solid #d6dee8;
    font-size: .82rem;
    font-weight: 650;
}

.status.vacant {
    color: #18794e;
    background: #effaf3;
    border-color: #b9e3c8;
}

.status.occupied {
    color: #96520c;
    background: #fff7e9;
    border-color: #f1d3a4;
}

.page-heading .button-link {
    white-space: nowrap;
}

.form-hint {
    color: var(--muted);
    font-size: .9rem;
    margin: 9px 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-grid > div {
    min-width: 0;
}

@media (max-width: 760px) {
    .site-header {
        position: relative;
        align-items: flex-start;
        gap: 12px;
    }

    .site-header nav {
        width: 100%;
        gap: 5px;
    }

    .container {
        margin: 24px auto;
    }

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

    .panel {
        padding: 19px;
    }
}

@media (max-width: 480px) {
    .container {
        width: calc(100% - 24px);
        margin: 18px auto;
    }

    .site-header {
        padding: 13px 12px;
    }

    .site-header nav a,
    .link-button {
        font-size: .85rem;
        padding: 7px;
    }

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

    .stat {
        padding: 15px;
    }

    .stat strong {
        font-size: 1.45rem;
    }

    .panel {
        padding: 16px;
    }

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

/* SIMPLE PROFESSIONAL LOGIN DESIGN */

.login-simple {
    max-width: 460px;
    margin: 65px auto;
}

.login-simple-card {
    background: #ffffff;
    padding: 38px;
    border: 1px solid #dce5ef;
    border-top: 5px solid #0d9488;
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(23, 59, 99, 0.12);
}

.login-logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #173b63;
    color: white;
    border-radius: 10px;
    font-weight: 800;
    margin-bottom: 20px;
}

.login-simple-card h1 {
    color: #173b63;
    font-size: 28px;
    margin-bottom: 6px;
}

.login-subtitle {
    color: #718096;
    margin-bottom: 25px;
}

.login-simple-card form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.login-simple-card label {
    color: #26384d;
    margin: 12px 0 0;
}

.login-simple-card input {
    width: 100%;
    min-height: 47px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.login-simple-card input:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.login-simple-card .login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
    background: #173b63;
    border-radius: 8px;
}

.login-simple-card .login-submit:hover {
    background: #0d9488;
}

@media(max-width: 520px) {
    .login-simple-card {
        padding: 25px;
    }
}


/* =========================================
   SHARED DASHBOARD SIDEBAR LAYOUT
========================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.app-sidebar {
    width: 255px;
    min-width: 255px;
    background: #102c4a;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: width .25s ease, min-width .25s ease,
                transform .25s ease;
    overflow: hidden;
    z-index: 1000;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 23px 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-brand-mark {
    width: 37px;
    height: 37px;
    min-width: 37px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
}

.sidebar-section-label {
    padding: 17px 20px 9px;
    color: #9db1c7;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    white-space: nowrap;
}

.sidebar-navigation {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    gap: 5px;
}

.sidebar-link {
    display: block;
    padding: 12px 14px;
    border-radius: 7px;
    color: #d7e2ef;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease;
}

.sidebar-link:hover {
    background: rgba(255,255,255,.09);
    color: #ffffff;
}

.sidebar-link.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 20px;
    color: #9db1c7;
    font-size: 10px;
    line-height: 1.5;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    min-height: 72px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 25px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.sidebar-toggle {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 23px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 7px;
}

.sidebar-toggle:hover {
    background: #eef3f8;
}

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}

.topbar-account {
    margin-left: auto;
}

.profile-dropdown {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    padding: 7px 10px;
    border-radius: 8px;
}

.profile-trigger::-webkit-details-marker {
    display: none;
}

.profile-trigger:hover {
    background: #f3f6fa;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.profile-trigger-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.profile-trigger-info strong {
    font-size: 12px;
    color: var(--primary);
}

.profile-trigger-info small {
    font-size: 10px;
    color: #718096;
    text-transform: capitalize;
}

.profile-chevron {
    color: #64748b;
    font-size: 13px;
}

.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    width: 220px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    padding: 8px;
    z-index: 1200;
}

.profile-menu-heading {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    border-bottom: 1px solid #edf0f4;
    margin-bottom: 5px;
}

.profile-menu-heading strong {
    color: var(--primary);
    font-size: 13px;
}

.profile-menu-heading small {
    color: #718096;
    font-size: 11px;
    text-transform: capitalize;
}

.profile-menu > a,
.profile-logout-form button {
    display: block;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    text-align: left;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
}

.profile-menu > a:hover,
.profile-logout-form button:hover {
    background: #f1f5f9;
}

.profile-logout-form button {
    color: #c0392b;
}

.app-content {
    flex: 1;
    padding: 25px;
    min-width: 0;
}

/* Completely hide sidebar when collapsed on desktop */

.app-shell.sidebar-collapsed .app-sidebar {
    width: 0;
    min-width: 0;
}

/* Keep existing page containers responsive */

.app-content .container {
    width: 100%;
}

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

@media (max-width: 760px) {

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 270px;
        min-width: 270px;
        min-height: 100%;
        transform: translateX(-100%);
        box-shadow: 8px 0 25px rgba(0,0,0,.15);
    }

    .app-shell.mobile-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell.sidebar-collapsed .app-sidebar {
        width: 270px;
        min-width: 270px;
    }

    .app-topbar {
        min-height: 62px;
        padding: 0 12px;
        gap: 10px;
    }

    .topbar-title {
        font-size: 14px;
    }

    .app-content {
        padding: 15px;
    }

    .profile-trigger-info {
        display: none;
    }

    .profile-trigger {
        gap: 5px;
        padding: 5px;
    }

    .profile-avatar {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 420px) {

    .app-content {
        padding: 10px;
    }

    .app-topbar {
        padding: 0 8px;
    }

    .topbar-title {
        font-size: 12px;
    }
}

/* Reliable desktop sidebar collapse */
.app-shell.sidebar-collapsed .app-sidebar {
    display: none !important;
}

/* Mobile sidebar open and close */
@media (max-width: 760px) {
    .app-sidebar {
        display: flex;
        transform: translateX(-100%);
    }

    .app-shell.mobile-sidebar-open .app-sidebar {
        display: flex !important;
        transform: translateX(0);
    }
}
