/* Shared modern skin (same look as the dashboard brief, profile modal and alerts panel).
   Loaded on every page after style.css: restyles Bootstrap components and adds the .ux-* building blocks. */
:root {
    --ux-bg-card: rgba(22, 18, 16, 0.92);
    --ux-bg-soft: rgba(255, 255, 255, 0.04);
    --ux-line: rgba(255, 255, 255, 0.1);
    --ux-line-strong: rgba(255, 255, 255, 0.2);
    --ux-accent: #ff6600;
    --ux-accent-2: #ff8800;
    --ux-text-dim: #94a3b8;
    --ux-ok: #34d399; --ux-warn: #ffb020; --ux-bad: #ff4d6d; --ux-info: #38bdf8;
    --ux-radius: 14px;
}

/* ---- Bootstrap components ---- */
.card.bg-dark, .card.bg-black { background: var(--ux-bg-card) !important; border: 1px solid var(--ux-line) !important; border-radius: var(--ux-radius); box-shadow: 0 6px 22px rgba(0,0,0,.45); }
.card > .card-header { background: linear-gradient(135deg, rgba(255,102,0,.10), rgba(255,102,0,.02)) !important; border-bottom: 1px solid var(--ux-line) !important; border-radius: var(--ux-radius) var(--ux-radius) 0 0 !important; }
.card > .card-footer { background: rgba(0,0,0,.25) !important; border-top: 1px solid var(--ux-line) !important; }
.form-control, .form-select { border-radius: 10px !important; border-color: var(--ux-line-strong) !important; }
.form-control:focus, .form-select:focus { border-color: var(--ux-accent) !important; box-shadow: 0 0 0 .2rem rgba(255,102,0,.18) !important; }
.form-check-input:checked { background-color: var(--ux-accent); border-color: var(--ux-accent); }
.form-check-input:focus { border-color: var(--ux-accent); box-shadow: 0 0 0 .2rem rgba(255,102,0,.2); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; cursor: pointer; }
.btn { border-radius: 10px; font-weight: 600; }
.btn-sm { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn-warning { background: linear-gradient(135deg, var(--ux-accent), var(--ux-accent-2)); border-color: #ffaa00; color: #000; }
.btn-warning:hover { filter: brightness(1.1); color: #000; }
.badge { border-radius: 999px; font-weight: 700; }
.alert { border-radius: 12px; border: 1px solid var(--ux-line); }
.modal-content { border-radius: 16px !important; border: 1px solid rgba(255,102,0,.4) !important; overflow: hidden; }
.modal-header { background: linear-gradient(135deg, rgba(255,102,0,.16), rgba(255,102,0,.03)) !important; border-bottom: 1px solid var(--ux-line) !important; }
.modal-footer { background: rgba(0,0,0,.28) !important; border-top: 1px solid var(--ux-line) !important; }
.table-dark { --bs-table-bg: transparent; }
.table > thead > tr > th { font-size: .68rem; text-transform: uppercase; letter-spacing: .7px; color: var(--ux-text-dim) !important; font-weight: 700; border-bottom-color: var(--ux-line-strong) !important; }
.table-hover > tbody > tr:hover > * { background: rgba(255,102,0,.07) !important; }
.nav-tabs { border-bottom-color: var(--ux-line) !important; }
.dropdown-menu { border-radius: 12px; border-color: var(--ux-line-strong); box-shadow: 0 12px 30px rgba(0,0,0,.6); }

/* ---- Building blocks ---- */
.ux-page { max-width: 1000px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.ux-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.ux-head .ux-ico { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,102,0,.16); color: #ff8a33; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex: 0 0 auto; }
.ux-head h1 { font-size: 1.25rem; font-weight: 800; color: #fff; margin: 0; line-height: 1.2; }
.ux-head p { margin: 2px 0 0; font-size: .8rem; color: var(--ux-text-dim); }
.ux-head .ux-head-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* sticky pill tabs: sections of one long page */
.ux-tabs { position: sticky; top: 64px; z-index: 30; display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: .5rem; margin: 0 0 1rem; border-radius: 14px; background: rgba(13,9,6,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--ux-line); }
.ux-tabs::-webkit-scrollbar { display: none; }
.ux-tabs button, .ux-tabs a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .95rem; border-radius: 10px; border: 1px solid transparent; background: transparent; color: #cbd5e1; font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: all .15s; }
.ux-tabs button:hover, .ux-tabs a:hover { background: rgba(255,255,255,.07); color: #fff; }
.ux-tabs button.active, .ux-tabs a.active { background: rgba(255,102,0,.2); border-color: var(--ux-accent); color: #fff; }
.ux-tabs em { font-style: normal; font-size: .68rem; padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.14); }
.ux-tabs button.active em, .ux-tabs a.active em { background: var(--ux-accent); color: #000; }
@media (max-width: 575.98px) { .ux-tabs { top: 56px; } .ux-tabs button span, .ux-tabs a span { font-size: .78rem; } }

.ux-sec { background: var(--ux-bg-card); border: 1px solid var(--ux-line); border-radius: var(--ux-radius); margin-bottom: 1rem; overflow: hidden; box-shadow: 0 6px 22px rgba(0,0,0,.4); }
.ux-sec > header { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--ux-line); background: linear-gradient(135deg, rgba(255,102,0,.09), rgba(255,102,0,.015)); }
.ux-sec > header h2 { font-size: .88rem; font-weight: 800; margin: 0; color: #fff; }
.ux-sec > header small { color: var(--ux-text-dim); font-size: .72rem; }
.ux-sec > header .ux-sec-ico { color: #ff8a33; font-size: 1.1rem; }
.ux-sec > header .ms-auto { margin-left: auto; }
.ux-sec > .ux-body { padding: 1rem 1.1rem; }
.ux-sec > footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem; border-top: 1px solid var(--ux-line); background: rgba(0,0,0,.25); }

/* a setting: title + help on the left, control on the right */
.ux-row { display: flex; align-items: center; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--ux-line); }
.ux-row:last-child { border-bottom: 0; }
.ux-row .ux-row-text { flex: 1; min-width: 0; }
.ux-row .ux-row-text b { display: block; font-size: .88rem; color: #fff; font-weight: 700; }
.ux-row .ux-row-text small { display: block; margin-top: 2px; font-size: .74rem; color: var(--ux-text-dim); line-height: 1.35; }
.ux-row .ux-row-ctl { flex: 0 0 auto; }
@media (max-width: 575.98px) { .ux-row { flex-wrap: wrap; } .ux-row .ux-row-ctl { width: 100%; } .ux-row .ux-row-ctl.ux-switch { width: auto; } }

/* radio cards */
.ux-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .7rem; }
.ux-choice { position: relative; display: flex; flex-direction: column; gap: 3px; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--ux-line-strong); background: var(--ux-bg-soft); cursor: pointer; margin: 0; transition: all .15s; }
.ux-choice:hover { border-color: rgba(255,102,0,.6); }
.ux-choice input { position: absolute; opacity: 0; pointer-events: none; }
.ux-choice b { font-size: .86rem; color: #fff; } .ux-choice span { font-size: .74rem; color: var(--ux-text-dim); line-height: 1.35; }
.ux-choice:has(input:checked) { border-color: var(--ux-accent); background: rgba(255,102,0,.12); box-shadow: 0 0 0 1px var(--ux-accent) inset; }
.ux-choice:has(input:checked)::after { content: '✓'; position: absolute; top: 8px; right: 12px; color: #ff8a33; font-weight: 800; }

.ux-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--ux-bg-soft); border: 1px solid var(--ux-line-strong); color: #e2e8f0; }
.ux-chip.sector { background: rgba(8,145,178,.25); border-color: #22d3ee; } .ux-chip.country { background: rgba(5,150,105,.25); border-color: #34d399; }
.ux-chip.role-owner { background: rgba(255,102,0,.2); border-color: var(--ux-accent); } .ux-chip.role-admin { background: rgba(56,189,248,.18); border-color: var(--ux-info); }
.ux-chip.role-analyst { background: rgba(52,211,153,.15); border-color: var(--ux-ok); } .ux-chip.role-viewer { background: rgba(148,163,184,.15); border-color: #94a3b8; }

.ux-stat { display: flex; flex-direction: column; padding: .7rem .9rem; border-radius: 12px; background: var(--ux-bg-soft); border: 1px solid var(--ux-line); border-top: 3px solid var(--c, var(--ux-accent)); }
.ux-stat b { font-size: 1.5rem; line-height: 1.05; color: var(--c, #fff); font-weight: 800; } .ux-stat span { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ux-text-dim); }

/* people list: avatar + name + role, one row each (cards on phones) */
.ux-person { display: flex; align-items: center; gap: .8rem; padding: .75rem 1rem; border-bottom: 1px solid var(--ux-line); flex-wrap: wrap; }
.ux-person:last-child { border-bottom: 0; }
.ux-avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,102,0,.2); color: #ff8a33; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; flex: 0 0 auto; }
.ux-person .ux-p-main { flex: 1; min-width: 160px; } .ux-person .ux-p-main b { display: block; color: #fff; font-size: .88rem; } .ux-person .ux-p-main small { color: var(--ux-text-dim); font-size: .74rem; word-break: break-all; }
.ux-person .ux-p-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

.ux-empty { text-align: center; padding: 1.6rem 1rem; color: var(--ux-text-dim); font-size: .85rem; }
.ux-empty i { display: block; font-size: 1.8rem; margin-bottom: .4rem; color: var(--ux-ok); }

/* long text never makes a phone scroll sideways */
@media (max-width: 767.98px) { body { overflow-x: hidden; } .ux-page { padding: .75rem .75rem 3rem; } .table-responsive { -webkit-overflow-scrolling: touch; } }

/* dark controls on the redesigned pages (they no longer carry bg-black/text-white classes) */
.ux-page .form-control, .ux-page .form-select, .modal .form-select.ux-dark, .modal .form-control.ux-dark { background-color: #0a0807; color: #f1f5f9; border: 1px solid var(--ux-line-strong); }
.ux-page .form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.ux-page .form-control::placeholder { color: #64748b; }
.ux-page .form-select option { background: #14100d; color: #f1f5f9; }

footer small { display: block; white-space: normal; padding: 0 .75rem; line-height: 1.9; }

/* pills (bulk-config tabs etc.): same look as .ux-tabs, scrollable on phones */
.nav-pills { gap: .4rem; }
.nav-pills .nav-link { border-radius: 10px; border: 1px solid transparent; color: #cbd5e1; font-size: .84rem; font-weight: 700; }
.nav-pills .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-pills .nav-link.active { background: rgba(255,102,0,.2) !important; border-color: var(--ux-accent); color: #fff !important; }
@media (max-width: 767.98px) {
    .nav-pills.nav-fill, .nav-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .nav-pills::-webkit-scrollbar { display: none; }
    .nav-pills .nav-item { flex: 0 0 auto; }
    .nav-pills .nav-link { white-space: nowrap; }
}

/* the uppercase "operator console" page titles share one modern look */
h2.fw-light[style*="letter-spacing"], h2.text-info.fw-bold.uppercase, h2.text-warning.fw-bold.uppercase { font-size: 1.3rem; font-weight: 800 !important; letter-spacing: .6px !important; color: #fff !important; }
h2.fw-light[style*="letter-spacing"] .fw-bold, h2.text-info.fw-bold.uppercase .text-white { color: #ff8a33 !important; }
h2.fw-light[style*="letter-spacing"] > i { color: #ff8a33; }

/* phone: a page title never shares its row with action buttons (the title was squeezed to a few characters) */
@media (max-width: 767.98px) {
    .d-flex:has(> div > h2.fw-light[style*="letter-spacing"]), .d-flex:has(> div > h2.text-info.fw-bold.uppercase), .d-flex:has(> div > h1.fw-bold[style*="letter-spacing"]) { flex-direction: column; align-items: flex-start !important; }
}

/* compact toolbar + action buttons (alerts panel and monitoring config) */
.alerts-bar { display: flex; gap: .4rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; align-items: center; margin-bottom: 1rem; }
.alerts-bar::-webkit-scrollbar { display: none; }
.alerts-bar .grow { flex: 1 1 auto; min-width: 0; }
.al-tool { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.05); color: #e2e8f0; font-size: 0.8rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: all .15s; white-space: nowrap; }
.al-tool:hover { border-color: #ff6600; background: rgba(255,102,0,0.15); color: #fff; }
.al-tool i { color: #5ee0ff; font-size: 0.95rem; }
.al-tool em { font-style: normal; font-size: 0.7rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.12); color: #fff; }
.al-tool.warn { border-color: rgba(255,176,32,0.6); } .al-tool.warn i, .al-tool.warn em { color: #ffb020; }
.al-tool.primary { background: linear-gradient(135deg, #ff6600, #ff8800); border-color: #ffaa00; color: #000; } .al-tool.primary i { color: #000; }
@media (max-width: 575.98px) { .al-tool { padding: 0 10px; } .al-tool span:not(.grow) { display: none; } .al-tool.primary span { display: inline; } }
.al-acts { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.al-acts::-webkit-scrollbar { display: none; }
.al-acts form { display: block; margin: 0; flex: 0 0 auto; }
.al-act { display: inline-flex !important; align-items: center; gap: 5px; height: 30px; padding: 0 10px !important; font-size: .76rem !important; font-weight: 700; border-radius: 8px !important; white-space: nowrap; }
.al-act i { font-size: .9rem; }
.al-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: #cbd5e1; text-decoration: none; }
.al-active { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.al-active a { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; text-decoration: none; color: #fff; background: rgba(8,145,178,0.25); border: 1px solid rgba(34,211,238,0.5); }
.al-active a:hover { background: rgba(255,102,0,0.2); border-color: #ff6600; } .al-active a.on { background: rgba(255,102,0,0.25); border-color: #ff6600; }
@media (max-width: 575.98px) { .al-acts { gap: 4px; } .al-act { padding: 0 8px !important; font-size: .72rem !important; gap: 4px; } }

/* monitoring rules: one card per rule */
.mon-card { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 8px; border-radius: 12px; background: rgba(22,18,16,0.92); border: 1px solid rgba(255,255,255,0.09); border-left: 4px solid #38bdf8; }
.mon-card.off { opacity: .55; border-left-color: #64748b; }
.mon-ico { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(56,189,248,0.14); color: #5ee0ff; font-size: 1.1rem; flex: 0 0 auto; }
.mon-main { flex: 1; min-width: 0; }
.mon-val { font-family: ui-monospace, monospace; font-size: .8rem; color: #94a3b8; overflow-wrap: anywhere; }
.mon-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; width: 100%; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.mon-row .al-acts { margin-left: auto; }
.mon-row details { flex: 0 0 auto; margin: 0 !important; } .mon-row details[open] { flex: 1 1 100%; }
.mon-row details > summary { list-style: none; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.05); font-size: .76rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mon-row details > summary::-webkit-details-marker { display: none; }
.mon-row details[open] > summary { border-color: #ff6600; background: rgba(255,102,0,0.15); }
.mon-row .form-control { min-height: 30px; }
.mon-meter { display: flex; flex-direction: column; align-items: flex-end; min-width: 120px; }
.mon-meter b { font-size: 1.2rem; color: #fff; line-height: 1; } .mon-meter small { font-size: .66rem; text-transform: uppercase; letter-spacing: .6px; color: #94a3b8; }
.mon-meter .bar { width: 120px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); margin-top: 5px; overflow: hidden; } .mon-meter .bar i { display: block; height: 100%; background: linear-gradient(90deg,#ff6600,#ffaa00); }

.ux-tabs a > span { display: inline-flex; align-items: center; gap: .45rem; }
/* detection-settings summary is long (it states the whole policy): it gets its own full-width row and wraps */
.mon-row details[id^="rule-"] { flex: 1 1 100% !important; min-width: 0; }
.mon-row details[id^="rule-"] > summary { display: block; height: auto; min-height: 30px; padding: 6px 10px; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; max-width: 100%; }
.mon-row .form-control { max-width: 100%; }

/* monitoring: add-rule button, type filter */
.al-tool.add { border-color: rgba(52,211,153,.6); background: rgba(52,211,153,.12); } .al-tool.add i { color: #34d399; }
.al-tool.add[aria-expanded="true"] { background: rgba(52,211,153,.25); border-color: #34d399; }
.al-tool.add[aria-expanded="true"] i { transform: rotate(45deg); }
.al-tool.add i { transition: transform .2s; }
.mon-types { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.mon-pills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 767.98px) { .mon-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .mon-pills::-webkit-scrollbar { display: none; } }
.mon-pills > button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #cbd5e1; font-size: .78rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: all .15s; }
.mon-pills > button:hover { border-color: #ff6600; color: #fff; }
.mon-pills > button.on { background: rgba(255,102,0,.22); border-color: #ff6600; color: #fff; }
.mon-pills > button i { color: #5ee0ff; } .mon-pills > button.on i { color: #ffaa33; }
.mon-pills > button em { font-style: normal; font-size: .68rem; font-weight: 800; padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.14); }
.mon-pills > button.on em { background: #ff6600; color: #000; }
.mon-search { position: relative; width: 100%; max-width: 320px; }
.mon-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .8rem; }
.mon-search input { width: 100%; height: 32px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05); color: #fff; padding: 0 12px 0 30px; font-size: .78rem; outline: none; }
.mon-search input:focus { border-color: #ff6600; }
@media (max-width: 575.98px) { .mon-pills > button span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; } }

/* three fixed tabs (alerts panel + monitoring config): equal width, never scroll, same look on both pages */
.ux-tabs3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; margin: 0 0 1rem; border-radius: 14px; background: rgba(13,9,6,.92); border: 1px solid var(--ux-line); }
.ux-tabs3 a { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; height: 46px; padding: 0 10px; border-radius: 10px; border: 1px solid transparent; color: #cbd5e1; font-size: .86rem; font-weight: 700; text-decoration: none; transition: all .15s; }
.ux-tabs3 a:hover { background: rgba(255,255,255,.07); color: #fff; }
.ux-tabs3 a.active { background: rgba(255,102,0,.2); border-color: var(--ux-accent); color: #fff; box-shadow: 0 0 14px rgba(255,102,0,.18); }
.ux-tabs3 a > i { font-size: 1.05rem; color: #5ee0ff; flex: 0 0 auto; } .ux-tabs3 a.active > i { color: #ffaa33; }
.ux-tabs3 a > b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ux-tabs3 a > em { font-style: normal; font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff; flex: 0 0 auto; }
.ux-tabs3 a.active > em { background: var(--ux-accent); color: #000; }
.ux-tabs3 a > em.hot { background: #dc3545; color: #fff; }
@media (max-width: 575.98px) {
    .ux-tabs3 { gap: 4px; padding: 4px; }
    .ux-tabs3 a { flex-direction: column; gap: 1px; height: 56px; padding: 0 4px; font-size: .72rem; }
    .ux-tabs3 a > i { font-size: 1.1rem; }
    .ux-tabs3 a > em { position: absolute; top: 4px; right: 6px; font-size: .62rem; padding: 0 6px; }
}

@media (max-width: 420px) { .ux-head { flex-wrap: wrap; } .ux-head > div:nth-child(2) { flex: 1 1 140px; min-width: 0; } .ux-head .ux-head-actions { margin-left: 0; width: 100%; } .ux-head .mon-meter { align-items: flex-start; } }
