/* =============================================================================
   notification.zeetsoft.com — operator console
   Self-contained on purpose: no CDN, no external font, no icon pack. Non-prod
   tiers serve their CDN from hosts that may not exist yet, and an operator
   console that loses its stylesheet exactly when a tier is misconfigured is
   worse than useless.
   ============================================================================= */

:root {
    --bg:          #f5f6fa;
    --surface:     #ffffff;
    --surface-2:   #fafbfd;
    --border:      #e3e6ee;
    --border-soft: #eef0f6;

    --text:        #1a1f36;
    --text-muted:  #6b7392;
    --text-faint:  #9aa1b9;

    --brand:       #4f46e5;
    --brand-dark:  #4338ca;
    --brand-soft:  #eef2ff;

    --ok:          #0f9d58;
    --ok-soft:     #e6f6ed;
    --warn:        #d97706;
    --warn-soft:   #fdf3e3;
    --bad:         #dc2626;
    --bad-soft:    #fdeaea;
    --info:        #2563eb;
    --info-soft:   #e8f0fe;

    --ch-email:    #2563eb;
    --ch-whatsapp: #25a35a;

    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 1px 2px rgba(26,31,54,.05), 0 4px 16px rgba(26,31,54,.06);
    --shadow-lg:   0 8px 32px rgba(26,31,54,.12);

    --sidebar-w:   244px;
    --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono:        ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #0f1220;
        --surface:     #171a2b;
        --surface-2:   #1d2135;
        --border:      #2a2f47;
        --border-soft: #232840;

        --text:        #e8eaf3;
        --text-muted:  #9aa2c0;
        --text-faint:  #6b7392;

        --brand:       #7c74f5;
        --brand-dark:  #6a61f0;
        --brand-soft:  #21213f;

        --ok-soft:     #12301f;
        --warn-soft:   #33240c;
        --bad-soft:    #351616;
        --info-soft:   #14224a;

        --shadow:      0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
        --shadow-lg:   0 8px 32px rgba(0,0,0,.45);
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .9rem; }

code, .mono { font-family: var(--mono); font-size: .82em; }

/* ---------- Shell ---------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.brand__mark {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), #8b5cf6);
    display: grid; place-items: center;
    color: #fff; flex: 0 0 32px;
}
.brand__name { font-weight: 680; font-size: .95rem; letter-spacing: -.01em; }
.brand__sub  { font-size: .68rem; color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase; }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav__label {
    font-size: .66rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
    color: var(--text-faint); padding: 12px 10px 6px;
}
.nav__item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 550;
    text-decoration: none; transition: background .12s, color .12s;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav__item.active { background: var(--brand-soft); color: var(--brand); }
.nav__item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav__badge {
    margin-left: auto; font-size: .68rem; font-weight: 650;
    background: var(--bad); color: #fff; border-radius: 999px; padding: 1px 7px;
}

.sidebar__foot {
    padding: 12px 16px; border-top: 1px solid var(--border-soft);
    font-size: .7rem; color: var(--text-faint); line-height: 1.5;
}
.sidebar__link { color: var(--text-muted); }
.sidebar__link:hover { color: var(--brand); }

/* ---------- Console gate ----------------------------------------------------
   What MainLayout renders instead of the console when the page load behind this
   circuit did not carry the access key. Centred and standalone: there is no
   shell to sit inside, because the shell is part of what is being withheld. */
.locked { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.locked__card {
    width: 100%; max-width: 400px; padding: 26px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 26px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__title p { margin: 2px 0 0; color: var(--text-muted); font-size: .82rem; }

.content { padding: 24px 26px 48px; max-width: 1440px; width: 100%; }

/* ---------- Cards & grid --------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card__head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.card__head h2 { flex: 1; min-width: 0; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack   { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Stat tiles ----------------------------------------------------- */

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat__label {
    font-size: .72rem; font-weight: 620; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-faint);
}
.stat__value { font-size: 1.9rem; font-weight: 680; letter-spacing: -.03em; margin-top: 4px; line-height: 1.1; }
.stat__hint  { font-size: .76rem; color: var(--text-muted); margin-top: 3px; }
.stat--ok   .stat__value { color: var(--ok); }
.stat--bad  .stat__value { color: var(--bad); }
.stat--info .stat__value { color: var(--info); }

/* ---------- Bars (channel / agent breakdown) ------------------------------- */

.bars { display: flex; flex-direction: column; gap: 11px; }
.bar__top { display: flex; align-items: baseline; gap: 8px; font-size: .82rem; margin-bottom: 4px; }
.bar__name { font-weight: 600; }
.bar__count { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar__track { height: 7px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.bar__fill  { height: 100%; border-radius: 999px; background: var(--brand); transition: width .3s ease; }
.bar__fill--email    { background: var(--ch-email); }
.bar__fill--whatsapp { background: var(--ch-whatsapp); }

/* ---------- Badges --------------------------------------------------------- */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: .72rem; font-weight: 620; white-space: nowrap;
    background: var(--surface-2); color: var(--text-muted);
    border: 1px solid var(--border);
}
.badge--ok   { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.badge--bad  { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge--info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge--live { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }
.badge--test { background: var(--info-soft); color: var(--info); border-color: transparent; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }

.chan { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .8rem; }
.chan::before { content: ""; width: 7px; height: 7px; border-radius: 2px; }
.chan--Email::before    { background: var(--ch-email); }
.chan--WhatsApp::before { background: var(--ch-whatsapp); }

/* ---------- Tables --------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.data th {
    text-align: left; font-size: .7rem; font-weight: 650; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-faint);
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
table.data td {
    padding: 11px 14px; border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
.td-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
    padding: 44px 20px; text-align: center; color: var(--text-faint);
}
.empty svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 10px; }
.empty p { margin: 0; font-size: .86rem; }

/* ---------- Forms ---------------------------------------------------------- */

.field { margin-bottom: 15px; }
.field > label {
    display: block; font-size: .76rem; font-weight: 620;
    color: var(--text-muted); margin-bottom: 6px;
}
.field__hint { font-size: .72rem; color: var(--text-faint); margin-top: 5px; }

input[type=text], input[type=email], input[type=search], input[type=password], select, textarea {
    width: 100%; padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font: inherit; font-size: .86rem;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
input:disabled, select:disabled, textarea:disabled {
    background: var(--surface-2); color: var(--text-faint); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 96px; font-family: inherit; }

.channel-picks { display: flex; flex-wrap: wrap; gap: 9px; }
.pick {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    font-weight: 600; font-size: .84rem; background: var(--surface);
    transition: border-color .12s, background .12s;
    user-select: none;
}
.pick:hover:not(.pick--off) { border-color: var(--brand); }
.pick input { accent-color: var(--brand); margin: 0; cursor: pointer; }
.pick--on  { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pick--off { opacity: .45; cursor: not-allowed; }
.pick--off input { cursor: not-allowed; }

.filters {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
    padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.filters .field { margin: 0; min-width: 150px; flex: 0 1 auto; }
.filters .field--grow { flex: 1 1 220px; }

/* ---------- Buttons -------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 17px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    font: inherit; font-size: .85rem; font-weight: 620;
    transition: background .12s, border-color .12s, opacity .12s;
}
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn--ghost { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn--sm { padding: 6px 12px; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

/* ---------- Alerts --------------------------------------------------------- */

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 15px; border-radius: var(--radius-sm);
    font-size: .85rem; border: 1px solid transparent;
}
.alert svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.alert--ok   { background: var(--ok-soft);   color: var(--ok); }
.alert--bad  { background: var(--bad-soft);  color: var(--bad); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }
.alert--info { background: var(--info-soft); color: var(--info); }
.alert strong { font-weight: 650; }

/* ---------- Client accordion ---------------------------------------------- */

.client { border-bottom: 1px solid var(--border-soft); }
.client:last-child { border-bottom: 0; }
.client__head {
    display: flex; align-items: center; gap: 14px;
    padding: 15px 18px; cursor: pointer; width: 100%;
    background: none; border: 0; font: inherit; color: inherit; text-align: left;
}
.client__head:hover { background: var(--surface-2); }
.client__avatar {
    width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
    display: grid; place-items: center; font-weight: 680; font-size: .82rem;
    background: var(--brand-soft); color: var(--brand);
}
.client__name { font-weight: 630; }
.client__meta { font-size: .76rem; color: var(--text-faint); }
.client__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.client__body { padding: 4px 18px 20px; background: var(--surface-2); }

.kv { display: grid; grid-template-columns: 165px 1fr; gap: 7px 16px; font-size: .82rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-all; }

.section-label {
    font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-faint); margin: 20px 0 9px;
}

/* ---------- Misc ----------------------------------------------------------- */

.spinner {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row--end { justify-content: flex-end; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 16px; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 2147483001;
    background: #fef3c7; color: #78350f; padding: 12px 20px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.15); font-size: .86rem;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; font-weight: 700; }

/* ---------- Responsive ----------------------------------------------------- */

@media (max-width: 1100px) {
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
    .nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
    .nav__label { display: none; }
    .nav__item { white-space: nowrap; }
    .sidebar__foot { display: none; }
    .content { padding: 18px 14px 40px; }
    .topbar { padding: 14px 16px; }
    .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dt { margin-top: 8px; }
}

@media print {
    .sidebar, .topbar, .filters, .btn { display: none !important; }
}
