:root {
    --primary: #0052cc;
    --primary-dark: #003b91;
    --primary-soft: #eef4ff;
    --sidebar: #0f172a;
    --sidebar-soft: #1e293b;
    --text: #1f2937;
    --muted: #667085;
    --bg: #f5f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --danger: #dc2626;
    --success: #067647;
    --warning: #b54708;
    --shadow: 0 14px 35px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: var(--primary); }

/* Production login */
.auth-body { min-height: 100vh; background: radial-gradient(circle at top left, #1d4ed8 0, #0f172a 38%, #111827 100%); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand-panel { color: white; display: flex; align-items: center; padding: 72px; position: relative; overflow: hidden; }
.auth-brand-panel:before { content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%; background: rgba(255,255,255,.08); right: -120px; top: -140px; }
.auth-brand-content { max-width: 620px; position: relative; z-index: 1; }
.auth-badge { display: inline-flex; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 8px 14px; font-weight: 800; margin-bottom: 22px; }
.auth-brand-content h1 { font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -0.05em; margin: 0 0 22px; }
.auth-brand-content p { color: #dbeafe; font-size: 1.08rem; line-height: 1.7; max-width: 560px; }
.auth-highlights { display: grid; gap: 14px; margin-top: 34px; }
.auth-highlights div { display: flex; gap: 12px; align-items: center; color: #eff6ff; font-weight: 700; }
.auth-highlights i { font-size: 1.25rem; color: #93c5fd; }
.auth-card-panel { display: flex; align-items: center; justify-content: center; padding: 38px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.auth-card { width: 100%; max-width: 500px; background: #fff; border: 1px solid rgba(255,255,255,.7); border-radius: 28px; padding: 34px; box-shadow: 0 28px 80px rgba(15,23,42,.28); }
.auth-card-logo { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.logo-mark { width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), #4f46e5); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 1.5rem; }
.auth-card h2 { margin: 0; font-size: 1.45rem; font-weight: 900; }
.auth-card p { margin: 3px 0 0; color: var(--muted); }
.auth-form .form-label { font-weight: 800; color: #344054; }
.auth-note { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 16px; color: var(--muted); font-size: .92rem; line-height: 1.5; }

/* Admin template */
.admin-body { background: var(--bg); }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.admin-sidebar { background: linear-gradient(180deg, var(--sidebar), #111827); color: #cbd5e1; padding: 20px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 12px; border-radius: 16px; margin-bottom: 20px; }
.sidebar-logo { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #2563eb, #22c55e); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 900; }
.sidebar-brand strong { display: block; line-height: 1; font-size: 1.05rem; }
.sidebar-brand small { color: #94a3b8; font-weight: 700; }
.sidebar-user { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 14px; margin-bottom: 18px; }
.avatar { width: 42px; height: 42px; border-radius: 999px; background: #2563eb; color: white; display: grid; place-items: center; font-weight: 900; }
.sidebar-user strong { color: #fff; display: block; }
.sidebar-user small { color: #94a3b8; }
.sidebar-nav { display: grid; gap: 6px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 14px; color: #cbd5e1; font-weight: 750; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav i { font-size: 1.05rem; width: 22px; text-align: center; color: #93c5fd; }
.admin-main { min-width: 0; }
.admin-topbar { height: 74px; background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 20; }
.admin-topbar strong { display: block; font-size: 1.05rem; }
.admin-topbar small { color: var(--muted); }
.sidebar-toggle { display: none; border: 1px solid var(--border); background: #fff; border-radius: 12px; width: 42px; height: 42px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-pill { background: var(--primary-soft); color: var(--primary); border: 1px solid #c7d7fe; border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 900; }
.content-wrapper { padding: 28px; max-width: 1440px; margin: 0 auto; }

/* Existing portal components */
.page { max-width: 1180px; margin: 0 auto; padding: 34px 18px; }
.footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 30px; }
.hero { background: linear-gradient(120deg, #0052cc, #013a8a); color: #fff; border-radius: 24px; padding: 34px; margin-bottom: 24px; box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 8px; font-size: 2rem; font-weight: 900; }
.hero p { margin: 0; color: #dbeafe; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.metric { font-size: 2rem; font-weight: 900; margin-top: 8px; }
.muted { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; padding: 11px 16px; font-weight: 800; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #eef4ff; color: var(--primary); border-color: #c7d7fe; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.form { max-width: 860px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 800; margin-bottom: 7px; color: #344054; }
.form-control, input, select, textarea { width: 100%; border: 1px solid #d0d5dd; border-radius: 10px; padding: 11px 12px; font-size: 1rem; background: #fff; }
textarea { min-height: 90px; }
.validation { color: var(--danger); font-size: .9rem; }
.alert { padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; }
.alert-error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.alert-success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: .95rem; }
.table th { background: #f9fafb; color: #344054; }
.badge { display: inline-block; border-radius: 999px; padding: 5px 10px; background: #eef4ff; color: var(--primary); font-size: .8rem; font-weight: 900; }
.status-active { color: var(--success); font-weight: 800; }
.status-inactive { color: var(--danger); font-weight: 800; }
.split { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.small { font-size: .9rem; }
.pre { white-space: pre-wrap; background: #111827; color: #fff; border-radius: 12px; padding: 14px; overflow: auto; }
.page-heading { margin-bottom: 18px; }
.btn-small { padding: 7px 12px; font-size: .85rem; }
.kpi-card p { margin-bottom: 0; color: #667085; }
.small-metric { font-size: 1.55rem; }
.details-grid { margin-top: 18px; }
.details-list { display: grid; grid-template-columns: 170px 1fr; gap: 10px 14px; margin: 0; }
.details-list dt { color: #667085; font-weight: 800; }
.details-list dd { margin: 0; color: #1f2937; word-break: break-word; }
.timeline { display: grid; gap: 12px; }
.timeline-item { border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; background: #fff; }
.timeline-item p { margin: 8px 0 0; color: #475467; }
.crm-note { margin-top: 14px; display: grid; gap: 4px; }
.stack-form { display: grid; gap: 10px; }
.stack-form label { font-weight: 800; color: #344054; }
.stack-form input, .stack-form select, .stack-form textarea { width: 100%; border: 1px solid #d0d5dd; border-radius: 10px; padding: 11px 12px; font: inherit; }
.stack-form textarea { min-height: 100px; resize: vertical; }
.badge-soft { background: #eef4ff; color: #3538cd; border: 1px solid #c7d7fe; }

@media (max-width: 980px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { display: none; }
    .auth-card-panel { min-height: 100vh; }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-105%); transition: .2s ease; z-index: 50; }
    body.sidebar-open .admin-sidebar { transform: translateX(0); }
    .sidebar-toggle { display: inline-grid; place-items: center; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .grid-2, .grid-3, .form-row { grid-template-columns: 1fr; }
    .content-wrapper { padding: 20px 14px; }
    .hero { padding: 24px; }
    .hero h1 { font-size: 1.55rem; }
    .details-list { grid-template-columns: 1fr; }
    .details-list dt { margin-top: 8px; }
    .split { flex-direction: column; align-items: flex-start; }
    .topbar-actions { gap: 8px; }
    .role-pill { display: none; }
}

@media (max-width: 640px) {
    .grid-4 { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; border-radius: 22px; }
}
