:root {
    --bg: #07111f;
    --panel: rgba(13, 23, 38, 0.82);
    --panel-solid: #0f1b2d;
    --border: rgba(148, 163, 184, 0.15);
    --text: #e5eef8;
    --muted: #91a3b7;
    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;
    --blue: #38bdf8;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Arial, sans-serif; background: radial-gradient(circle at top right, rgba(16,185,129,.15), transparent 25%), linear-gradient(160deg, #06101b, #0a1322 40%, #07111f 100%); color: var(--text); }
a { color: inherit; text-decoration: none; }
body { min-height: 100vh; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
    padding: 28px;
    border-right: 1px solid var(--border);
    background: rgba(4, 10, 18, .55);
    backdrop-filter: blur(16px);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 30px; }
.brand-mark {
    width: 48px; height: 48px; border-radius: 14px;
    display: grid; place-items: center; font-weight: 800;
    background: linear-gradient(135deg, #10b981, #22c55e);
    color: #04110c;
    box-shadow: 0 10px 25px rgba(16,185,129,.3);
}
.brand small { display: block; color: var(--muted); margin-top: 4px; }
.nav { display: grid; gap: 10px; }
.nav a {
    padding: 13px 15px; border-radius: 14px; color: #d7e4f1;
    border: 1px solid transparent; transition: .2s ease;
    background: rgba(255,255,255,0.02);
}
.nav a:hover { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.18); transform: translateX(2px); }
.sidebar-card {
    margin-top: 22px; padding: 18px; border-radius: 18px;
    background: linear-gradient(180deg, rgba(16,185,129,.12), rgba(56,189,248,.08));
    border: 1px solid rgba(255,255,255,.08);
    color: #d8e7f4; line-height: 1.6;
}

.content { padding: 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.topbar h1 { margin: 0; font-size: 32px; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
    padding: 12px 18px; border-radius: 14px; font-weight: 700; display: inline-flex;
    align-items: center; gap: 8px; border: 1px solid transparent; transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #10b981, #22c55e); color: #04110c; box-shadow: 0 12px 30px rgba(16,185,129,.25); }
.btn-secondary { background: rgba(255,255,255,.04); border-color: var(--border); color: var(--text); }
.btn-danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.22); color: #fecaca; }
.btn-link { color: #7dd3fc; }

.grid { display: grid; gap: 18px; }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 22px 0; }
.card-title { margin: 0; font-size: 18px; }
.card-body { padding: 22px; }
.metric .value { font-size: 34px; font-weight: 800; margin-top: 6px; }
.metric .hint { color: var(--muted); font-size: 14px; }
.metric.ok .value { color: #6ee7b7; }
.metric.warn .value { color: #fcd34d; }
.metric.down .value { color: #fda4af; }
.metric.info .value { color: #7dd3fc; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 14px; text-align: left; border-bottom: 1px solid rgba(148,163,184,.1); }
th { color: #a9bdd0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,.015); }

.status-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 700; border: 1px solid transparent;
}
.status-chip::before {
    content: ''; width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}
.status-chip.ok { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.24); color: #b7f7da; }
.status-chip.ok::before { background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.15); }
.status-chip.warn { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.24); color: #fde68a; }
.status-chip.warn::before { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.15); }
.status-chip.down { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.24); color: #fecaca; }
.status-chip.down::before { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
.status-chip.muted { background: rgba(148,163,184,.08); border-color: rgba(148,163,184,.2); color: #cbd5e1; }
.status-chip.muted::before { background: #94a3b8; }

.domain-link { color: #7dd3fc; font-weight: 700; }
.subtle { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; color: #d9e7f4; font-weight: 700; }
.field input, .field select, .field textarea {
    width: 100%; background: #000 !important; color: var(--text); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px 15px; outline: none; transition: .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(16,185,129,.45); box-shadow: 0 0 0 4px rgba(16,185,129,.08); }
.field.full { grid-column: 1 / -1; }
.switch { display: flex; align-items: center; gap: 12px; }
.flash {
    padding: 16px 18px; border-radius: 16px; margin-bottom: 22px; font-weight: 700;
    border: 1px solid transparent;
}
.flash.success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.24); color: #b7f7da; }
.flash.error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.24); color: #fecaca; }
.flash.info { background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.24); color: #bae6fd; }
.empty {
    padding: 36px; text-align: center; color: var(--muted);
    border: 1px dashed rgba(148,163,184,.2); border-radius: 18px;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.badge-outline {
    border: 1px solid rgba(125,211,252,.25); color: #bae6fd; padding: 4px 10px; border-radius: 999px; font-size: 12px;
}

@media (max-width: 1100px) {
    .grid-cols-4, .grid-cols-2, .form-grid { grid-template-columns: 1fr; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
    .topbar { flex-direction: column; align-items: flex-start; }
}


.inline-form { display: inline-flex; margin: 0; }
.user-pill {
    display: inline-flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 16px;
}
.user-pill__dot {
    width: 10px; height: 10px; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 0 4px rgba(16,185,129,.15);
}
.user-pill small { display: block; color: var(--muted); margin-top: 2px; }
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-shell {
    width: min(1080px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px;
}
.auth-panel {
    background: var(--panel); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow);
    backdrop-filter: blur(16px); padding: 34px;
}
.auth-panel--hero {
    background: linear-gradient(180deg, rgba(16,185,129,.16), rgba(56,189,248,.08)), var(--panel);
}
.auth-panel--hero h1 { font-size: 42px; line-height: 1.05; margin: 18px 0 14px; max-width: 520px; }
.auth-panel--hero p { color: #c6d5e4; line-height: 1.7; max-width: 520px; }
.brand-auth { margin-bottom: 18px; }
.auth-bullets { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.auth-panel h2 { margin: 0 0 10px; font-size: 28px; }
.auth-form { grid-template-columns: 1fr; margin-top: 24px; }
.btn-block { width: 100%; justify-content: center; }
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-panel--hero h1 { font-size: 34px; }
}


.nav a.is-active { background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.24); }
.card-narrow { max-width: 760px; }
.compact-form { max-width: 520px; }
.toolbar-card {
    display:flex; justify-content:space-between; gap:18px; align-items:center;
    padding:18px 22px; border:1px solid var(--border); border-radius: var(--radius);
    background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.toolbar-card__left, .toolbar-card__right { display:flex; gap:16px; align-items:center; flex-wrap:wrap; }
.filter-chips { display:flex; gap:10px; flex-wrap:wrap; }
.filter-chip {
    padding:10px 14px; border-radius:999px; border:1px solid var(--border);
    background: rgba(255,255,255,.03); color: var(--text); font-weight:700; font-size:14px;
}
.filter-chip.is-active { background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.26); color:#b7f7da; }
.refresh-badge {
    padding:10px 14px; border-radius:999px; border:1px solid rgba(125,211,252,.16);
    background: rgba(56,189,248,.08); color:#bae6fd; font-size:14px;
}
.toolbar-inline-form { display:flex; gap:10px; align-items:center; margin:0; }
.toolbar-inline-form select {
    background: rgba(255,255,255,.03); color: var(--text); border: 1px solid var(--border);
    border-radius: 12px; padding: 10px 12px; outline:none;
}
.toolbar-label { color:#d9e7f4; font-weight:700; font-size:14px; }
@media (max-width: 1100px) {
    .toolbar-card { flex-direction:column; align-items:flex-start; }
}


.card-header--stack { align-items: flex-start; gap: 12px; }
.card-footer {
    padding: 0 22px 22px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.pagination { display: flex; gap: 8px; flex-wrap: wrap; }
.page-link {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.03);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
}
.page-link.is-active { background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.26); color: #b7f7da; }
.page-link.is-disabled { opacity: .45; pointer-events: none; }
.pagination-summary { color: var(--muted); font-size: 14px; }
.toolbar-card__left--stack, .toolbar-card__right--stack { align-items: flex-start; }
.toolbar-search-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; width: 100%; }
.toolbar-search-form input[type="search"] {
    min-width: min(380px, 100%);
    flex: 1;
    background: rgba(255,255,255,.03);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
}
.toolbar-search-form input[type="search"]:focus { border-color: rgba(16,185,129,.45); box-shadow: 0 0 0 4px rgba(16,185,129,.08); }
.toolbar-actions-cluster { display: flex; gap: 10px; flex-wrap: wrap; }
.actions--compact { align-items: center; }
.modal-open { overflow: hidden; }
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 60;
}
.modal.is-open { display: flex; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, .72);
    backdrop-filter: blur(6px);
}
.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--panel-solid);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px;
}
.modal__dialog--wide { width: min(860px, 100%); }
.modal__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}
.modal__header h3 { margin: 0 0 6px; font-size: 24px; }
.modal__close {
    border: 1px solid var(--border);
    background: rgba(255,255,255,.03);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
}
@media (max-width: 1100px) {
    .card-footer { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 700px) {
    .toolbar-search-form input[type="search"] { min-width: 100%; }
    .modal { padding: 12px; }
    .modal__dialog, .modal__dialog--wide { width: 100%; padding: 18px; }
}

.inline-interval-form { display: grid; gap: 8px; margin-bottom: 8px; }
.inline-interval-form select {
    background: rgba(255,255,255,.03);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 110px;
}
.danger-box {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(239,68,68,.24);
    background: rgba(239,68,68,.08);
}
.danger-box strong { display:block; margin-bottom:6px; color:#fecaca; }


.metrics-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.analytics-layout { display:grid; grid-template-columns: 1.6fr .9fr; gap:18px; }
.analytics-stack { display:grid; gap:18px; }
.analytics-chart-card .card-body { padding-top: 8px; }
.line-chart { width:100%; height: 240px; background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)); border-radius: 18px; }
.chart-labels { display:grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap:10px; margin-top:16px; }
.chart-labels__item { text-align:center; }
.chart-labels__item strong { display:block; margin-bottom:4px; }
.chart-labels__item span { color: var(--muted); font-size: 13px; }
.channels-list { display:grid; gap:12px; }
.channel-row { display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; padding:12px 0; border-bottom:1px solid rgba(148,163,184,.1); }
.channel-row:last-child { border-bottom:0; }
.mini-bars { display:flex; align-items:flex-end; gap:12px; min-height:160px; }
.mini-bars__item { flex:1; display:grid; justify-items:center; gap:8px; }
.mini-bars__bar { width:100%; max-width:42px; border-radius:14px 14px 8px 8px; background: linear-gradient(180deg, rgba(99,102,241,.95), rgba(16,185,129,.85)); }
.mini-bars__item strong { font-size:13px; }
.mini-bars__item span { color:var(--muted); font-size:12px; }
.promo-card h3 { margin: 14px 0 10px; font-size: 26px; line-height:1.1; }
.import-template-list { margin:0; padding-left:18px; color: var(--muted); line-height: 1.7; }
@media (max-width: 1320px) {
    .metrics-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .analytics-layout { grid-template-columns: 1fr; }
    .metrics-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .metrics-five { grid-template-columns: 1fr; }
    .chart-labels { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .mini-bars { gap: 8px; }
}


.header-badges { display:flex; gap:10px; flex-wrap:wrap; }
.management-table td { vertical-align: top; }
.row-actions-stack { display:grid; gap:10px; min-width:220px; }
.row-actions-group { display:grid; gap:8px; }
.row-actions-label { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color: var(--muted); }

.actions--single-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.actions--single-row .inline-form {
    display: inline-flex;
}

/* Select base */
select,
.form-select,
select.form-control {
    background: #0f172a;
    color: #e5eef9;
    border: 1px solid #1f2a44;
    border-radius: 14px;
}

/* Opções do select nativo */
select option {
    background: #0b1220;
    color: #e5eef9;
}

/* Quando passar o mouse / focar */
select:focus,
.form-select:focus,
select.form-control:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}


/* Tom Select - controle */
.ts-control {
    background: #0f172a !important;
    border: 1px solid #1f2a44 !important;
    border-radius: 14px !important;
    color: #e5eef9 !important;
    min-height: 52px;
    padding: 10px 14px !important;
    box-shadow: none !important;
}

.ts-control input {
    color: #e5eef9 !important;
}

.ts-control .item {
    color: #e5eef9 !important;
}

/* Dropdown */
.ts-dropdown {
    background: #0b1220 !important;
    border: 1px solid #1f2a44 !important;
    border-radius: 14px !important;
    color: #e5eef9 !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35) !important;
    overflow: hidden;
}

.ts-dropdown .option,
.ts-dropdown .create {
    color: #e5eef9 !important;
    background: transparent !important;
    padding: 12px 14px !important;
}

.ts-dropdown .option.active,
.ts-dropdown .option:hover {
    background: #16233a !important;
    color: #ffffff !important;
}

.ts-dropdown .selected {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

.choices__inner {
    background: #0f172a !important;
    border: 1px solid #1f2a44 !important;
    color: #e5eef9 !important;
    border-radius: 14px !important;
    min-height: 52px;
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
    background: #0b1220 !important;
    border: 1px solid #1f2a44 !important;
    color: #e5eef9 !important;
    border-radius: 14px !important;
}

.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
    color: #e5eef9 !important;
    background: transparent !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background: #16233a !important;
    color: #ffffff !important;
}