:root {
    --purple: #7413dc;
    --purple-dark: #4f0c9e;
    --purple-light: #f4edff;
    --white: #ffffff;
    --text: #222222;
    --muted: #666666;
    --border: #e5d8f7;
    --background: #f7f3fc;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
}

/* Header */

.site-header {
    background: var(--purple);
    color: var(--white);
    padding: 16px 24px;
}

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.site-title {
    font-size: 21px;
    font-weight: bold;
    line-height: 1.2;
    color: var(--white);
}

.site-subtitle {
    color: var(--white);
    font-size: 14px;
    opacity: 0.9;
    margin-top: 2px;
}

.site-user {
    font-size: 14px;
    color: var(--white);
}

/* Navigation */

.main-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.main-nav a,
.account-button {
    display: inline-block;
    color: var(--purple-dark);
    background: transparent;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 9px;
    font-weight: bold;
    font-size: 15px;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.main-nav a:hover,
.account-button:hover {
    background: var(--purple-light);
    color: var(--purple-dark);
}

/* Dropdown menus */

.account-menu {
    position: relative;
    display: inline-block;
}

.account-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    margin-top: 6px;
    min-width: 330px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}

/* Apps menu opens to the right */
#appsDropdown {
    left: 0;
    right: auto;
}

/* User menu opens to the left */
#accountDropdown {
    right: 0;
    left: auto;
    min-width: 230px;
}

.account-menu.account-menu-open .account-dropdown {
    display: block;
}

.account-dropdown-user {
    padding: 12px 14px;
    background: var(--purple-light);
    color: var(--text);
    font-weight: bold;
    border-bottom: 1px solid var(--border);
}

.account-dropdown-user span {
    color: var(--muted);
    font-weight: normal;
    font-size: 13px;
}

.account-dropdown a,
.account-dropdown span.current-app {
    display: block;
    background: var(--white);
    color: var(--text);
    padding: 12px 14px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0;
    white-space: nowrap;
}

.account-dropdown span.current-app {
    color: var(--purple);
    background: var(--purple-light);
}

.account-dropdown a:hover {
    background: var(--purple-light);
    color: var(--purple);
}

/* Layout */

.container {
    max-width: 1500px;
    margin: 28px auto;
    padding: 0 28px;
    width: 100%;
}

.card {
    background: var(--white);
    border-radius: 14px;
    padding: 26px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.card h3 {
    color: var(--purple);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-top: 24px;
}

/* Login */

.login-card {
    max-width: 720px;
    margin: 48px auto;
    padding: 44px;
    text-align: center;
}

.login-title {
    color: var(--purple);
    font-size: 46px;
    line-height: 1.1;
    margin-bottom: 24px;
}

.login-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 10px 0 28px 0;
}

.login-divider-line {
    height: 2px;
    background: var(--border);
    width: 180px;
}

.login-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    display: block;
}

.login-form {
    text-align: left;
    max-width: 520px;
    margin: 0 auto;
}

.login-form label {
    color: var(--purple-dark);
    font-weight: bold;
    font-size: 20px;
}

.login-form input {
    max-width: 100%;
    margin-top: 6px;
    margin-bottom: 18px;
    font-size: 18px;
    padding: 14px;
}

.login-form button {
    width: 100%;
    font-size: 18px;
    padding: 14px;
    margin-top: 8px;
}

/* Card grid */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--white);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    margin-top: 0;
    color: var(--purple-dark);
    border-bottom: none;
    padding-bottom: 0;
}

/* Buttons */

.button,
button,
button.button,
a.button,
.quick-button {
    display: inline-block;
    background: var(--purple);
    color: var(--white);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 9px;
    border: none;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    margin: 2px 5px 5px 0;
}

.button:hover,
button:hover,
button.button:hover,
a.button:hover,
.quick-button:hover {
    background: var(--purple-dark);
}

/* Forms */

input,
select,
textarea {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

textarea {
    min-height: 100px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--purple-light);
    border-color: var(--purple);
}

label {
    font-weight: bold;
}

.form-field-narrow {
    max-width: 500px;
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.checkbox-row input[type="checkbox"],
input[type="checkbox"] {
    width: auto;
    max-width: none;
    margin: 0;
}

.time-select-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    max-width: 500px;
}

.time-select-row select {
    width: 100%;
    max-width: none;
}

.time-colon {
    font-size: 22px;
    font-weight: bold;
    color: var(--muted);
}

/* Tables */

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

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

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

th {
    color: var(--purple-dark);
    font-weight: bold;
    background: var(--white);
}

tr:hover {
    background: var(--purple-light);
}

td a {
    color: var(--purple-dark);
    font-weight: bold;
}

/* Alert / status boxes */

.warning-box,
.notice {
    background: var(--purple-light);
    border-left: 6px solid var(--purple);
    padding: 14px 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.success-box,
.success {
    background: #e8f7ee;
    border-left: 6px solid #00a651;
    padding: 14px 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.error {
    background: #ffecec;
    border-left: 6px solid #c62828;
    padding: 14px 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.availability-available {
    border-left: 8px solid #00a651;
}

.availability-unavailable {
    border-left: 8px solid #e53935;
}

.clash-box {
    background: #f8f8f8;
    border-left: 6px solid #e53935;
    padding: 14px 16px;
    border-radius: 8px;
    margin: 12px 0;
}

/* Footer */

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--white);
    color: var(--muted);
    font-size: 13px;
}

.site-footer a {
    color: var(--purple);
    font-weight: bold;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Mobile */

@media screen and (max-width: 800px) {
    .site-header {
        padding: 14px 16px;
    }

    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .site-brand {
        gap: 12px;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
    }

    .brand-logo img {
        width: 38px;
        height: 38px;
    }

    .site-title {
        font-size: 18px;
    }

    .site-subtitle {
        font-size: 13px;
    }

    .site-user {
        width: 100%;
        font-size: 13px;
        line-height: 1.4;
    }

    .main-nav {
        padding: 10px;
        gap: 8px;
    }

    .main-nav a,
    .account-button {
        padding: 9px 10px;
        font-size: 14px;
    }

    .account-menu {
        width: 100%;
    }

    .account-button {
        width: 100%;
        text-align: left;
    }

    .account-dropdown,
    #appsDropdown,
    #accountDropdown {
        position: static;
        width: 100%;
        min-width: 100%;
        margin-top: 6px;
    }

    .container {
        padding: 14px;
        margin: 0 auto;
        max-width: 100%;
    }

    .card,
    .stat-card {
        padding: 16px;
    }

    .login-card {
        margin: 20px auto;
        padding: 24px;
    }

    .login-title {
        font-size: 32px;
    }

    .login-divider-line {
        width: 90px;
    }

    .login-logo {
        width: 46px;
        height: 46px;
    }

    .button,
    button,
    button.button,
    a.button,
    .quick-button {
        width: 100%;
        text-align: center;
        margin-right: 0;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .site-footer {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }
}