@import '@fontsource/manrope/400.css';
@import '@fontsource/manrope/500.css';
@import '@fontsource/manrope/600.css';
@import '@fontsource/manrope/700.css';
@import '@fontsource/manrope/800.css';
@import '@fontsource/hind-siliguri/400.css';
@import '@fontsource/hind-siliguri/600.css';
@import 'leaflet/dist/leaflet.css';

/* CHOLEN JAI admin — "Premium Ember" */
:root {
    --primary: #EA580C;
    --primary-press: #C2410C;
    --primary-soft: #FFEDD5;
    --charcoal: #171717;
    --ivory: #FAF7F2;
    --surface: #FFFFFF;
    --muted: #78716C;
    --border: #E7E0D8;
    --success: #15803D;
    --success-soft: #DCFCE7;
    --error: #B91C1C;
    --error-soft: #FEE2E2;
    --warn: #B45309;
    --warn-soft: #FEF3C7;
    --info: #1D4ED8;
    --info-soft: #DBEAFE;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(23, 23, 23, .04), 0 8px 24px -12px rgba(23, 23, 23, .12);
    --font: 'Manrope', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--ivory); color: var(--charcoal); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
a { color: var(--primary-press); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; font-weight: 800; letter-spacing: .2em; color: var(--primary); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.brand b { font-weight: 800; letter-spacing: .08em; font-size: 15px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--muted); padding: 14px 10px 4px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--charcoal); font-weight: 600; cursor: pointer; }
.nav a:hover { background: var(--ivory); }
.nav a.active { background: var(--primary-soft); color: var(--primary-press); }
.nav a .dot { margin-left: auto; background: var(--primary); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 12px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 28px; position: sticky; top: 0; background: color-mix(in srgb, var(--ivory) 88%, transparent); backdrop-filter: blur(8px); z-index: 20; border-bottom: 1px solid transparent; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar .spacer { flex: 1; }
.page { padding: 8px 28px 48px; max-width: 1440px; }
.menu-btn { display: none; }

/* ---------- primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .spacer { flex: 1; }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.kpi.accent .label, .kpi.accent .sub { color: #d6d3d1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 12px; font-weight: 700; cursor: pointer; transition: transform .08s, background .15s; }
.btn:hover { background: var(--ivory); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-press); }
.btn.danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label { font-weight: 700; font-size: 12.5px; }
.field .hint { color: var(--muted); font-size: 12px; }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=search], select, textarea {
    width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; outline: none;
}
textarea { min-height: 90px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=color] { width: 44px; height: 38px; border: 1px solid var(--border); border-radius: 10px; padding: 2px; background: var(--surface); cursor: pointer; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { left: 21px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--ivory); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--error-soft); color: var(--error); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--primary-soft); color: var(--primary-press); border-color: transparent; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--ivory); }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty svg { width: 64px; height: 64px; margin-bottom: 6px; stroke: var(--border); fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 16px; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 10px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--primary-soft); color: var(--primary-press); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }

/* modal + drawer + toast */
.overlay { position: fixed; inset: 0; background: rgba(23,23,23,.45); display: grid; place-items: center; z-index: 80; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 20px; width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(1040px, 100%); }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { font-size: 18px; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--charcoal); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: pop .2s; max-width: 380px; }
.toast.error { background: var(--error); }
.toast.ok { background: var(--success); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ''; position: absolute; left: 8px; top: 16px; bottom: -2px; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline small { color: var(--muted); display: block; }
.bar { height: 8px; border-radius: 999px; background: var(--ivory); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr 90px; gap: 10px; align-items: center; margin-bottom: 10px; }
.chart-box { position: relative; height: 260px; }
#livemap { height: 560px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.banner { background: var(--info-soft); color: var(--info); border-radius: 12px; padding: 10px 14px; font-weight: 600; margin-bottom: 14px; }
.doc-img { max-width: 100%; max-height: 62vh; border-radius: 10px; border: 1px solid var(--border); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.doc { border: 1px solid var(--border); border-radius: 12px; padding: 10px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(420px, 100%); padding: 30px; }
.login h1 { font-size: 24px; font-weight: 800; margin: 16px 0 4px; }

/* App studio preview (phone) */
.phone { width: 300px; margin: 0 auto; border-radius: 34px; border: 8px solid #171717; background: var(--p-bg, #FAF7F2); overflow: hidden; box-shadow: 0 24px 60px -24px rgba(0,0,0,.5); font-family: var(--p-font, var(--font)); color: var(--p-text, #171717); }
.phone .ph-map { height: 150px; background: linear-gradient(135deg, #e9e3d9, #f4efe6); position: relative; }
.phone .ph-pin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--p-primary, #EA580C); border: 3px solid #fff; transform: translate(-50%, -50%); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.phone .ph-body { padding: var(--p-page, 20px); display: flex; flex-direction: column; gap: 12px; }
.phone .ph-card { background: var(--p-surface, #fff); border: 1px solid var(--p-border, #E7E0D8); border-radius: var(--p-card, 16px); padding: 12px; }
.phone .ph-btn { background: var(--p-primary, #EA580C); color: #fff; border-radius: var(--p-button, 12px); text-align: center; padding: 11px; font-weight: 800; letter-spacing: .04em; }
.phone .ph-input { background: var(--p-surface, #fff); border: 1px solid var(--p-border, #E7E0D8); border-radius: var(--p-input, 12px); padding: 10px 12px; color: var(--p-sec, #78716C); }
.phone .ph-row { display: flex; justify-content: space-between; align-items: center; }
.phone small { color: var(--p-sec, #78716C); }
.swatch-row { display: grid; grid-template-columns: 1fr auto 100px; gap: 10px; align-items: center; margin-bottom: 8px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-main, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; width: 270px; box-shadow: 0 0 60px rgba(0,0,0,.3); }
    .sidebar.open { transform: none; }
    .menu-btn { display: inline-flex; }
    .page, .topbar { padding-left: 16px; padding-right: 16px; }
    .g2 { grid-template-columns: 1fr; }
}
