/*
From Uiverse.io by Amine-maker - https://uiverse.io/Amine-maker/ordinary-wombat-53
MIT License, Copyright (c) Amine-maker (amine djennadi)
*/

:root {
    color-scheme: light;
    --background: #ffffff;
    --surface: #ffffff;
    --surface-soft: #f4f7ff;
    --field: rgba(53, 16, 106, 0.07);
    --violet: #35106a;
    --violet-soft: rgba(53, 16, 106, 0.12);
    --ink: #182033;
    --muted: #62708c;
    --border: #d8e1f5;
    --error: #c62828;
    --shadow: 0 24px 70px rgba(25, 54, 120, 0.14);
    --radius: 4px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --background: #0d1424;
    --surface: #151f35;
    --surface-soft: #1c2944;
    --field: rgba(169, 135, 240, 0.12);
    --violet: #a987f0;
    --violet-soft: rgba(169, 135, 240, 0.16);
    --ink: #f5f7ff;
    --muted: #aeb9d2;
    --border: #2c3c5d;
    --error: #ff6b6b;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: background-color 180ms ease, color 180ms ease;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 1.04fr) minmax(390px, 0.96fr);
}

.login-intro {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(32px, 5vw, 72px);
    background:
        radial-gradient(circle at 82% 18%, var(--violet-soft) 0 12%, transparent 38%),
        linear-gradient(145deg, var(--surface-soft), var(--background));
    border-right: 1px solid var(--border);
}

.login-intro::after {
    content: "";
    position: absolute;
    width: min(42vw, 560px);
    aspect-ratio: 1;
    right: min(-18vw, -160px);
    bottom: min(-20vw, -180px);
    border: clamp(40px, 7vw, 88px) solid var(--violet-soft);
    border-radius: 50%;
}

.brand,
.intro-copy {
    position: relative;
    z-index: 1;
}

.brand {
    display: flex;
    align-items: center;
    width: fit-content;
    max-width: min(100%, 440px);
}

.brand img {
    display: block;
    width: 100%;
    height: auto;
}

html[data-theme="dark"] .brand img {
    filter: brightness(0) invert(1);
}

.intro-copy p,
.intro-copy h2,
.login-card h2,
.login-card p,
.app-dialog h2,
.app-dialog p {
    margin: 0;
}

.section-kicker,
.intro-kicker {
    color: var(--violet);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.intro-copy {
    max-width: 680px;
    margin: auto 0;
    padding: 80px 0;
}

.intro-copy h2 {
    max-width: 680px;
    margin: 12px 0 18px;
    font-size: clamp(2.6rem, 5vw, 5.2rem);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.intro-copy > p:last-child {
    max-width: 540px;
    color: var(--muted);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    line-height: 1.7;
}

.login-panel {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: clamp(30px, 7vw, 96px);
    background: var(--surface);
}

.theme-toggle {
    position: absolute;
    top: 26px;
    right: 26px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--violet);
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.theme-toggle:hover {
    transform: translateY(-1px) rotate(7deg);
    border-color: var(--violet);
}

.theme-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: opacity 150ms ease, transform 180ms ease;
}

.theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: scale(0.55) rotate(-30deg);
}

html[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.login-card {
    width: min(100%, 440px);
}

.login-card header {
    margin-bottom: 38px;
}

.login-card h2 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 4vw, 2.85rem);
    letter-spacing: -0.045em;
}

.login-card h2 > span {
    display: block;
}

.login-brand-name {
    white-space: nowrap;
}

.login-card header > p:last-child {
    color: var(--muted);
    line-height: 1.6;
}

#login-form {
    display: grid;
    gap: 24px;
}

.maynor-field {
    position: relative;
}

.maynor-field input {
    width: 100%;
    height: 52px;
    padding: 16px 46px 10px 15px;
    border: 1px solid color-mix(in srgb, var(--violet) 70%, transparent);
    border-radius: var(--radius);
    outline: none;
    background: var(--field);
    color: var(--ink);
    font-size: 1rem;
    transition: border-color 100ms ease-in-out, box-shadow 160ms ease, background-color 180ms ease;
}

.maynor-field label {
    position: absolute;
    top: 50%;
    left: 15px;
    padding: 0 5px;
    background: transparent;
    color: var(--violet);
    pointer-events: none;
    transform: translateY(-50%) scale(0.96);
    transform-origin: left center;
    transition: all 100ms ease-in-out, background-color 0ms;
}

.maynor-field input:focus,
.maynor-field input:not(:placeholder-shown) {
    padding-top: 18px;
}

.maynor-field input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 1px var(--violet);
}

.maynor-field input:focus ~ label,
.maynor-field input:not(:placeholder-shown) ~ label {
    top: 0;
    left: 10px;
    background: var(--surface);
    color: var(--violet);
    transform: translateY(-50%) scale(0.82);
}

.maynor-field.has-error input {
    border-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

.maynor-field.has-error label,
.maynor-field.has-error input:focus ~ label,
.maynor-field.has-error input:not(:placeholder-shown) ~ label {
    top: 0;
    left: 10px;
    background: var(--surface);
    color: var(--error);
    transform: translateY(-50%) scale(0.82);
}

.field-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.password-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--violet);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.form-actions {
    display: grid;
    gap: 15px;
    margin-top: 4px;
}

.primary-button {
    min-height: 48px;
    padding: 11px 20px;
    border: 1px solid color-mix(in srgb, var(--violet) 48%, transparent);
    border-radius: var(--radius);
    background: var(--violet-soft);
    color: var(--violet);
    font-weight: 750;
    transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--violet) 20%, transparent);
    background: color-mix(in srgb, var(--violet) 20%, transparent);
}

.primary-button:active {
    transform: translateY(0);
}

.recovery-link {
    justify-self: center;
    padding: 5px;
    border: 0;
    background: transparent;
    color: var(--violet);
    font-weight: 650;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
}

.recovery-link:hover {
    text-decoration-color: currentColor;
}

.theme-toggle:focus-visible,
.primary-button:focus-visible,
.recovery-link:focus-visible,
.password-toggle:focus-visible {
    outline: 3px solid var(--violet);
    outline-offset: 3px;
}

.app-dialog {
    width: min(calc(100% - 32px), 460px);
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.app-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.dialog-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 18px;
    border-radius: 50%;
    background: var(--violet-soft);
    color: var(--violet);
    font-size: 1.25rem;
    font-weight: 800;
}

.app-dialog h2 {
    font-size: 1.45rem;
}

.app-dialog p {
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.6;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.dialog-actions .primary-button {
    min-width: 130px;
}

.setup-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 88px 24px 48px;
    background:
        radial-gradient(circle at 10% 10%, var(--violet-soft), transparent 30%),
        radial-gradient(circle at 90% 90%, var(--violet-soft), transparent 28%),
        var(--background);
}

.setup-card {
    width: min(100%, 520px);
    padding: clamp(26px, 5vw, 46px);
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow);
}

.setup-logo {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 0 0 32px;
}

html[data-theme="dark"] .setup-logo,
html[data-theme="dark"] .sidebar-brand img {
    filter: brightness(0) invert(1);
}

.setup-card h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1;
    letter-spacing: -0.045em;
}

.setup-description {
    margin: 0 0 30px;
    color: var(--muted);
    line-height: 1.6;
}

.setup-card form {
    display: grid;
    gap: 22px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    background: var(--background);
}

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 100vh;
    padding: 25px 18px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar-brand {
    display: block;
    padding: 4px 8px 28px;
}

.sidebar-brand img {
    display: block;
    width: 100%;
    height: auto;
}

.app-navigation {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 650;
    text-decoration: none;
    transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.nav-link > span:first-child {
    display: grid;
    place-items: center;
    width: 24px;
    color: var(--violet);
    font-size: 1.25rem;
}

.nav-link:hover,
.nav-link.active {
    border-color: color-mix(in srgb, var(--violet) 20%, transparent);
    background: var(--violet-soft);
    color: var(--violet);
}

.app-main {
    min-width: 0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 76px;
    padding: 12px clamp(20px, 4vw, 52px);
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-user > div {
    display: grid;
    text-align: right;
}

.topbar-user strong {
    font-size: 0.94rem;
}

.topbar-user span {
    color: var(--muted);
    font-size: 0.76rem;
}

.dashboard-theme-toggle {
    position: relative;
    inset: auto;
    flex: 0 0 42px;
}

.logout-button {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid color-mix(in srgb, var(--violet) 30%, transparent);
    border-radius: var(--radius);
    background: transparent;
    color: var(--violet);
    font-weight: 700;
}

.logout-button:hover {
    background: var(--violet-soft);
}

.mobile-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--violet);
    font-size: 1.3rem;
}

.dashboard-content {
    width: min(100%, 1440px);
    margin: 0 auto;
    padding: clamp(24px, 4vw, 52px);
}

.dashboard-welcome {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 230px;
    padding: clamp(28px, 5vw, 58px);
    border: 1px solid color-mix(in srgb, var(--violet) 20%, transparent);
    border-radius: 18px;
    background:
        radial-gradient(circle at 90% 20%, var(--violet-soft), transparent 35%),
        var(--surface-soft);
}

.dashboard-welcome h1 {
    max-width: 740px;
    margin: 9px 0 13px;
    font-size: clamp(2.15rem, 5vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.055em;
}

.dashboard-welcome p:last-child {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    font-size: 1.04rem;
    line-height: 1.6;
}

.welcome-mark {
    flex: 0 0 auto;
    margin-left: 30px;
    color: var(--violet);
    font-size: clamp(4rem, 10vw, 9rem);
    font-weight: 850;
    letter-spacing: -0.09em;
    opacity: 0.12;
    transform: rotate(-6deg);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.dashboard-card {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 126px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.card-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 12px;
    background: var(--violet-soft);
    color: var(--violet);
    font-size: 1.5rem;
}

.dashboard-card div {
    display: grid;
    gap: 2px;
}

.dashboard-card strong {
    font-size: 1.7rem;
}

.dashboard-card div span {
    color: var(--muted);
    font-size: 0.88rem;
}

.quick-actions {
    margin-top: 24px;
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.quick-actions header h2 {
    margin: 7px 0 24px;
    font-size: 1.65rem;
}

.quick-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-actions-grid button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--muted);
}

.quick-actions-grid button:disabled {
    cursor: not-allowed;
    opacity: 0.66;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 820px) {
    .login-page {
        grid-template-columns: 1fr;
    }

    .login-intro {
        min-height: auto;
        padding: 24px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .intro-copy {
        display: none;
    }

    .login-panel {
        min-height: calc(100vh - 99px);
        padding: 88px 24px 44px;
    }

    .app-shell {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        width: min(82vw, 280px);
        transform: translateX(-105%);
        transition: transform 180ms ease;
        box-shadow: var(--shadow);
    }

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

    .app-topbar {
        justify-content: space-between;
        padding: 10px 18px;
    }

    .mobile-menu-toggle {
        display: grid;
        place-items: center;
    }

    .topbar-user > div {
        display: none;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 25;
        border: 0;
        background: rgba(0, 0, 0, 0.58);
    }

    .app-shell.menu-open .sidebar-backdrop {
        display: block;
    }

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

@media (max-width: 440px) {
    .brand {
        max-width: 310px;
    }

    .theme-toggle {
        top: 22px;
        right: 22px;
    }

    .dashboard-theme-toggle {
        inset: auto;
    }

    .topbar-user {
        gap: 8px;
    }

    .logout-button {
        padding-inline: 10px;
    }

    .dashboard-content {
        padding: 18px;
    }

    .dashboard-welcome {
        min-height: 250px;
        padding: 26px 22px;
    }

    .welcome-mark {
        position: absolute;
        right: 18px;
        bottom: -12px;
        margin: 0;
        font-size: 6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
