:root {
    --blue: #0066ff;
    --blue-glow: #00a8ff;
    --green: #39ff14;
    --green-soft: #32cd32;
    --dark: #030308;
    --card: rgba(10, 16, 40, 0.88);
    --card-soft: rgba(10, 16, 40, 0.72);
    --border: rgba(0, 168, 255, 0.24);
    --text: #f8fafc;
    --muted: rgba(226, 232, 240, 0.72);
    --danger: #ff6b7a;
    --warning: #fbbf24;
    --success: #86efac;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--dark);
    overflow-x: hidden;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 0%, #0a1030 0%, var(--dark) 55%);
    overflow: hidden;
}

.bg::before,
.bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 12s ease-in-out infinite;
}

.bg::before {
    width: 360px;
    height: 360px;
    top: -120px;
    left: -100px;
    background: var(--blue);
}

.bg::after {
    width: 300px;
    height: 300px;
    bottom: -80px;
    right: -80px;
    background: var(--green-soft);
    animation-delay: -5s;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.35;
    animation: float 14s ease-in-out infinite;
}

.bg-orb--1 {
    width: 220px;
    height: 220px;
    top: 28%;
    right: 8%;
    background: var(--blue-glow);
    animation-delay: -3s;
}

.bg-orb--2 {
    width: 180px;
    height: 180px;
    bottom: 18%;
    left: 12%;
    background: var(--green);
    animation-delay: -8s;
}

.bg-ring {
    position: absolute;
    top: 42%;
    left: 50%;
    width: min(95vw, 760px);
    height: min(95vw, 760px);
    transform: translate(-50%, -50%);
    border: 1px solid rgba(0, 168, 255, 0.1);
    border-radius: 50%;
    animation: spin 28s linear infinite;
}

.bg-scan {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 102, 255, 0.03) 45%,
        rgba(57, 255, 20, 0.05) 50%,
        rgba(0, 102, 255, 0.03) 55%,
        transparent 100%
    );
    background-size: 100% 220%;
    animation: scan 7s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(18px); }
}

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

@keyframes scan {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 0% 100%; }
}

@keyframes logo-glow {
    0%, 100% { filter: drop-shadow(0 0 16px rgba(0, 168, 255, 0.45)); }
    50% { filter: drop-shadow(0 0 26px rgba(57, 255, 20, 0.35)); }
}

.shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px 18px;
    border-right: 1px solid rgba(0, 168, 255, 0.14);
    background: rgba(3, 6, 18, 0.55);
    backdrop-filter: blur(14px);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding: 0 8px;
}

.sidebar__logo {
    width: 44px;
    height: auto;
    animation: logo-glow 4s ease-in-out infinite;
}

.sidebar__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.sidebar__subtitle {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(226, 232, 240, 0.82);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}

.nav__link:hover,
.nav__link.is-active {
    color: #fff;
    background: rgba(0, 102, 255, 0.14);
    border-color: rgba(0, 168, 255, 0.22);
}

.nav__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar__footer {
    margin-top: auto;
    padding: 18px 8px 8px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 168, 255, 0.12);
}

.user-chip__avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #031105;
    background: linear-gradient(135deg, var(--green-soft), var(--green));
}

.user-chip__name {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.user-chip__role {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar__left h1 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
}

.topbar__left p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); }

.btn--ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 168, 255, 0.18);
}

.btn--danger {
    color: #ffd5da;
    background: rgba(255, 107, 122, 0.12);
    border-color: rgba(255, 107, 122, 0.28);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(0, 168, 255, 0.12), transparent 70%);
    transform: translate(30%, -30%);
    pointer-events: none;
}

.stat-card--green::after {
    background: radial-gradient(circle, rgba(57, 255, 20, 0.12), transparent 70%);
}

.stat-card__label {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}

.stat-card__value {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.stat-card__meta {
    margin: 10px 0 0;
    font-size: 0.8rem;
    color: rgba(148, 163, 184, 0.9);
}

.stat-card__icon {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(0, 102, 255, 0.14);
    color: #7dd3fc;
}

.stat-card--green .stat-card__icon {
    background: rgba(57, 255, 20, 0.12);
    color: #86efac;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}

.panel-card {
    padding: 22px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.panel-card__subtitle {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge--success {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.badge--danger {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.badge--info {
    color: #bae6fd;
    background: rgba(14, 165, 233, 0.14);
    border: 1px solid rgba(14, 165, 233, 0.28);
}

.badge--warning {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.28);
}

.chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 220px;
    padding-top: 12px;
}

.chart__bar-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    height: 100%;
}

.chart__bar-meta {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.88);
}

.chart__bar-track {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.chart__bar {
    width: 100%;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(180deg, var(--blue-glow), var(--blue));
    box-shadow: 0 8px 24px rgba(0, 102, 255, 0.22);
    min-height: 8px;
    transition: height 0.4s ease;
}

.chart__bar.is-today {
    background: linear-gradient(180deg, #86efac, var(--green-soft));
    box-shadow: 0 8px 24px rgba(57, 255, 20, 0.18);
}

.chart__label {
    font-size: 0.74rem;
    color: var(--muted);
    text-align: center;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 168, 255, 0.1);
}

.status-item > .badge {
    margin-left: auto;
    flex-shrink: 0;
}

.status-item > div:nth-child(2) {
    flex: 1;
    min-width: 0;
}

.status-item__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(0, 102, 255, 0.12);
    color: #7dd3fc;
}

.status-item__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
}

.status-item__text {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.45;
}

.account-search {
    margin-bottom: 18px;
}

.account-search__label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.88);
}

.account-search__field {
    position: relative;
}

.account-search__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    color: rgba(148, 163, 184, 0.9);
    transform: translateY(-50%);
    pointer-events: none;
}

.account-search__input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border: 1px solid rgba(0, 168, 255, 0.22);
    border-radius: 12px;
    background: rgba(3, 8, 24, 0.72);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.account-search__input::placeholder {
    color: rgba(148, 163, 184, 0.72);
}

.account-search__input:focus {
    border-color: rgba(0, 168, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.account-search__meta {
    margin: 10px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.account-search-empty.hidden {
    display: none;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 168, 255, 0.1);
    font-size: 0.86rem;
}

.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table strong {
    font-weight: 700;
}

.empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.flash--success {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.flash--error {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.table-sub {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

.data-table--accounts td {
    vertical-align: middle;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.inline-form {
    margin: 0;
}

.btn--unlink {
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 107, 122, 0.35);
    background: rgba(255, 107, 122, 0.12);
    color: #ffd5da;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.btn--unlink:hover {
    transform: translateY(-1px);
    background: rgba(255, 107, 122, 0.2);
}

.btn--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--blue-glow), var(--blue));
    border-color: rgba(0, 168, 255, 0.35);
    box-shadow: 0 10px 24px rgba(0, 102, 255, 0.22);
}

.broadcast-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}

.broadcast-form__label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.broadcast-form__textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 168, 255, 0.22);
    border-radius: 12px;
    background: rgba(3, 8, 24, 0.72);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
    outline: none;
}

.broadcast-form__textarea:focus {
    border-color: rgba(0, 168, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.broadcast-form__meta {
    margin: 8px 0 16px;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: right;
}

.broadcast-progress {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 168, 255, 0.14);
}

.broadcast-progress.hidden,
.flash.hidden {
    display: none;
}

.broadcast-progress__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.broadcast-progress__track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.broadcast-progress__bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--blue-glow), var(--green-soft));
    transition: width 0.35s ease;
}

.broadcast-progress__meta {
    margin: 10px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.broadcast-info-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 0.9rem;
}

.broadcast-info-list strong {
    color: var(--text);
}

.broadcast-message-preview {
    display: inline-block;
    max-width: 320px;
    white-space: pre-wrap;
}

.text-success {
    color: #86efac;
    font-weight: 700;
}

.text-danger {
    color: #fca5a5;
    font-weight: 700;
}

@media (max-width: 960px) {
    .broadcast-grid {
        grid-template-columns: 1fr;
    }
}

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-field--full {
    grid-column: 1 / -1;
}

.settings-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
}

.settings-field input[type="text"],
.settings-field input[type="password"],
.settings-field input[type="number"],
.settings-field input[type="url"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0, 168, 255, 0.22);
    border-radius: 12px;
    background: rgba(3, 8, 24, 0.72);
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
}

.settings-field input:focus,
.settings-form__textarea:focus {
    border-color: rgba(0, 168, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.settings-field__help {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}

.settings-form__textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 168, 255, 0.22);
    border-radius: 12px;
    background: rgba(3, 8, 24, 0.72);
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    font-family: inherit;
}

.settings-form__textarea--code {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.82rem;
}

.settings-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

.settings-checkbox input {
    width: 18px;
    height: 18px;
}

@media (max-width: 860px) {
    .settings-form__grid {
        grid-template-columns: 1fr;
    }
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.mini-stat {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 168, 255, 0.1);
}

.mini-stat__label {
    margin: 0 0 6px;
    font-size: 0.76rem;
    color: var(--muted);
}

.mini-stat__value {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(0, 168, 255, 0.14);
    }

    .sidebar__footer {
        display: none;
    }

    .main {
        padding: 18px;
    }
}

@media (max-width: 560px) {
    .stats-grid,
    .mini-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
