@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --page: #f4f7f5;
    --surface: #ffffff;
    --surface-soft: #f7faf8;
    --ink: #17221d;
    --muted: #68736d;
    --line: #dde5e0;
    --line-strong: #cbd6d0;
    --primary: #176b52;
    --primary-dark: #105440;
    --primary-soft: #e9f4ef;
    --danger: #b33a45;
    --danger-soft: #fff0f1;
    --success: #176b52;
    --success-soft: #edf8f3;
    --shadow: 0 24px 70px rgba(24, 45, 36, 0.1);
    --radius-lg: 28px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font: 'Vazirmatn', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    color-scheme: light;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.75;
    text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { border: 0; }

.guest-body {
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    background:
        linear-gradient(rgba(23, 107, 82, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 107, 82, 0.035) 1px, transparent 1px),
        var(--page);
    background-size: 34px 34px;
}

.ambient {
    position: fixed;
    z-index: -1;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

.ambient-one {
    top: -210px;
    right: -140px;
    background: rgba(23, 107, 82, 0.1);
}

.ambient-two {
    bottom: -250px;
    left: -150px;
    background: rgba(196, 155, 89, 0.1);
}

.auth-shell {
    width: min(100% - 32px, 460px);
    min-height: 100vh;
    min-height: 100svh;
    margin-inline: auto;
    padding: max(32px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

.brand-centered { margin: 0 auto 24px; }

.brand-mark {
    width: 39px;
    height: 39px;
    border-radius: 13px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: var(--ink);
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 9px 20px rgba(23, 34, 29, 0.16);
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-card {
    padding: 36px;
    border: 1px solid rgba(221, 229, 224, 0.9);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    animation: card-in 420ms ease-out both;
    backdrop-filter: blur(12px);
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-heading { margin-bottom: 28px; }

.eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.auth-heading h1,
.dashboard-hero h1 {
    margin: 0;
    font-size: clamp(27px, 6vw, 34px);
    line-height: 1.45;
    letter-spacing: -0.035em;
}

.auth-heading p,
.dashboard-hero p {
    margin: 9px 0 0;
    color: var(--muted);
    line-height: 1.9;
}

.masked-mobile {
    display: inline-block;
    margin-inline: 3px;
    color: var(--ink);
    font-weight: 800;
    direction: ltr;
}

.alert {
    min-height: 48px;
    margin: -8px 0 22px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.8;
}

.alert-success {
    color: var(--success);
    border-color: #cfe9dc;
    background: var(--success-soft);
}

.alert-error {
    color: var(--danger);
    border-color: #f2cfd3;
    background: var(--danger-soft);
}

.alert-icon {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    border: 1px solid currentColor;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.auth-form { display: grid; gap: 23px; }
.field-group { display: grid; gap: 9px; }
.field-group label { font-size: 13px; font-weight: 800; }

.phone-control {
    min-height: 58px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.phone-control:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(23, 107, 82, 0.1);
}

.phone-control.is-invalid { border-color: var(--danger); }

.phone-prefix {
    height: 28px;
    padding-inline: 9px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.phone-control input {
    width: 100%;
    height: 56px;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-family: var(--font);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.035em;
}

.phone-control input::placeholder { color: #a5afa9; font-weight: 400; }

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.field-hint-centered { margin-top: 12px; text-align: center; }

.button {
    width: 100%;
    min-height: 56px;
    padding: 0 20px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 140ms ease, background 160ms ease, box-shadow 160ms ease;
}

.button-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 12px 24px rgba(23, 107, 82, 0.2);
}

.button-primary:hover { background: var(--primary-dark); }
.button-primary:active { transform: translateY(1px); }

.button:focus-visible,
.text-button:focus-visible,
.text-link:focus-visible,
.logout-button:focus-visible,
.brand:focus-visible {
    outline: 3px solid rgba(23, 107, 82, 0.24);
    outline-offset: 3px;
}

.button:disabled { cursor: wait; opacity: 0.7; box-shadow: none; }

.button-arrow {
    font-size: 20px;
    line-height: 1;
    transition: transform 160ms ease;
}

.button:hover .button-arrow { transform: translateX(-3px); }

.privacy-note {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.privacy-note p { margin: 0; }

.privacy-icon {
    width: 17px;
    margin-top: 4px;
    flex: 0 0 17px;
    color: var(--primary);
    font-size: 16px;
    line-height: 1;
}

.auth-footer {
    margin: 20px auto 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    background: #32a47a;
    box-shadow: 0 0 0 4px rgba(50, 164, 122, 0.11);
}

.otp-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.otp-inputs {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: clamp(5px, 1.7vw, 9px);
}

.otp-inputs input {
    width: clamp(39px, 10vw, 52px);
    height: clamp(51px, 13vw, 62px);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    outline: 0;
    color: var(--ink);
    background: var(--surface);
    font-family: var(--font);
    font-size: clamp(21px, 5vw, 26px);
    font-weight: 800;
    text-align: center;
    caret-color: var(--primary);
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.otp-inputs input:hover { border-color: #aebdb5; }

.otp-inputs input:focus {
    z-index: 1;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(23, 107, 82, 0.11);
    transform: translateY(-2px);
}

.otp-inputs input[aria-invalid="true"] { border-color: var(--danger); }

.otp-actions {
    min-height: 28px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    font-size: 12px;
}

.otp-actions form { margin: 0; }

.text-button,
.text-link {
    padding: 5px 0;
    color: var(--primary);
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.text-button:disabled { color: var(--muted); cursor: default; }

.action-divider { width: 1px; height: 14px; background: var(--line-strong); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-body {
    min-height: 100vh;
    min-height: 100svh;
    background: #f7f9f8;
}

.container { width: min(100% - 40px, 1080px); margin-inline: auto; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.account-menu { display: flex; align-items: center; gap: 17px; }
.account-copy { display: grid; text-align: left; }
.account-copy strong { font-size: 13px; }
.account-copy span { color: var(--muted); font-size: 10px; }

.logout-button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--muted);
    background: var(--surface);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.logout-button:hover {
    color: var(--danger);
    border-color: #efc8cc;
    background: var(--danger-soft);
}

.page-content { padding-top: 68px; padding-bottom: 60px; }

.dashboard-hero {
    padding-bottom: 30px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.private-badge {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #d3e7dd;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-card {
    min-height: 210px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 22px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    background: var(--surface);
    box-shadow: 0 10px 34px rgba(28, 46, 38, 0.045);
}

.dashboard-card-primary { border-color: #d6e9df; }

.card-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--primary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 800;
}

.card-icon-soft {
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 18px;
}

.card-label {
    display: block;
    margin: 1px 0 5px;
    color: var(--muted);
    font-size: 11px;
}

.card-value {
    display: block;
    color: var(--ink);
    font-family: var(--font);
    font-size: 19px;
    font-weight: 800;
    direction: ltr;
}

.dashboard-card p {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
}

@media (max-width: 700px) {
    .page-content { padding-top: 42px; }
    .dashboard-hero { align-items: flex-start; flex-direction: column; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .account-copy { display: none; }
}

@media (max-width: 480px) {
    .auth-shell {
        width: min(100% - 24px, 440px);
        padding-top: max(20px, env(safe-area-inset-top));
    }

    .brand-centered { margin-bottom: 18px; }

    .auth-card {
        padding: 27px 20px 24px;
        border-radius: 22px;
    }

    .auth-heading { margin-bottom: 24px; }
    .auth-heading h1 { font-size: 26px; }
    .otp-inputs { gap: 5px; }

    .otp-inputs input {
        width: min(12.4vw, 48px);
        min-width: 37px;
        height: 54px;
        border-radius: 12px;
    }

    .container { width: min(100% - 28px, 1080px); }
    .topbar-inner { min-height: 68px; }

    .dashboard-card {
        min-height: auto;
        padding: 21px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
