:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --ink: #171a1f;
    --muted: #737982;
    --line: #e4e7eb;
    --sidebar: #171a1e;
    --sidebar-soft: #252a30;
    --accent: #b7985f;
    --accent-dark: #987a45;
    --success: #24755a;
    --danger: #a13b45;
    --shadow: 0 20px 60px rgba(24, 28, 34, .08);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.guest-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(183, 152, 95, .12), transparent 28%),
        radial-gradient(circle at 85% 85%, rgba(63, 72, 82, .16), transparent 30%),
        #121519;
}

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
}

.login-card {
    width: min(100%, 460px);
    padding: 40px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 24px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 28px 90px rgba(0,0,0,.28);
}

.login-brand, .brand { display: flex; align-items: center; gap: 14px; }
.login-brand { margin-bottom: 44px; }
.login-brand h1 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.02em; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    color: #15181c;
    background: linear-gradient(145deg, #d3bc8c, #aa884d);
    border-radius: 11px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}
.brand-mark.large { width: 46px; height: 46px; flex-basis: 46px; border-radius: 13px; }
.eyebrow { color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.login-intro h2, .panel-heading h2 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.login-intro p, .panel-heading p { margin: 8px 0 26px; color: var(--muted); line-height: 1.6; }

.form-stack { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field span { font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); }
.field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    color: var(--ink);
    background: #fafafa;
    border: 1px solid #d9dde2;
    border-radius: 11px;
    outline: none;
    transition: .18s ease;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(183,152,95,.13); background: #fff; }
.primary-button {
    min-height: 49px;
    padding: 0 20px;
    color: #fff;
    background: #1b1f24;
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 750;
    transition: .18s ease;
}
.primary-button:hover { background: #292f36; transform: translateY(-1px); }
.link-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.security-note { margin: 25px 0 0; color: #92979e; font-size: 12px; text-align: center; }

.alert { margin-bottom: 20px; padding: 13px 15px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.alert-error { color: #82303a; background: #fff0f1; border: 1px solid #f2cbd0; }
.alert-success { color: #1d624b; background: #e9f7f1; border: 1px solid #bfe4d5; }
.debug-box { overflow: auto; padding: 14px; background: #f4f4f4; border-radius: 8px; font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 25px 18px 18px;
    color: #e8eaed;
    background: var(--sidebar);
    border-right: 1px solid rgba(255,255,255,.05);
    z-index: 30;
}
.brand { padding: 0 8px 25px; }
.brand-title { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.brand-subtitle { margin-top: 3px; color: #838a93; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.navigation { display: grid; gap: 4px; }
.nav-caption { margin: 22px 10px 7px; color: #6f767f; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    color: #afb5bd;
    border-radius: 10px;
    text-decoration: none;
    font-size: 13px;
}
.nav-link.active { color: #fff; background: var(--sidebar-soft); box-shadow: inset 3px 0 0 var(--accent); }
.nav-link.disabled { cursor: default; opacity: .67; }
.nav-link small { margin-left: auto; color: #747b84; font-size: 9px; text-transform: uppercase; }
.nav-icon { width: 20px; color: #9299a2; text-align: center; font-size: 17px; }
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 14px 8px 0;
    border-top: 1px solid rgba(255,255,255,.08);
}
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: #191c20; background: #b99b64; font-weight: 800; }
.user-meta { min-width: 0; display: grid; }
.user-meta strong, .user-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { max-width: 128px; font-size: 12px; }
.user-meta span { max-width: 128px; margin-top: 3px; color: #818892; font-size: 10px; }
.logout-button { width: 30px; height: 30px; color: #9299a2; background: transparent; border: 0; cursor: pointer; font-size: 18px; }
.logout-button:hover { color: #fff; }

.main-area { min-width: 0; }
.topbar {
    min-height: 87px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px clamp(22px, 3vw, 42px);
    background: rgba(255,255,255,.82);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.menu-button { display: none; width: 40px; height: 40px; background: #fff; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.content-area { padding: clamp(22px, 3vw, 42px); }

.welcome-panel {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(24px, 3vw, 38px);
    color: #fff;
    background: linear-gradient(125deg, #1a1e23, #2b3138);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 19px;
    box-shadow: var(--shadow);
}
.welcome-panel h2 { margin: 10px 0 8px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
.welcome-panel p { max-width: 680px; margin: 0; color: #aeb4bc; line-height: 1.65; }
.status-badge { flex: 0 0 auto; padding: 9px 12px; color: #bce8d6; background: rgba(64,157,119,.13); border: 1px solid rgba(100,193,156,.22); border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-badge i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: #63d2a4; border-radius: 50%; box-shadow: 0 0 0 4px rgba(99,210,164,.1); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.metric-card { min-height: 145px; display: grid; align-content: space-between; padding: 21px; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 28px rgba(28,33,39,.035); }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { font-size: 35px; line-height: 1; letter-spacing: -.04em; }
.metric-card small { color: #9a9fa6; font-size: 11px; }
.roadmap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.panel { padding: 25px; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 28px rgba(28,33,39,.035); }
.roadmap-grid .panel { display: flex; gap: 18px; }
.roadmap-current { border-color: #d8c69f; }
.step-number { color: var(--accent-dark); font-size: 23px; font-weight: 800; }
.step-number.muted { color: #c5c8cc; }
.panel h3 { margin: 7px 0 9px; font-size: 16px; }
.panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.page-narrow { max-width: 640px; margin: 0 auto; }
.panel-heading { margin-bottom: 24px; }
.sidebar-overlay { display: none; }

@media (max-width: 1100px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .roadmap-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 270px; transition: transform .22s ease; }
    .sidebar.open { transform: translateX(0); }
    .menu-button { display: grid; place-items: center; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(7,9,11,.52); }
    .sidebar-overlay.visible { display: block; }
    .welcome-panel { flex-direction: column; }
}

@media (max-width: 560px) {
    .login-card { padding: 28px 22px; border-radius: 18px; }
    .login-brand { margin-bottom: 34px; }
    .metrics-grid { grid-template-columns: 1fr; }
    .content-area, .topbar { padding-left: 17px; padding-right: 17px; }
    .welcome-panel { border-radius: 15px; }
}
