:root {
    --admin-primary: #2a5fc1;
    --admin-primary-dark: #204791;
    --admin-primary-soft: #eaf1fc;
    --admin-sidebar: #102443;
    --admin-sidebar-deep: #0a1a31;
    --admin-ink: #18243a;
    --admin-muted: #68758a;
    --admin-line: #dfe6f0;
    --admin-canvas: #f4f7fb;
    --admin-surface: #fff;
    --navy: var(--admin-sidebar);
    --navy-light: #17345f;
    --navy-soft: #17345f;
    --orange: var(--admin-primary);
    --orange-dark: var(--admin-primary-dark);
    --orange-soft: var(--admin-primary-soft);
    --ink: var(--admin-ink);
    --muted: var(--admin-muted);
    --line: var(--admin-line);
    --canvas: var(--admin-canvas);
    --bg: var(--admin-canvas);
}

html, body { min-height: 100%; }
body { color: var(--admin-ink); background: var(--admin-canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }

/* Shared admin shell */
.admin-body { margin: 0; overflow-x: hidden; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.admin-sidebar { position: sticky; z-index: 50; top: 0; height: 100vh; padding: 28px 20px 22px; color: #fff; background: radial-gradient(circle at 20% 0, rgba(76,132,231,.24), transparent 30%), linear-gradient(165deg, var(--admin-sidebar), var(--admin-sidebar-deep)); display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar-brand span { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: 14px; letter-spacing: .09em; }
.sidebar-brand small { color: #9fb0ca; font-size: 11px; }
.sidebar-caption { margin: 42px 12px 12px; color: #7186a6; font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-nav { margin-top: 42px; display: grid; gap: 7px; }
.sidebar-nav a, .sidebar-nav-item { min-height: 48px; padding: 0 13px; border-radius: 12px; color: #aab9cf; display: flex; align-items: center; gap: 12px; font-size: 14px; text-decoration: none; transition: .18s ease; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-nav a.active { color: #fff; background: rgba(62,123,232,.22); box-shadow: inset 3px 0 var(--admin-primary); }
.sidebar-nav svg { width: 19px; height: 19px; flex: 0 0 auto; stroke-width: 1.8; }
.sidebar-nav small { margin-left: auto; color: #6f83a1; font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.sidebar-meta { margin-top: auto; padding: 0 10px; color: #637898; font-size: 11px; }
.sidebar-close { display: none; position: absolute; top: 24px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 10px; color: #b9c7da; background: rgba(255,255,255,.08); font-size: 25px; line-height: 1; }
.sidebar-overlay { display: none; position: fixed; z-index: 40; inset: 0; background: rgba(5,17,36,.52); backdrop-filter: blur(2px); }
.admin-main { min-width: 0; }
.admin-topbar { min-height: 78px; padding: 0 34px; border-bottom: 1px solid var(--admin-line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: space-between; }
.topbar-path { color: var(--admin-muted); font-size: 13px; }
.topbar-path span { margin: 0 8px; color: #b0b9c8; }
.topbar-path strong { color: var(--admin-ink); }
.menu-trigger { display: none; width: 40px; height: 40px; padding: 10px; border: 1px solid var(--admin-line); border-radius: 11px; background: #fff; }
.menu-trigger span { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--admin-primary-dark); }
.admin-profile { display: flex; align-items: center; gap: 11px; }
.profile-copy { display: grid; gap: 2px; text-align: right; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { max-width: 220px; overflow: hidden; color: var(--admin-muted); font-size: 10px; text-overflow: ellipsis; }
.profile-avatar { width: 38px; height: 38px; border-radius: 12px; color: var(--admin-primary-dark); background: var(--admin-primary-soft); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.admin-profile form { margin: 0 0 0 5px; }
.logout-button { width: 38px; height: 38px; padding: 0; border: 1px solid var(--admin-line); border-radius: 11px; color: var(--admin-muted); background: #fff; display: grid; place-items: center; }
.logout-button:hover { color: #b42318; background: #fff7f7; }
.logout-button svg { width: 18px; height: 18px; stroke-width: 1.8; }
.admin-content { max-width: 1400px; margin: 0 auto; padding: 42px 36px 58px; }

/* Topbar user menu */
.admin-user-menu { position: relative; margin-left: auto; }
.user-menu-trigger { min-height: 58px; padding: 7px 11px; border: 0; border-radius: 14px; color: var(--admin-ink); background: transparent; display: flex; align-items: center; gap: 11px; cursor: pointer; transition: background .16s ease; }
.user-menu-trigger:hover, .admin-user-menu.is-open .user-menu-trigger { background: var(--admin-primary-soft); }
.user-menu-avatar { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid #cbdcf7; border-radius: 13px; color: var(--admin-primary-dark); background: var(--admin-primary-soft); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.user-menu-copy { min-width: 125px; display: grid; gap: 2px; text-align: left; }
.user-menu-copy strong { max-width: 210px; overflow: hidden; color: var(--admin-ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-copy small { color: var(--admin-muted); font-size: 10px; }
.user-menu-chevron { width: 17px; height: 17px; color: #8c98aa; stroke-width: 1.8; transition: transform .16s ease; }
.admin-user-menu.is-open .user-menu-chevron { transform: rotate(180deg); }
.user-menu-dropdown { position: absolute; z-index: 80; top: calc(100% + 9px); right: 0; width: min(330px, calc(100vw - 30px)); overflow: hidden; border: 1px solid var(--admin-line); border-radius: 14px; background: #fff; box-shadow: 0 20px 52px rgba(20,42,78,.16); }
.user-menu-dropdown[hidden] { display: none; }
.user-menu-header { padding: 17px 18px 14px; display: grid; gap: 3px; }
.user-menu-header > span { color: var(--admin-primary); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.user-menu-header strong { margin-top: 4px; color: var(--admin-ink); font-size: 13px; }
.user-menu-header small { overflow: hidden; color: var(--admin-muted); font-size: 10px; text-overflow: ellipsis; }
.user-menu-item { width: 100%; min-height: 47px; padding: 0 18px; border: 0; color: #46546a; background: #fff; display: flex; align-items: center; gap: 11px; text-decoration: none; font-size: 11px; font-weight: 700; cursor: pointer; }
.user-menu-item:hover { color: var(--admin-primary-dark); background: #f6f9fe; }
.user-menu-item svg { width: 19px; height: 19px; flex: 0 0 auto; stroke-width: 1.8; }
.user-menu-divider { height: 1px; background: var(--admin-line); }
.user-menu-dropdown form { margin: 0; }
.user-menu-logout { color: #a72b35; }
.user-menu-logout:hover { color: #8d2029; background: #fff5f5; }

/* Home */
.admin-home-welcome h1 { margin: 0; color: var(--admin-ink); font-size: clamp(21px, 2.2vw, 29px); line-height: 1.2; letter-spacing: -.025em; }

/* Profile */
.admin-profile-page { width: 100%; }
.page-breadcrumb { margin: 0 0 20px; color: var(--admin-muted); display: flex; align-items: center; gap: 9px; font-size: 11px; }
.page-breadcrumb a { color: var(--admin-muted); text-decoration: none; }
.page-breadcrumb a:hover { color: var(--admin-primary); }
.page-breadcrumb span { color: #b1bac8; }
.page-breadcrumb strong { color: var(--admin-ink); font-weight: 750; }
.profile-page-hero { margin-bottom: 18px; padding: 24px; border: 1px solid #cbdcf7; border-radius: 14px; background: linear-gradient(115deg, #fff, #f3f7fd); display: flex; align-items: center; gap: 17px; }
.profile-page-avatar { width: 58px; height: 58px; flex: 0 0 auto; border: 1px solid #cbdcf7; border-radius: 50%; color: var(--admin-primary-dark); background: var(--admin-primary-soft); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.profile-page-hero h1 { margin: 0; color: var(--admin-ink); font-size: clamp(25px, 3vw, 34px); letter-spacing: -.035em; }
.profile-settings-card { overflow: hidden; border: 1px solid var(--admin-line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(27,55,100,.06); }
.profile-settings-card > header { padding: 19px 22px; border-bottom: 1px solid var(--admin-line); }
.profile-settings-card > header h2 { margin: 0; color: var(--admin-ink); font-size: 16px; }
.profile-settings-card > header p { margin: 5px 0 0; color: var(--admin-muted); font-size: 10px; }
.profile-settings-card form { padding: 22px; }
.profile-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-field { display: grid; gap: 6px; }
.profile-field label { color: #414c60; font-size: 10px; font-weight: 750; }
.profile-field input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid #d9e0ea; border-radius: 9px; background: #fff; }
.profile-field input:focus { outline: 0; border-color: var(--admin-primary); box-shadow: 0 0 0 3px rgba(42,95,193,.12); }
.profile-field input[readonly] { color: var(--admin-muted); background: #f7f9fc; cursor: not-allowed; }
.profile-field > span { color: #b42318; font-size: 9px; }
.profile-settings-actions { margin-top: 21px; display: flex; justify-content: flex-end; }
.admin-primary-button { min-height: 43px; padding: 0 18px; border: 0; border-radius: 9px; color: #fff; background: var(--admin-primary); font-size: 11px; font-weight: 750; cursor: pointer; box-shadow: 0 5px 12px rgba(42,95,193,.2); }
.admin-primary-button:hover { background: var(--admin-primary-dark); }
.admin-alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid; border-radius: 10px; font-size: 11px; }
.admin-alert.success { color: #126246; border-color: #bde3d5; background: #eaf8f3; }
.admin-alert.error { color: #8d252e; border-color: #efc7cb; background: #fff1f2; }

/* Reusable page components */
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; }
.page-kicker { margin: 0 0 8px; color: var(--admin-primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; }
.page-heading p { max-width: 720px; margin: 9px 0 0; color: var(--admin-muted); line-height: 1.65; }
.admin-panel { padding: 26px; border: 1px solid var(--admin-line); border-radius: 18px; background: #fff; box-shadow: 0 14px 42px rgba(27,55,100,.05); }
.admin-panel h2 { margin: 0 0 12px; font-size: 18px; }
.admin-panel p { color: var(--admin-muted); line-height: 1.7; }
.info-list { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.info-list li { padding: 14px 16px; border-radius: 12px; background: var(--admin-primary-soft); color: #38516f; }
.request-code { padding: 4px 8px; border-radius: 7px; color: var(--admin-primary-dark); background: var(--admin-primary-soft); }

/* Existing standalone dashboard: blue Admin identity and mobile off-canvas. */
.shell .sidebar { background: radial-gradient(circle at 20% 0, rgba(76,132,231,.24), transparent 30%), linear-gradient(165deg, var(--admin-sidebar), var(--admin-sidebar-deep)); }
.shell .nav-item.active { background: rgba(62,123,232,.22); }
.shell .mark, .brand-mark { object-fit: contain; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.shell .notice { border-color: #cbdcf7; background: #f5f8fe; }
.shell .notice-mark, .shell .module-icon { color: var(--admin-primary-dark); background: var(--admin-primary-soft); }
.shell .notice p { color: #61728a; }
.shell .module { box-shadow: 0 12px 36px rgba(27,55,100,.05); transition: transform .18s ease, box-shadow .18s ease; }
.shell .module:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(27,55,100,.09); }
.shell .mobile-brand { cursor: pointer; }
.shell .sidebar-close { display: none; }

/* Login */
.visual { background: radial-gradient(circle at 80% 18%, rgba(74,135,240,.34), transparent 29%), radial-gradient(circle at 8% 92%, rgba(39,90,180,.28), transparent 36%), linear-gradient(145deg, #091a34 0%, #12315e 55%, #204791 100%) !important; }
.visual .eyebrow { color: #a9c9ff; }
.form-side { background: linear-gradient(rgba(255,255,255,.76), rgba(255,255,255,.76)), radial-gradient(circle at 100% 0%, #dce8fb, transparent 38%), var(--admin-canvas) !important; }
.heading span { color: var(--admin-primary-dark) !important; }
input:focus { border-color: var(--admin-primary) !important; box-shadow: 0 0 0 4px rgba(42,95,193,.12) !important; }
.submit { background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark)) !important; box-shadow: 0 13px 27px rgba(42,95,193,.24) !important; }
.submit:hover { background: var(--admin-primary-dark) !important; }

/* Standalone states */
.state-page { min-height: 100vh; margin: 0; padding: 24px; background: radial-gradient(circle at 50% 0, #e0ebfc, transparent 40%), var(--admin-canvas); display: grid; place-items: center; }
.state-card { width: min(100%, 470px); padding: 42px; border: 1px solid var(--admin-line); border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 24px 70px rgba(27,55,100,.11); }
.state-mark { width: 62px; height: 62px; margin: 0 auto 20px; border-radius: 18px; color: var(--admin-primary-dark); background: var(--admin-primary-soft); display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.state-card h1 { margin: 0 0 10px; font-size: 28px; }
.state-card p { margin: 0 0 26px; color: var(--admin-muted); line-height: 1.65; }
.admin-button { min-height: 46px; padding: 0 20px; border: 0; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark)); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 750; box-shadow: 0 10px 24px rgba(42,95,193,.2); }
.admin-button:hover { color: #fff; transform: translateY(-1px); }

@media (max-width: 1050px) and (min-width: 901px) {
    .admin-shell { grid-template-columns: 88px minmax(0,1fr); }
    .admin-sidebar { padding-inline: 15px; }
    .sidebar-brand { justify-content: center; padding: 0; }
    .sidebar-brand span, .sidebar-caption, .sidebar-nav span:not(.sidebar-nav-item), .sidebar-nav small, .sidebar-meta { display: none; }
    .sidebar-nav { margin-top: 28px; }
    .sidebar-nav a, .sidebar-nav-item { justify-content: center; padding: 0; }
}

@media (max-width: 900px) {
    .admin-shell { display: block; }
    .admin-sidebar, .shell .admin-sidebar { position: fixed; left: 0; top: 0; width: min(84vw, 300px); height: 100vh; display: flex !important; transform: translateX(-105%); transition: transform .24s ease; box-shadow: 20px 0 60px rgba(5,17,36,.25); }
    .menu-open .admin-sidebar { transform: translateX(0); }
    .menu-open .sidebar-overlay { display: block; }
    .sidebar-close, .shell .sidebar-close { display: grid; place-items: center; }
    .admin-topbar { min-height: 68px; padding: 0 18px; }
    .menu-trigger { display: block; }
    .topbar-path { display: none; }
    .admin-content { padding: 30px 18px 44px; }
    .profile-copy { display: none; }
    .user-menu-copy { display: none; }
    .user-menu-trigger { min-height: 46px; padding: 2px; }
    .user-menu-avatar { width: 40px; height: 40px; }
    .user-menu-chevron { display: none; }
    body.menu-open { overflow: hidden; }
    .shell .sidebar { padding: 28px 20px 22px; }
    .shell .brand { justify-content: flex-start; padding: 0 8px; }
    .shell .brand-copy, .shell .caption, .shell .nav-item span, .shell .soon, .shell .footer { display: initial; }
    .shell .nav { margin-top: 0; }
    .shell .nav-item { justify-content: flex-start; padding: 0 13px; }
}

@media (max-width: 600px) {
    .page-heading { align-items: flex-start; flex-direction: column; }
    .admin-panel, .state-card { padding: 24px 20px; border-radius: 16px; }
    .admin-profile { gap: 7px; }
    .profile-page-hero { padding: 19px; }
    .profile-page-avatar { width: 48px; height: 48px; }
    .profile-settings-card > header, .profile-settings-card form { padding: 18px; }
    .profile-settings-grid { grid-template-columns: 1fr; }
    .profile-settings-actions .admin-primary-button { width: 100%; }
}
