:root {
    --bg: #eef3f8;
    --white: #ffffff;
    --text: #111827;
    --muted: #667085;
    --line: #e8edf5;
    --soft: #f7f9fd;
    --navy: #0b1424;
    --gold: #d7b555;
    --gold-dark: #c99a2e;
    --gold-soft: #fff3dc;
    --blue: #2563eb;
    --blue-soft: #eef4ff;
    --orange: #d79522;
    --shadow-soft: 0 10px 30px rgba(16, 24, 40, .052);
    --radius: 24px;
}

* { box-sizing: border-box; }

body.admin-body,
body.login-body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(201,154,46,.08), transparent 25%),
        radial-gradient(circle at 90% 6%, rgba(37,99,235,.08), transparent 30%),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

body.admin-body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; }
button, input, textarea { font: inherit; }

.ui-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.admin-frame {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at 12% 0%, rgba(215,181,85,.12), transparent 26%), linear-gradient(180deg, var(--navy), #070f1c);
    color: rgba(255,255,255,.82);
    padding: 38px 26px 28px;
}

.admin-logo {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 38px;
}

.admin-logo-mark {
    width: 44px;
    height: 44px;
    border: 2px solid var(--gold-dark);
    border-radius: 16px;
    transform: rotate(45deg);
    background: radial-gradient(circle at center, transparent 0 27%, var(--gold-dark) 29% 36%, transparent 38%), rgba(255,255,255,.04);
}

.admin-logo-text { display: grid; line-height: 1; }
.admin-logo-text strong { color: #fff; font-size: 24px; letter-spacing: .075em; }
.admin-logo-text small { margin-top: 5px; color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .42em; }

.admin-menu {
    display: grid;
    gap: 10px;
}

.admin-menu a {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0 15px;
    color: rgba(255,255,255,.80);
    font-weight: 760;
    letter-spacing: -.01em;
}

.admin-menu a:hover,
.admin-menu a.is-active {
    color: #ffd875;
    border-color: rgba(215,181,85,.25);
    background: rgba(255,255,255,.085);
}

.menu-icon {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    flex: 0 0 25px;
}

.menu-icon .ui-icon {
    width: 23px;
    height: 23px;
}

.sidebar-promo {
    margin-top: auto;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 22px;
    background: rgba(255,255,255,.055);
    padding: 21px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.promo-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border: 1px solid rgba(215,181,85,.42);
    border-radius: 15px;
}

.promo-icon .ui-icon { width: 30px; height: 30px; }

.sidebar-promo strong { display: block; color: #fff; font-size: 17px; line-height: 1.25; }
.sidebar-promo p { margin: 10px 0 17px; color: rgba(255,255,255,.68); font-size: 14px; }
.sidebar-promo a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #d8b45e, #bd8624);
    color: #fff;
    padding: 0 17px;
    font-weight: 850;
    box-shadow: 0 12px 22px rgba(201,154,46,.16);
}

.admin-main { min-width: 0; display: grid; grid-template-rows: auto 1fr; }

.admin-topbar {
    min-height: 116px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(18px);
    padding: 26px 40px;
}

.admin-title h1 { margin: 0; font-size: 31px; line-height: 1.1; letter-spacing: -.035em; }
.admin-title p { margin: 4px 0 0; color: var(--muted); }

.admin-profile { display: flex; align-items: center; gap: 14px; }
.bell { position: relative; width: 26px; height: 26px; }
.bell::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 4px;
    width: 12px;
    height: 14px;
    border: 2px solid var(--navy);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
}
.bell::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 18px;
    width: 10px;
    height: 2px;
    border-radius: 99px;
    background: var(--navy);
    box-shadow: 14px -17px 0 -2px var(--gold-dark);
}
.avatar { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 999px; background: #f1f4f9; color: var(--navy); font-weight: 900; font-size: 18px; }
.profile-name { display: grid; line-height: 1.2; }
.profile-name b { font-weight: 900; }
.profile-name small { color: var(--muted); }
.admin-profile a { color: var(--blue); font-size: 14px; font-weight: 800; }

.sidebar-toggle { display: none; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 11px; cursor: pointer; }
.sidebar-toggle span { display: block; height: 2px; margin: 5px 0; border-radius: 99px; background: var(--navy); }

.admin-content { width: 100%; padding: 30px 40px 50px; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 24px;
}

.stat-card {
    min-height: 128px;
    display: grid;
    grid-template-columns: 56px 1fr;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.95);
    box-shadow: var(--shadow-soft);
    padding: 23px;
}

.stat-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; }
.stat-icon .ui-icon { width: 34px; height: 34px; }
.stat-blue { background: var(--blue-soft); }
.stat-gold { background: var(--gold-soft); }
.stat-card p { margin: 0; color: var(--muted); font-weight: 760; }
.stat-card strong { display: block; margin: 2px 0 8px; font-size: 36px; line-height: 1; letter-spacing: -.03em; }
.stat-card a { color: var(--blue); font-size: 14px; font-weight: 850; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.14fr) minmax(430px, .86fr);
    gap: 24px;
}

.panel-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.95);
    box-shadow: var(--shadow-soft);
    padding: 25px;
}

.panel-head { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.panel-head h2, .panel-card h2 { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: -.02em; }
.panel-head button, .panel-head a { min-height: 36px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--navy); padding: 0 15px; font-size: 14px; font-weight: 850; cursor: pointer; }

.activity-panel, .leads-panel { min-height: 430px; }
.chart { height: 292px; overflow: hidden; border-radius: 20px; background: linear-gradient(180deg, rgba(37,99,235,.022), transparent), #fff; }
.chart svg { width: 100%; height: 100%; }
.grid-line { stroke: #e8edf5; stroke-width: 1; stroke-dasharray: 2 5; }
.axis-text { fill: #7c889a; font-size: 12px; }
.chart-area { opacity: .9; }
.chart-area-blue { fill: url(#blueArea); }
.chart-area-gold { fill: url(#goldArea); }
.chart-line { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-line-gold { stroke: var(--gold-dark); }
.chart-line-blue { stroke: var(--blue); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 17px; }
.chart-legend div { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.chart-legend b { color: var(--text); margin-left: 4px; font-size: 18px; }
.gold-dot, .blue-dot { width: 10px; height: 10px; display: inline-block; border-radius: 99px; }
.gold-dot { background: var(--gold-dark); }
.blue-dot { background: var(--blue); }

.leads-list { display: grid; gap: 12px; }
.lead-item { min-height: 60px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid #edf1f6; padding-bottom: 12px; }
.lead-item:last-child { border-bottom: 0; padding-bottom: 0; }
.lead-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 999px; background: var(--gold-soft); color: #b48318; font-weight: 900; }
.lead-main strong, .lead-main small, .lead-side time, .lead-status { display: block; }
.lead-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-side { min-width: 122px; text-align: right; }
.lead-side time { color: var(--muted); font-size: 13px; margin-bottom: 3px; }
.lead-status { position: relative; font-size: 13px; font-weight: 800; }
.lead-status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 99px; margin-right: 7px; vertical-align: middle; }
.status-blue { color: var(--blue); }
.status-blue::before { background: var(--blue); }
.status-gold { color: var(--orange); }
.status-gold::before { background: var(--orange); }
.leads-empty { border: 1px dashed var(--line); border-radius: 18px; background: var(--soft); padding: 18px; }
.leads-empty strong { display: block; }
.leads-empty p { margin: 5px 0 0; color: var(--muted); }

.quick-panel, .note-panel { min-height: 215px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 21px; }
.quick-grid a { min-height: 120px; display: grid; place-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 14px; text-align: center; }
.quick-grid span .ui-icon { width: 40px; height: 40px; }
.quick-grid b { font-size: 14px; line-height: 1.3; }

.note-box { display: grid; grid-template-columns: 48px 1fr; gap: 14px; margin-top: 21px; border-radius: 19px; background: linear-gradient(135deg, #fff4de, #fffaf0); padding: 23px; }
.note-box i { color: #eacb8d; font-size: 54px; line-height: .9; font-style: normal; }
.note-box p { margin: 7px 0 10px; color: var(--muted); }
.note-box small { color: var(--muted); }

/* Shared existing admin pages */
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: minmax(320px, 520px) minmax(0, 1fr); }
.grid.cards { grid-template-columns: repeat(3, 1fr); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.95); box-shadow: var(--shadow-soft); padding: 24px; }
.card h2 { margin-top: 0; }
.form { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 750; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--text); padding: 13px 14px; outline: none; }
input:focus, textarea:focus { border-color: rgba(37,99,235,.42); box-shadow: 0 0 0 4px rgba(37,99,235,.08); }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: auto; }
button { border: 0; border-radius: 14px; background: linear-gradient(135deg, var(--blue), #1d4ed8); color: #fff; padding: 13px 18px; font-weight: 850; cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #eef1f6; padding: 13px 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 750; }
.muted { color: var(--muted); }
.alert { border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; }
.alert.error { background: rgba(239,68,68,.10); color: #b91c1c; }
.alert.success { background: rgba(22,163,74,.10); color: #15803d; }

/* Login */
.login-body { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 430px); display: grid; gap: 16px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.95); box-shadow: 0 22px 54px rgba(16,24,40,.075); padding: 30px; }
.login-card h1 { margin: 0; font-size: 34px; }
.login-card p { margin: 0 0 8px; color: var(--muted); }

@media (max-width: 1220px) {
    .admin-frame { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: 18px; top: 18px; bottom: 18px; z-index: 400; width: 286px; height: auto; border-radius: 26px; transform: translateX(calc(-100% - 44px)); transition: transform .22s ease; box-shadow: 0 22px 54px rgba(16, 24, 40, .075); }
    .admin-sidebar.is-open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid, .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .admin-topbar { min-height: auto; grid-template-columns: auto 1fr; padding: 18px 16px; }
    .admin-profile { grid-column: 1 / -1; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; }
    .admin-content { padding: 18px 16px 34px; }
    .stats-row, .quick-grid, .grid.cards { grid-template-columns: 1fr; }
    .stat-card { min-height: 112px; }
    .chart { height: 230px; }
    .lead-item { grid-template-columns: 42px minmax(0, 1fr); }
    .lead-side { grid-column: 2; min-width: 0; text-align: left; }
    .panel-card, .card { border-radius: 20px; padding: 18px; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}
