/* WhatsApp CRM Suite — "WaDesk". Deep green. Namespaced .wd */
* { box-sizing: border-box; }
.wd {
    --bg: #f4f6f4; --panel: #ffffff; --panel2: #eef2ef; --line: #e3e9e4;
    --ink: #0f1a15; --muted: #6b7a71; --brand: #0f766e; --brand-ink: #115e56; --accent: #14b8a6;
    --ok: #16a34a; --danger: #dc2626; --warn: #f59e0b;
    --shadow: 0 14px 34px -22px rgba(15,60,45,.3);
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--ink);
    min-height: calc(100vh - 44px); background: var(--bg);
    display: grid; grid-template-columns: 258px minmax(0,1fr); grid-template-rows: auto 1fr;
    grid-template-areas: "side top" "side main";
}
:root[data-demo-theme="dark"] .wd { --bg: #0c1512; --panel: #12201b; --panel2: #16261f; --line: #22362c; --ink: #e6efe9; --muted: #93a89c; }
.wd h1,.wd h2,.wd h3,.wd p { margin: 0; }
.wd .serif { font-family: Georgia, "Times New Roman", serif; font-style: italic; }

/* sidebar */
.wd-side { grid-area: side; background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .8rem; overflow-y: auto; display: flex; flex-direction: column; }
.wd-logo { display: flex; align-items: center; gap: .55rem; padding: .3rem .5rem 1.2rem; font-weight: 800; font-size: 1.3rem; }
.wd-logo .mk { width: 2.4rem; height: 1.7rem; border-radius: .4rem; border: 2px solid var(--ink); display: grid; place-items: center; font-size: .9rem; }
.wd-grp { color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .9rem .5rem .4rem; }
.wd-menu { display: flex; flex-direction: column; gap: 2px; }
.wd-mi { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: .7rem; color: var(--muted); font-size: .9rem; font-weight: 600; cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; }
.wd-mi .ic { width: 1.1rem; text-align: center; }
.wd-mi .badge { margin-left: auto; background: var(--panel2); color: var(--muted); font-size: .7rem; border-radius: 999px; padding: 0 .45rem; font-weight: 700; }
.wd-mi .ch { margin-left: auto; opacity: .5; }
.wd-mi:hover { background: var(--panel2); color: var(--ink); }
.wd-mi.active { background: var(--brand); color: #fff; }
.wd-mi.active .badge { background: rgba(255,255,255,.2); color: #fff; }
.wd-back { margin-top: auto; display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: .7rem; padding: .7rem .8rem; font-size: .84rem; font-weight: 600; color: var(--ink); }
.wd-back .on { margin-left: auto; color: var(--ok); font-size: .72rem; }

/* topbar */
.wd-top { grid-area: top; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.4rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.wd-burger { display: none; border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.wd-crumb { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wd-crumb b { color: var(--ink); }
.wd-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: 999px; padding: .5rem 1rem; background: var(--panel2); color: var(--muted); font-size: .86rem; }
.wd-search input { flex: 1; border: 0; background: transparent; font: inherit; outline: none; color: var(--ink); }
.wd-search .kbd { border: 1px solid var(--line); border-radius: .35rem; padding: 0 .35rem; font-size: .72rem; }
.wd-top .sp { flex: 1; }
.wd-status { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem; font-size: .8rem; }
.wd-status .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); }
.wd-ic { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.wd-user { display: flex; align-items: center; gap: .5rem; }
.wd-user .av { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.wd-user b { display: block; font-size: .85rem; } .wd-user small { color: var(--muted); font-size: .72rem; }

/* main */
.wd-main { grid-area: main; padding: 1.6rem 2rem; overflow-x: hidden; }
.wd-view[hidden] { display: none !important; }
.wd-eyebrow { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.wd-title { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; margin: .2rem 0; }
.wd-lead { color: var(--muted); max-width: 60ch; margin-bottom: 1.6rem; }
.wd-hdrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.wd-btn { border: 0; cursor: pointer; border-radius: 999px; padding: .6rem 1.2rem; font: 700 .84rem inherit; background: var(--brand); color: #fff; display: inline-flex; align-items: center; gap: .4rem; }
.wd-btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.wd-sel { border: 1px solid var(--line); border-radius: 999px; padding: .5rem 1rem; font: 600 .82rem inherit; background: var(--panel); color: var(--ink); }

.wd-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.4rem; box-shadow: var(--shadow); }
.wd-card h3 { font-size: 1.15rem; font-weight: 800; }
.wd-card .sub { color: var(--muted); font-size: .82rem; margin-bottom: 1rem; }

.wd-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.1rem; margin-bottom: 1.4rem; }
.wd-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.3rem; box-shadow: var(--shadow); }
.wd-kpi .lab { color: var(--muted); font-size: .84rem; }
.wd-kpi .val { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; margin: .3rem 0 .6rem; }
.wd-kpi .dl { font-size: .74rem; font-weight: 700; background: #e6f6ef; color: #16a34a; border-radius: .4rem; padding: .15rem .5rem; }
.wd-kpi .dl + span { color: var(--muted); font-size: .74rem; margin-left: .4rem; }
.wd-kpi.warn { border-color: #f7c9c5; } .wd-kpi.warn .val { }
.wd-kpi .sub2 { color: var(--muted); font-size: .78rem; margin-top: .5rem; }
.wd-kpi.warn .sub2 { color: var(--danger); }

.wd-2col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
.wd-3col { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.2rem; margin-bottom: 1.2rem; }
.wd-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; margin-bottom: .6rem; }
.wd-legend span { display: inline-flex; align-items: center; gap: .4rem; } .wd-legend i { width: .7rem; height: .7rem; border-radius: 50%; }
#wd-rev, #wd-signups { width: 100%; height: 300px; display: block; }
.wd-radar { display: block; margin: 0 auto; width: 260px; height: 240px; }
.wd-ring-wrap { display: flex; flex-direction: column; align-items: center; }
#wd-ring { width: 200px; height: 200px; }
.wd-ring-foot { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; width: 100%; margin-top: 1rem; }
.wd-ring-foot div { border-top: 1px solid var(--line); padding-top: .5rem; } .wd-ring-foot b { font-size: 1.1rem; } .wd-ring-foot small { color: var(--muted); font-size: .74rem; display: block; }

.wd-bars .row { margin-bottom: .8rem; font-size: .82rem; }
.wd-bars .row .top { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.wd-bars .bar { height: 8px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.wd-bars .bar > i { display: block; height: 100%; border-radius: 999px; }

.wd-plat-legend { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; font-size: .82rem; }
.wd-plat-legend span { display: inline-flex; align-items: center; gap: .4rem; } .wd-plat-legend i { width: .7rem; height: .7rem; border-radius: 50%; }

/* pulse card */
.wd-pulse .row { margin-bottom: 1rem; } .wd-pulse .row .top { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 600; margin-bottom: .4rem; }
.wd-pulse .bar { height: 8px; border-radius: 999px; background: var(--panel2); overflow: hidden; } .wd-pulse .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* tables */
.wd-tbl-wrap { overflow-x: auto; }
.wd-tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.wd-tbl th { text-align: left; color: var(--muted); font-size: .78rem; font-weight: 600; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.wd-tbl td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); font-size: .86rem; }
.wd-tbl tr:last-child td { border-bottom: 0; }
.wd-tag { border-radius: 999px; padding: .15rem .6rem; font-size: .72rem; font-weight: 600; background: var(--panel2); color: var(--muted); }
.wd-tag.new { background: #fff4e0; color: #b45309; }
.wd-av { width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .76rem; }
.wd-toggle { width: 2.4rem; height: 1.3rem; border-radius: 999px; background: var(--panel2); position: relative; display: inline-block; }
.wd-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 1rem; height: 1rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.wd-statrow { display: grid; grid-template-columns: repeat(5,1fr); gap: 1rem; margin-bottom: 1.4rem; }
.wd-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.2rem; box-shadow: var(--shadow); }
.wd-stat.warn { border-color: #f7c9c5; }
.wd-stat .lab { color: var(--muted); font-size: .84rem; } .wd-stat .val { font-size: 2rem; font-weight: 800; margin: .2rem 0; } .wd-stat .sub { color: var(--muted); font-size: .78rem; } .wd-stat.warn .sub { color: var(--danger); }
.wd-tabs { display: inline-flex; gap: .4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .3rem; margin-bottom: 1rem; flex-wrap: wrap; }
.wd-tab { border: 0; background: transparent; color: var(--muted); font: 700 .82rem inherit; padding: .45rem 1rem; border-radius: 999px; cursor: pointer; }
.wd-tab.active { background: var(--brand); color: #fff; }

/* AI keys */
.wd-keys { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.wd-key { border: 1px solid var(--line); border-radius: .8rem; padding: 1rem 1.2rem; display: flex; align-items: center; gap: .7rem; }
.wd-key .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); }
.wd-key b { display: block; } .wd-key small { color: var(--muted); font-size: .78rem; } .wd-key .sp { flex: 1; }
.wd-key .off { background: var(--panel2); color: var(--muted); font-size: .72rem; border-radius: 999px; padding: .15rem .6rem; font-weight: 700; }

/* System Health */
.wd-hbanner { display: flex; align-items: center; justify-content: space-between; background: #e9f8ef; border: 1px solid #bfe6cf; border-radius: 1.1rem; padding: 1.2rem 1.4rem; margin-bottom: 1.3rem; }
.wd-hbanner .dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: .6rem; }
.wd-hbanner b { font-size: 1.4rem; } .wd-hbanner small { color: var(--muted); display: block; }
.wd-svc { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; margin-bottom: 1.2rem; }
.wd-svc-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.2rem; box-shadow: var(--shadow); }
.wd-svc-card .hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.wd-svc-card .op { background: #e9f8ef; color: #16a34a; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .1rem .6rem; }
.wd-svc-card .kind { font-size: 1.3rem; font-weight: 700; } .wd-svc-card .note { color: var(--muted); font-size: .82rem; }
.wd-vitals { display: grid; grid-template-columns: repeat(6,1fr); gap: 1rem; }
.wd-vital small { color: var(--muted); font-size: .72rem; text-transform: uppercase; display: block; } .wd-vital b { font-size: 1.05rem; }

/* Packages */
.wd-pkgs { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.2rem; margin-bottom: 1.4rem; }
.wd-pkg { background: var(--panel); border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.4rem; box-shadow: var(--shadow); position: relative; }
.wd-pkg.popular { border: 2px solid var(--brand); }
.wd-pkg .flag { position: absolute; top: -.8rem; left: 1.2rem; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 800; border-radius: 999px; padding: .2rem .7rem; }
.wd-pkg .top { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.wd-pkg .top .tag { background: #e6f6ef; color: var(--brand-ink); border-radius: 999px; padding: .1rem .5rem; font-weight: 700; }
.wd-pkg h3 { font-size: 1.3rem; margin: .5rem 0; }
.wd-pkg .price { font-size: 2rem; font-weight: 800; } .wd-pkg .price small { color: var(--muted); font-size: .9rem; font-weight: 500; }
.wd-pkg ul { list-style: none; padding: 0; margin: 1rem 0; }
.wd-pkg li { font-size: .86rem; padding: .3rem 0; color: var(--ink); } .wd-pkg li::before { content: "✓ "; color: var(--ok); font-weight: 800; }
.wd-pkg .foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: .8rem; font-size: .82rem; color: var(--muted); }
.wd-pkg .foot a { color: var(--brand); font-weight: 700; cursor: pointer; }

/* responsive */
.wd-scrim { position: fixed; inset: 0; background: rgba(15,18,28,.4); z-index: 25; display: none; }
@media (max-width: 1180px) {
    .wd-kpis { grid-template-columns: repeat(2,1fr); }
    .wd-2col, .wd-3col { grid-template-columns: 1fr; }
    .wd-statrow { grid-template-columns: repeat(2,1fr); }
    .wd-keys, .wd-svc { grid-template-columns: 1fr 1fr; }
    .wd-pkgs { grid-template-columns: repeat(2,1fr); }
    .wd-vitals { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 768px) {
    .wd { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
    .wd-side { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
    .wd.side-open .wd-side { transform: none; } .wd.side-open .wd-scrim { display: block; }
    .wd-burger { display: inline-block; }
    .wd-crumb, .wd-status { display: none; }
    .wd-main { padding: 1.1rem; } .wd-title { font-size: 1.7rem; }
}
@media (max-width: 520px) {
    .wd-kpis, .wd-statrow, .wd-keys, .wd-svc, .wd-pkgs, .wd-vitals { grid-template-columns: 1fr; }
    .wd-user b, .wd-user small { display: none; }
}
