/* A class that sets `display` outranks the UA's [hidden] rule, which silently broke
   the client chat popup and the nav drawer (both stayed on screen and ate clicks).
   Hidden means hidden, everywhere. */
[hidden] { display: none !important; }

/* ============================================================
   FiberBill ISP suite — shared FB-* component styles (SPINE)
   Pairs with includes/isp_ui.php + portal/assets/js/isp.js
   Works with the existing portal.css theme (light + dark).
   ============================================================ */

:root {
    --fb-primary: #0D9488;                     /* brand teal (fiber ink & optical aqua system) */
    --fb-primary-soft: rgba(13, 148, 136, .12);
    --fb-green: #16a34a;
    --fb-red: #dc2626;
    --fb-amber: #d97706;
    --fb-blue: #0369a1;                        /* informational sky — distinct from the brand teal */
    --fb-blue-soft: rgba(2, 132, 199, .12);
    --fb-gray: #6b7280;
    --fb-on-primary: #ffffff;
    --fb-card-bg: var(--card-bg, #ffffff);
    --fb-border: var(--border-color, rgba(0, 0, 0, .08));
    --fb-text: var(--text-color, #1f2937);
    --fb-muted: var(--text-muted, #6b7280);
}

[data-theme="dark"], .dark-theme {
    --fb-primary: #2DD4BF;
    --fb-primary-soft: rgba(45, 212, 191, .14);
    --fb-green: #4ade80;
    --fb-red: #f87171;
    --fb-amber: #fbbf24;
    --fb-blue: #38bdf8;
    --fb-blue-soft: rgba(56, 189, 248, .14);
    --fb-on-primary: #06231C;                  /* dark ink on the bright aqua */
    --fb-card-bg: var(--card-bg, #0E1D2A);
    --fb-border: var(--border-color, rgba(255, 255, 255, .08));
    --fb-text: var(--text-color, #e5e7eb);
    --fb-muted: var(--text-muted, #9ca3af);
}

/* ---------- FB-Card ---------- */
.fb-card {
    background: var(--fb-card-bg);
    border: 1px solid var(--fb-border);
    border-radius: 12px;
    margin-bottom: 1rem;
}
.fb-card-head {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--fb-border);
}
.fb-card-title { font-size: .95rem; font-weight: 600; color: var(--fb-text); }
.fb-card-body { padding: 1rem; }

/* ---------- FB-Table ---------- */
.fb-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.fb-table { font-size: .875rem; color: var(--fb-text); }
.fb-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--fb-card-bg);
    border-bottom: 2px solid var(--fb-border);
    font-weight: 600; white-space: nowrap;
}
.fb-table-scroll { max-height: 70vh; overflow: auto; border: 1px solid var(--fb-border); border-radius: 8px; }
.fb-sortable { cursor: pointer; user-select: none; }
.fb-sortable:hover { color: var(--fb-primary); }
.fb-sort-ind::after { content: '↕'; opacity: .35; font-size: .75em; margin-left: 2px; }
.fb-sortable.fb-sort-asc .fb-sort-ind::after { content: '↑'; opacity: 1; }
.fb-sortable.fb-sort-desc .fb-sort-ind::after { content: '↓'; opacity: 1; }
.fb-table-pager { display: flex; gap: 4px; }
.fb-table-pager button {
    border: 1px solid var(--fb-border); background: var(--fb-card-bg); color: var(--fb-text);
    border-radius: 6px; min-width: 32px; height: 30px; font-size: .8rem; cursor: pointer;
}
.fb-table-pager button.active { background: var(--fb-primary); border-color: var(--fb-primary); color: var(--fb-on-primary); }
.fb-table-pager button:disabled { opacity: .4; cursor: default; }

/* ---------- FB-Chip / status ---------- */
.fb-chip {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: .72rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.fb-chip-green { background: rgba(22, 163, 74, .14); color: var(--fb-green); }
.fb-chip-red { background: rgba(220, 38, 38, .14); color: var(--fb-red); }
.fb-chip-amber { background: rgba(217, 119, 6, .16); color: var(--fb-amber); }
.fb-chip-blue { background: var(--fb-blue-soft); color: var(--fb-blue); }
.fb-chip-gray { background: rgba(107, 114, 128, .16); color: var(--fb-gray); }

/* ---------- FB-Secret ---------- */
.fb-secret { display: inline-flex; align-items: center; gap: 6px; font-family: monospace; }
.fb-secret-value { letter-spacing: 2px; }
.fb-secret-eye, .fb-secret-copy { color: var(--fb-muted); line-height: 1; }
.fb-secret-eye:hover, .fb-secret-copy:hover { color: var(--fb-primary); }
.fb-secret.fb-revealed .fb-secret-value { letter-spacing: 0; color: var(--fb-amber); }

/* ---------- FB-Empty ---------- */
.fb-empty-icon { font-size: 44px; color: var(--fb-muted); opacity: .7; }
.fb-empty-title { color: var(--fb-text); }

/* ---------- FB-Wizard ---------- */
.fb-wizard-steps {
    display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 1.25rem;
    counter-reset: step; flex-wrap: wrap;
}
.fb-wizard-step {
    flex: 1 1 0; display: flex; align-items: center; gap: 8px;
    padding: .5rem .75rem; border-bottom: 3px solid var(--fb-border);
    color: var(--fb-muted); font-size: .82rem; min-width: 140px;
}
.fb-wizard-step.active { border-bottom-color: var(--fb-primary); color: var(--fb-text); font-weight: 600; }
.fb-wizard-step.done { border-bottom-color: var(--fb-green); color: var(--fb-green); }
.fb-wizard-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%; font-size: .75rem; font-weight: 700;
    background: var(--fb-border); color: var(--fb-text);
}
.fb-wizard-step.active .fb-wizard-num { background: var(--fb-primary); color: var(--fb-on-primary); }
.fb-wizard-step.done .fb-wizard-num { background: var(--fb-green); color: #fff; }

/* ---------- FB-RouterScope pill ---------- */
.fb-scope-pill {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--fb-border); border-radius: 999px;
    background: var(--fb-card-bg); color: var(--fb-text);
    padding: 4px 12px; font-size: .8rem; cursor: pointer; max-width: 220px;
}
.fb-scope-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fb-dot-green { background: var(--fb-green); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.fb-dot-red { background: var(--fb-red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.fb-dot-gray { background: var(--fb-gray); }
.fb-via-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; border-radius: 4px; margin-left: 4px;
    background: var(--fb-primary-soft); color: var(--fb-primary);
    font-size: .62rem; font-weight: 700;
}
.fb-router-scope .dropdown-item { font-size: .82rem; display: flex; align-items: center; gap: 8px; }

/* ---------- FB-GlobalSearch ---------- */
.fb-global-search { position: relative; }
.fb-gs-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--fb-border); border-radius: 8px;
    background: var(--fb-card-bg); color: var(--fb-muted);
    padding: 4px 10px; font-size: .8rem; cursor: pointer;
}
.fb-gs-btn kbd {
    font-size: .62rem; background: var(--fb-border); color: var(--fb-muted);
    padding: 1px 5px; border-radius: 4px;
}
.fb-gs-panel { min-width: 340px; padding: 8px; }
.fb-gs-panel.show { display: block; }
.fb-gs-results { max-height: 50vh; overflow: auto; margin-top: 6px; }
.fb-gs-group {
    font-size: .68rem; font-weight: 700; text-transform: uppercase;
    color: var(--fb-muted); padding: 6px 8px 2px;
}
.fb-gs-item { display: block; padding: 6px 8px; border-radius: 6px; text-decoration: none; color: var(--fb-text); }
.fb-gs-item:hover, .fb-gs-item.active { background: var(--fb-primary-soft); }
.fb-gs-item .small { color: var(--fb-muted); }

/* ---------- Bell + badges + portal link ---------- */
.fb-bell { position: relative; }
.fb-bell-btn {
    position: relative; border: none; background: transparent; color: var(--fb-muted);
    font-size: 20px; cursor: pointer; padding: 4px;
}
.fb-bell-btn:hover { color: var(--fb-primary); }
.fb-bell-count {
    position: absolute; top: -2px; right: -4px;
    background: #DC2626; color: #fff; border-radius: 999px;
    font-size: .6rem; font-weight: 700; min-width: 16px; height: 16px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}
.fb-nav-badge {
    margin-left: auto; background: #DC2626; color: #fff;
    border-radius: 999px; font-size: .62rem; font-weight: 700; letter-spacing: 0;
    min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
    box-shadow: 0 0 0 2px rgba(7, 20, 32, .55);
}
.fb-portal-link { display: inline-flex; align-items: center; gap: 2px; }
.fb-portal-link a, .fb-portal-link button, a.fb-portal-link {
    border: none; background: transparent; color: var(--fb-muted);
    font-size: 18px; cursor: pointer; padding: 4px; text-decoration: none;
}
.fb-portal-link a:hover, .fb-portal-link button:hover, a.fb-portal-link:hover { color: var(--fb-primary); }

/* ---------- FB-Typeahead ---------- */
.fb-typeahead { position: relative; }
.fb-ta-results { width: 100%; max-height: 260px; overflow: auto; }
.fb-ta-results.show { display: block; }
.fb-ta-item { display: block; padding: 6px 10px; cursor: pointer; color: var(--fb-text); }
.fb-ta-item:hover, .fb-ta-item.active { background: var(--fb-primary-soft); }
.fb-ta-item .small { color: var(--fb-muted); display: block; }
.fb-ta-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.fb-ta-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--fb-primary-soft); color: var(--fb-primary);
    border-radius: 999px; font-size: .75rem; padding: 2px 8px;
}
.fb-ta-chip button { border: none; background: none; color: inherit; cursor: pointer; padding: 0; font-size: .8rem; }

/* ---------- FB-Toast ---------- */
.fb-toast-holder {
    position: fixed; right: 16px; bottom: 16px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.fb-toast {
    background: var(--fb-card-bg); color: var(--fb-text);
    border: 1px solid var(--fb-border); border-left: 4px solid var(--fb-primary);
    border-radius: 8px; padding: 10px 14px; font-size: .85rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    animation: fbToastIn .18s ease-out;
}
.fb-toast.fb-toast-success { border-left-color: var(--fb-green); }
.fb-toast.fb-toast-error { border-left-color: var(--fb-red); }
@keyframes fbToastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- FB-Confirm (typed keyword) ---------- */
.fb-confirm-summary {
    background: rgba(220, 38, 38, .08); border: 1px solid rgba(220, 38, 38, .25);
    border-radius: 8px; padding: 10px 12px; font-size: .85rem; color: var(--fb-text);
}
.fb-confirm-keyword-label { font-size: .8rem; color: var(--fb-muted); margin-top: 10px; }
.fb-confirm-keyword-label code { color: var(--fb-red); font-weight: 700; }

/* ---------- Dashboard router strip ---------- */
.fb-router-strip {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
    font-size: .8rem; color: var(--fb-text);
}
.fb-router-strip .fb-strip-item { display: flex; flex-direction: column; }
.fb-router-strip .fb-strip-label { font-size: .65rem; text-transform: uppercase; color: var(--fb-muted); }
.fb-strip-stale { color: var(--fb-amber); font-size: .72rem; }

/* ---------- Misc ---------- */
.fb-mono { font-family: monospace; }
.fb-amount-debit { color: var(--fb-red); font-weight: 600; }
.fb-amount-credit { color: var(--fb-green); font-weight: 600; }
.fb-strike { text-decoration: line-through; opacity: .55; }

/* Subscriber view "Edit Details" — orange in dark mode (owner 2026-08-18) */
[data-theme="dark"] .fb-edit-details {
    color: #fd7e14;
    border-color: #fd7e14;
}
[data-theme="dark"] .fb-edit-details:hover,
[data-theme="dark"] .fb-edit-details:focus {
    background: #fd7e14;
    border-color: #fd7e14;
    color: #fff;
}
