:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-soft: #f1f3f8;
    --line: #d9dde7;
    --text: #141828;
    --text-soft: #5a6174;
    --accent: #0f3dff;
    --accent-soft: #eaf0ff;
    --danger: #c23838;
    --sidebar-active: #e8f0fe;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html.dark {
    color-scheme: dark;
    --bg: #0f1320;
    --surface: #151b2d;
    --surface-soft: #202842;
    --line: #2b3554;
    --text: #edf1ff;
    --text-soft: #9eabc9;
    --accent: #7b9bff;
    --accent-soft: #1f2d57;
    --danger: #ff8e8e;
    --sidebar-active: #243045;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }
.id-page {
    min-height: 100vh;
}
.topbar {
    min-height: 66px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.icon-btn {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.avatar-chip {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    border: 1px solid var(--line);
}
.avatar-btn { cursor: pointer; }
.topbar-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(320px, 92vw);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(10, 15, 29, .2);
    padding: 12px;
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 60;
}
.topbar-popover.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.popover-title {
    margin: 0 0 10px;
    font-size: .86rem;
    color: var(--text-soft);
}
.apps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.apps-grid a {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 8px;
    display: grid;
    justify-items: center;
    gap: 5px;
    font-size: .78rem;
    color: var(--text-soft);
    background: var(--surface-soft);
}
.apps-grid a:hover { color: var(--text); }
.account-popover { width: min(360px, 92vw); }
.account-email { margin: 0 0 10px; font-size: .85rem; color: var(--text-soft); }
.account-main { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.account-avatar { width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.account-actions { display: flex; gap: 8px; align-items: center; }
.account-actions form { margin: 0; }
.btn.tiny { padding: 6px 10px; font-size: .78rem; }
.id-dashboard {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 66px);
}
.id-sidebar {
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    padding: 14px;
    display: grid;
    gap: 8px;
    align-content: start;
}
.id-sidebar a {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-soft);
}
.id-sidebar a.active,
.id-sidebar a:hover {
    color: var(--text);
    background: var(--surface-soft);
}
.id-center {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 10px;
    padding: 36px 16px;
}
.profile-avatar {
    width: 82px;
    height: 82px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.6rem;
}
.id-search {
    width: min(580px, 100%);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}
.id-search input {
    border: 0;
    background: transparent;
    color: var(--text);
    width: 100%;
    padding: 0;
}
.id-search input:focus { outline: none; }
.id-chips {
    width: min(580px, 100%);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}
.id-chips a {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--surface-soft);
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
}

.navbar {
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px);
}

.navbar .container {
    min-height: 72px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    letter-spacing: -0.04em;
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ghost-btn, .theme-toggle {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 999px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: .95rem;
}

.theme-toggle {
    width: 38px;
    height: 38px;
    padding: 0;
}

.auth-wrap {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 30px 0;
}

.auth-card {
    width: min(640px, 100%);
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 24px;
    box-shadow: 0 14px 35px rgba(17, 28, 61, .12);
    padding: 28px;
    min-height: 560px;
    display: flex;
    flex-direction: column;
}

.steps {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 0 0 20px;
}

.step-dot {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-soft);
}

.step-dot.active { background: var(--accent); }

.eyebrow {
    color: var(--text-soft);
    margin: 0 0 8px;
}

h1 {
    margin: 0 0 16px;
    font-size: clamp(1.8rem, 4vw, 2.3rem);
    letter-spacing: -.03em;
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.flow-step {
    min-height: 290px;
}

.field.inline-2 {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

label {
    font-size: .9rem;
    color: var(--text-soft);
}

input, select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-right: 46px;
}

.input-icon-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-soft);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

.input-icon-btn:hover {
    background: var(--surface-soft);
}

input:focus, select:focus {
    border-color: var(--accent);
    outline: none;
}

.switch-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.switch-btn {
    flex: 1;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
}

.switch-btn.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
}

.btn {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 18px;
    cursor: pointer;
}

.btn.primary {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
}

.hint {
    color: var(--text-soft);
    margin-top: 8px;
}

.password-meter {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.meter-segment {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-soft);
    transition: background-color .2s ease;
}

.meter-segment.active {
    background: var(--accent);
}

.field-message {
    min-height: 20px;
    margin: 0;
    font-size: .9rem;
    color: var(--text-soft);
}

.field-message.is-weak,
.field-message.is-error {
    color: var(--danger);
}

.field-message.is-medium {
    color: #b08a00;
}

.field-message.is-good {
    color: #2d8f4d;
}

.field-message.is-strong,
.field-message.is-ok {
    color: #2d8f4d;
}

.error-list {
    border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.footer-links {
    margin-top: auto;
    padding: 20px 0 26px;
    color: var(--text-soft);
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.success {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 24px;
    padding: 28px;
}

@media (max-width: 700px) {
    .auth-card { padding: 20px; border-radius: 20px; }
    .field.inline-2 { grid-template-columns: 1fr; }
}

/* —— App shell (aligned with file.unlias.com) —— */
.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;
}
.muted { color: var(--text-soft); }
.page { min-height: 100vh; padding: 0; }
.app-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-shadow: var(--shadow-sm);
    z-index: 40;
}
.sidebar-head {
    min-height: 72px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.03em;
    color: var(--text);
}
.sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--text);
    color: var(--surface);
    display: grid;
    place-items: center;
    font-size: 1rem;
}
html.dark .sidebar-brand-mark {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--line);
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    flex: 1;
    overflow: auto;
}
.sidebar-foot {
    padding: 12px 12px 20px;
    border-top: 1px solid var(--line);
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.92rem;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    position: relative;
}
.sidebar-link i {
    width: 22px;
    text-align: center;
    opacity: 0.9;
}
.sidebar-link:hover {
    background: var(--surface-soft);
    color: var(--text);
}
.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--accent);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--accent);
}
.main-area {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.main-area .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 72px;
    background: rgba(255, 255, 255);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    flex-wrap: wrap;
}
html.dark .main-area .topbar {
    background: rgba(15, 20, 25, 0.85);
}
.topbar-sidebar-toggle {
    display: none;
}
.topbar-search-wrap {
    flex: 1;
    min-width: 160px;
    max-width: 420px;
    position: relative;
}
.topbar-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
    font-size: 0.9rem;
    pointer-events: none;
}
.topbar-search {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    padding: 11px 16px 11px 40px;
    font-size: 0.92rem;
    box-shadow: var(--shadow-sm);
}
.topbar-search::placeholder {
    color: var(--text-soft);
}
.burger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 18px;
}
.burger-icon-line {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}
.main-area .topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    margin-left: auto;
}
.main-area .icon-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.main-area .icon-btn:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.main-area .icon-btn.subtle {
    background: var(--surface-soft);
}
.main-area .avatar-chip {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm);
}
.main-area .topbar-popover {
    top: calc(100% + 10px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 14px;
}
.main-area .apps-grid a {
    border-radius: var(--radius-sm);
}
.board {
    flex: 1;
    padding: 28px 24px 40px;
    width: 100%;
    margin: 0 auto;
}
.account-actions {
    flex-wrap: wrap;
    align-items: center;
}
.account-logout-form {
    margin: 0;
    display: inline;
}
.id-profile-page {
    max-width: 720px;
    margin: 0 auto;
}
.id-profile-page--sheet {
    max-width: min(720px, 100%);
}
.id-profile-sheet {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}
.id-profile-sheet--flush {
    margin-bottom: 20px;
}
html.dark .id-profile-sheet {
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
}
.id-profile-row {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    align-items: start;
}
.id-profile-row:last-of-type {
    border-bottom: none;
}
.id-profile-row--avatar {
    grid-template-columns: 44px 1fr auto;
    align-items: center;
}
.id-profile-row-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-size: 1.05rem;
}
.id-profile-row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.id-profile-row-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 600px) {
    .id-profile-row-grid2 {
        grid-template-columns: 1fr;
    }
    .id-profile-row--avatar {
        grid-template-columns: 44px 1fr;
    }
    .id-profile-row-aside {
        grid-column: 2 / -1;
        justify-self: end;
    }
}
.id-profile-row-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.id-profile-row-hint {
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.4;
}
.id-profile-row-static {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.45;
}
.id-profile-row-input,
.id-profile-row-select,
.id-profile-row-textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface-soft);
    color: var(--text);
}
.id-profile-row-input:focus,
.id-profile-row-select:focus,
.id-profile-row-textarea:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.id-profile-row-textarea {
    resize: vertical;
    min-height: 52px;
}
.id-profile-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    border: 2px solid var(--line);
}
.id-profile-sheet-actions {
    padding: 18px 20px 22px;
    background: var(--surface-soft);
    border-top: 1px solid var(--line);
}
.id-profile-security {
    margin-top: 8px;
}
.id-profile-security-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 800;
}
.id-profile-password-form {
    margin-top: 16px;
    padding: 22px;
    border-radius: 16px;
}
.id-profile-page-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}
.id-profile-lead {
    margin: 0 0 20px;
}
.profile-flash-ok {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.id-profile-form {
    margin-top: 8px;
}
.id-profile-form.auth-card {
    min-height: unset;
    padding: 24px 26px;
}
.id-profile-actions {
    margin-top: 8px;
}
.id-page .topbar {
    justify-content: space-between;
}
.id-page .topbar-left {
    flex: 1;
    min-width: 0;
}
.id-page .topbar-left .brand {
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(280px, 88vw);
        transform: translateX(-102%);
        transition: transform 0.28s ease;
        box-shadow: var(--shadow-lg);
    }
    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .topbar-sidebar-toggle {
        display: grid;
    }
    .main-area .topbar {
        padding: 10px 14px;
    }
    .topbar-search-wrap {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
    }
    .main-area .topbar-actions {
        order: 2;
        margin-left: auto;
    }
    .board {
        padding: 18px 14px 32px;
    }
}
