* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
    color: #1f2933;
    background: #f6f1e8;
}

.auth-shell {
    background: radial-gradient(circle at 14% 18%, rgba(36, 111, 118, 0.16), transparent 28rem),
        linear-gradient(135deg, #f7efe1 0%, #eef4f2 48%, #fffaf2 100%);
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 460px);
    height: 100vh;
    overflow: hidden;
}

.auth-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 32px 48px;
    background: linear-gradient(140deg, rgba(23, 45, 54, 0.95), rgba(37, 82, 87, 0.88)), #1f3f45;
    color: #fff8ea;
}

.auth-visual::after {
    content: "";
    position: absolute;
    inset: auto -8% -18% 10%;
    height: 42%;
    border-radius: 999px 999px 0 0;
    background: rgba(210, 166, 91, 0.2);
}

.brand-lockup {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-mark {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 8px;
    background: #d8a95f;
    color: #172d36;
    font-weight: 800;
}

.brand-lockup p,
.eyebrow {
    margin: 0;
    color: #c98743;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand-lockup strong {
    display: block;
    margin-top: 4px;
    font-size: 1.05rem;
}

.lobby-illustration {
    position: relative;
    z-index: 1;
    width: min(500px, 82%);
    aspect-ratio: 1.18;
    margin: 20px auto 14px;
}

.window {
    position: absolute;
    inset: 0 12% 24% 10%;
    border: 12px solid rgba(255, 248, 234, 0.2);
    border-radius: 10px 10px 28px 28px;
    background: linear-gradient(90deg, transparent 48%, rgba(255, 248, 234, 0.18) 49% 51%, transparent 52%),
        linear-gradient(#315d62, #18343a);
}

.counter {
    position: absolute;
    right: 2%;
    bottom: 11%;
    left: 0;
    height: 34%;
    border-radius: 12px 12px 8px 8px;
    background: linear-gradient(180deg, #e8c17a, #9d6842);
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.22);
}

.counter span {
    position: absolute;
    top: 22%;
    width: 22%;
    height: 10px;
    border-radius: 999px;
    background: rgba(71, 45, 31, 0.28);
}

.counter span:nth-child(1) {
    left: 10%;
}

.counter span:nth-child(2) {
    left: 39%;
}

.counter span:nth-child(3) {
    right: 10%;
}

.key-card,
.ledger,
.bell {
    position: absolute;
    z-index: 2;
    border-radius: 8px;
}

.key-card {
    right: 16%;
    bottom: 36%;
    width: 25%;
    height: 15%;
    background: linear-gradient(135deg, #f8f3df, #7fb5ad);
    transform: rotate(-7deg);
}

.ledger {
    left: 18%;
    bottom: 33%;
    width: 29%;
    height: 18%;
    background: linear-gradient(135deg, #fff7dd, #c08a53);
    transform: rotate(5deg);
}

.bell {
    right: 38%;
    bottom: 38%;
    width: 12%;
    height: 12%;
    border-radius: 50% 50% 12px 12px;
    background: #f0c66f;
}

.auth-copy {
    position: relative;
    z-index: 1;
    max-width: 540px;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.12;
}

.auth-copy p {
    margin: 0;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 48px;
    background: rgba(255, 253, 247, 0.88);
}

.form-header {
    margin-bottom: 22px;
}

.form-header h1,
.dashboard h1 {
    margin: 8px 0;
    color: #1b3439;
    font-size: 2rem;
    line-height: 1.1;
}

.form-header span,
.dashboard header span,
.placeholder-grid span {
    color: #64706d;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    color: #273b40;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d9d0c1;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fffdfa;
    color: #172d36;
    font: inherit;
}

.auth-form input:focus {
    outline: 3px solid rgba(36, 111, 118, 0.18);
    border-color: #246f76;
}

.auth-form small {
    color: #b42318;
    font-weight: 700;
}

.check-row {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 10px !important;
    font-weight: 600 !important;
}

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

button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 12px 18px;
    background: #246f76;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: #1b5960;
}

.switch-link {
    margin: 20px 0 0;
    color: #64706d;
}

.switch-link a {
    color: #246f76;
    font-weight: 800;
}

.alert {
    margin-bottom: 18px;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert.success {
    background: #e5f4ef;
    color: #116149;
}

.dashboard-shell {
    background: #f7f2e9;
}

.app-dashboard {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 0.2s ease;
}

.app-dashboard.menu-collapsed {
    grid-template-columns: 78px minmax(0, 1fr);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: 100vh;
    padding: 24px;
    background: #17383f;
    color: #fff8ea;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 232px;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    margin-top: 3px;
    color: #d8c9ad;
}

.menu-collapsed .sidebar {
    align-items: center;
    padding: 24px 12px;
}

.menu-collapsed .sidebar-brand {
    justify-content: center;
    min-width: 0;
}

.menu-collapsed .sidebar-brand div,
.menu-collapsed .sidebar-menu a .menu-text {
    display: none;
}

.sidebar-menu {
    display: grid;
    gap: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    border-radius: 8px;
    padding: 10px 12px;
    color: #ecf4f1;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-menu a svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: currentColor;
    color: #d8a95f;
}

.sidebar-menu a span {
    color: #d8a95f;
    font-size: 0.78rem;
    font-weight: 800;
    min-width: 18px;
}

.menu-collapsed .sidebar-menu a {
    justify-content: center;
    width: 48px;
    padding-right: 0;
    padding-left: 0;
}

.menu-text {
    font: inherit;
}

.sidebar-menu a.active,
.sidebar-menu a:hover {
    background: rgba(216, 169, 95, 0.16);
}

.sidebar-logout {
    margin-top: auto;
    width: 100%;
}

.sidebar-logout button {
    width: 100%;
    background: #d8a95f;
    color: #17383f;
}

.menu-collapsed .sidebar-logout button {
    width: 44px;
    padding: 0;
    font-size: 0;
}

.menu-collapsed .sidebar-logout button::after {
    content: "L";
    font-size: 1rem;
}

.dashboard-content {
    padding: 20px;
}

.dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 12px;
}

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

.menu-toggle {
    display: inline-grid;
    width: 44px;
    min-height: 44px;
    place-items: center;
    gap: 4px;
    padding: 10px;
    background: #fffdf7;
    border: 1px solid #dfd3c0;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #17383f;
}

.dashboard-topbar h1,
.module-panel h2 {
    margin: 5px 0;
    color: #1b3439;
    line-height: 1.1;
}

.dashboard-topbar h1 {
    font-size: 2rem;
}

.module-panel h2 {
    font-size: 1.45rem;
}

.dashboard-topbar span,
.metric-grid span,
.module-panel span {
    color: #64706d;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.metric-grid article,
.module-panel {
    border: 1px solid #dfd3c0;
    border-radius: 8px;
    background: #fffdf7;
}

.metric-grid article {
    display: grid;
    gap: 10px;
    min-height: 118px;
    padding: 20px;
}

.metric-grid strong {
    color: #1b3439;
    font-size: 2rem;
}

.module-panel {
    margin-top: 12px;
    padding: 20px;
}

@media (max-width: 860px) {
    .auth-page,
    .app-dashboard,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .auth-page {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .auth-visual {
        min-height: 360px;
        padding: 28px;
    }

    .auth-copy {
        font-size: 1.55rem;
    }

    .auth-panel {
        padding: 32px 22px;
    }

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

    .sidebar {
        min-height: auto;
    }

    .dashboard-content {
        padding: 18px;
    }
}

@media (min-width: 861px) and (max-height: 760px) {
    .auth-visual,
    .auth-panel {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .brand-mark {
        width: 46px;
        height: 46px;
    }

    .lobby-illustration {
        width: min(420px, 74%);
        margin: 10px auto;
    }

    .auth-copy {
        font-size: 1.45rem;
    }

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

    .form-header h1,
    .dashboard h1 {
        font-size: 1.8rem;
    }

    .auth-form {
        gap: 10px;
    }

    .auth-form input {
        min-height: 40px;
    }

    button {
        min-height: 42px;
    }

    .switch-link {
        margin-top: 14px;
    }
}

@media (max-width: 640px) {
    body {
        overflow-x: hidden;
    }

    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 280px;
        padding: 22px;
    }

    .auth-visual::after {
        height: 32%;
    }

    .brand-lockup {
        gap: 10px;
    }

    .brand-mark {
        width: 44px;
        height: 44px;
    }

    .lobby-illustration {
        width: min(320px, 86%);
        margin: 10px auto;
    }

    .auth-copy {
        max-width: 100%;
        font-size: 1.25rem;
    }

    .auth-panel {
        padding: 26px 18px 32px;
    }

    .form-header h1,
    .dashboard h1 {
        font-size: 1.55rem;
    }

    .auth-form input,
    button {
        min-height: 42px;
    }

    .dashboard-content,
    .module-panel,
    .panel-card {
        max-width: 100%;
    }
}

@media (max-width: 420px) {
    .auth-visual {
        min-height: 240px;
        padding: 18px;
    }

    .lobby-illustration {
        width: min(260px, 88%);
    }

    .auth-copy {
        font-size: 1.1rem;
    }

    .auth-panel {
        padding: 22px 14px 28px;
    }
}
