:root {
    --sidebar-width: 272px;
    --page-bg: #020617;
    --page-bg-soft: #0f172a;
    --panel-bg: rgba(15, 23, 42, 0.72);
    --panel-bg-strong: rgba(15, 23, 42, 0.92);
    --panel-border: rgba(148, 163, 184, 0.14);
    --panel-shadow: 0 24px 60px rgba(2, 6, 23, 0.42);
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-soft: #cbd5e1;
    --primary-color: #60a5fa;
    --primary-strong: #2563eb;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --danger-color: #fb7185;
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34%),
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 30%),
        linear-gradient(180deg, #020617 0%, #081122 48%, #0f172a 100%);
}

.app-body {
    position: relative;
    overflow-x: hidden;
}

.app-bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}

.app-bg-orb-primary {
    top: -120px;
    right: -80px;
    width: 320px;
    height: 320px;
    background: rgba(59, 130, 246, 0.32);
}

.app-bg-orb-secondary {
    bottom: 80px;
    left: 18%;
    width: 260px;
    height: 260px;
    background: rgba(14, 165, 233, 0.18);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 28px 0 24px;
    background: rgba(2, 6, 23, 0.84);
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    backdrop-filter: blur(18px);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: #eff6ff;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}

.sidebar-footer-card {
    padding: 16px 18px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-footer-title {
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.users_page_head_block,
.messages_page_head_block,
.webhooks_page_head_block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 28px 32px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(18px);
}

.users_page_head_badge,
.messages_page_head_badge,
.webhooks_page_head_badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    margin-bottom: 14px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.16);
}

.users_page_head_title,
.messages_page_head_title,
.webhooks_page_head_title {
    margin: 0 0 12px;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.users_page_head_text,
.messages_page_head_text,
.webhooks_page_head_text {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.65;
}

.users_page_head_actions,
.webhooks_page_head_actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sidebar-footer-text {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.sidebar-nav {
    gap: 8px;
    padding: 0 12px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 16px;
    color: #94a3b8;
    border-radius: 14px;
    transition: all 0.25s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #f8fafc;
    background: rgba(59, 130, 246, 0.14);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.main-content {
    position: relative;
    z-index: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
}

.dashboard-shell {
    max-width: 1440px;
    margin: 0 auto;
}

.dashboard-hero,
.hero-health,
.hero-insight,
.metric-card,
.chart-card,
.table-card,
.devices-card,
.card,
.stat-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(18px);
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
    padding: 32px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(15, 23, 42, 0.5)),
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.72));
}

.hero-badge,
.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.16);
}

.hero-title {
    margin: 0 0 14px;
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.hero-text {
    max-width: 720px;
    margin: 0;
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-btn {
    min-width: 184px;
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary.hero-btn {
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.32);
}

.ghost-btn {
    border-color: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.36);
}

.ghost-btn:hover {
    border-color: rgba(96, 165, 250, 0.3);
    color: #f8fafc;
    background: rgba(59, 130, 246, 0.12);
}

.hero-grid,
.analytics-grid,
.operations-grid {
    display: grid;
    gap: 24px;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
}

.hero-health,
.hero-insight,
.chart-card,
.table-card,
.devices-card {
    padding: 26px;
}

.health-main-row,
.card-topline,
.device-item-head,
.metric-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.health-label,
.metric-title,
.chart-caption,
.meta-label {
    color: #94a3b8;
    font-size: 0.88rem;
}

.health-status-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.health-status-line h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #64748b;
    box-shadow: 0 0 0 6px rgba(100, 116, 139, 0.12);
}

.status-dot.is-online,
.health-pill.is-online {
    background: rgba(52, 211, 153, 0.16);
    color: #6ee7b7;
}

.status-dot.is-online {
    background: #34d399;
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.12);
}

.status-dot.is-warning,
.health-pill.is-warning {
    background: rgba(251, 191, 36, 0.16);
    color: #fde68a;
}

.status-dot.is-warning {
    background: #fbbf24;
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.12);
}

.status-dot.is-offline,
.health-pill.is-offline {
    background: rgba(251, 113, 133, 0.16);
    color: #fda4af;
}

.status-dot.is-offline {
    background: #fb7185;
    box-shadow: 0 0 0 6px rgba(251, 113, 133, 0.12);
}

.health-pill,
.metric-chip,
.device-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
}

.metric-chip.success {
    color: #86efac;
    background: rgba(34, 197, 94, 0.14);
}

.metric-chip.info {
    color: #7dd3fc;
    background: rgba(14, 165, 233, 0.14);
}

.metric-chip.warning {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.14);
}

.health-description {
    margin: 16px 0 22px;
    color: var(--text-soft);
    line-height: 1.6;
}

.health-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.health-meta-card,
.status-summary-item,
.device-item {
    padding: 16px 18px;
    background: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 18px;
}

.health-meta-card strong,
.metric-value {
    display: block;
    margin-top: 6px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.metric-value {
    margin: 18px 0 10px;
    font-size: clamp(2rem, 4vw, 2.6rem);
}

.metric-foot,
.hero-insight p,
.device-summary,
.device-subtitle,
.status-summary-item span {
    color: var(--text-muted);
    line-height: 1.55;
}

.insight-points {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.insight-point {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 15px 16px;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.09);
    border-radius: 18px;
}

.insight-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 14px;
    color: #dbeafe;
    font-size: 0.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.88), rgba(14, 165, 233, 0.72));
}

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

.metric-card {
    padding: 24px;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.metric-card:hover,
.chart-card:hover,
.table-card:hover,
.devices-card:hover,
.hero-health:hover,
.hero-insight:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 165, 250, 0.2);
}

.analytics-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
}

.chart-shell {
    position: relative;
    min-height: 320px;
    margin-top: 20px;
}

.chart-shell-sm {
    min-height: 250px;
}

.card-topline h3,
.hero-insight h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.status-summary {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.status-summary-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.operations-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
}

.dashboard-table-wrap {
    margin-top: 18px;
}

.dashboard-table {
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: rgba(148, 163, 184, 0.08);
    --bs-table-hover-color: #f8fafc;
    --bs-table-hover-bg: rgba(148, 163, 184, 0.05);
}

.dashboard-table thead th {
    padding-top: 0;
    padding-bottom: 14px;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom-width: 1px;
}

.dashboard-table tbody td {
    padding-top: 18px;
    padding-bottom: 18px;
    vertical-align: middle;
}

.table-link {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}

.table-link:hover {
    color: #dbeafe;
}

.mono-cell {
    font-variant-numeric: tabular-nums;
    color: #bfdbfe;
}

.message-cell {
    max-width: 380px;
    color: var(--text-soft);
}

.device-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.device-name {
    font-weight: 650;
    color: #f8fafc;
}

.device-subtitle {
    margin-top: 4px;
    font-size: 0.88rem;
}

.device-summary {
    margin: 14px 0 12px;
}

.device-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #94a3b8;
    font-size: 0.92rem;
}

.device-meta-row strong {
    color: #f8fafc;
}

.device-status.online {
    color: #86efac;
    background: rgba(34, 197, 94, 0.14);
}

.device-status.stale {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.14);
}

.device-status.offline {
    color: #fda4af;
    background: rgba(244, 63, 94, 0.14);
}

.empty-state,
.empty-table {
    padding: 28px 16px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state.compact {
    padding: 16px;
}

.table-actions button {
    margin-right: 5px;
}

.status-badge {
    font-size: 0.85rem;
    padding: 4px 8px;
}

.badge.bg-warning,
.badge.bg-info,
.badge.bg-primary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-secondary {
    padding: 8px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.reveal-up {
    animation: revealUp 0.7s ease both;
}

.delay-1 {
    animation-delay: 0.08s;
}

.delay-2 {
    animation-delay: 0.16s;
}

.delay-3 {
    animation-delay: 0.24s;
}

.delay-4 {
    animation-delay: 0.32s;
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal-up,
    .metric-card,
    .chart-card,
    .table-card,
    .devices-card,
    .hero-health,
    .hero-insight {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 1200px) {
    .hero-grid,
    .analytics-grid,
    .operations-grid,
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .dashboard-hero,
    .health-main-row,
    .card-topline,
    .device-item-head,
    .metric-head {
        flex-direction: column;
    }

    .hero-grid,
    .analytics-grid,
    .operations-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.devices-phone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
    gap: 28px;
    align-items: start;
}

.devices-filter-card .card-body {
    padding: 24px;
}

.phone-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.phone-frame {
    position: relative;
    width: 100%;
    max-width: 320px;
    padding: 14px;
    border-radius: 38px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.5);
}

.phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 120px;
    height: 22px;
    transform: translateX(-50%);
    border-radius: 0 0 18px 18px;
    background: rgba(2, 6, 23, 0.96);
    z-index: 2;
}

.phone-screen {
    position: relative;
    min-height: 520px;
    padding: 42px 18px 22px;
    border-radius: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 28%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.84));
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.phone-screen-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.phone-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.phone-status-pill.online {
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
}

.phone-status-pill.stale {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.15);
}

.phone-status-pill.offline {
    color: #fda4af;
    background: rgba(244, 63, 94, 0.15);
}

.phone-last-seen {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.phone-avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 24px;
    font-size: 2rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.phone-device-name {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.phone-device-id {
    margin-top: 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.86rem;
    word-break: break-all;
}

.phone-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 22px;
}

.phone-info-box,
.device-summary-card {
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.phone-info-box span,
.device-summary-card .meta-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 6px;
}

.phone-info-box strong,
.device-summary-card strong {
    display: block;
    color: #f8fafc;
    font-size: 0.95rem;
}

.phone-health-box {
    margin-top: 14px;
    padding: 16px;
    border-radius: 18px;
    color: var(--text-soft);
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.08);
    line-height: 1.55;
}

.phone-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}

.phone-actions .btn {
    min-height: 48px;
    border-radius: 16px;
    font-weight: 600;
}

/* --- SMS SEND MODULE WIDGET --- */
.send-module-card {
    background: rgba(6, 11, 25, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(2, 6, 23, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    overflow: hidden;
    position: relative;
}

.send-module-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 100%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, transparent 100%);
    pointer-events: none;
}

.send-module-header {
    padding: 24px 26px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.send-module-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.send-module-icon {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 0.9rem;
}

.send-module-body {
    padding: 24px 26px;
}

.send-input-group {
    margin-bottom: 20px;
}

.send-input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.send-control {
    width: 100%;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #f8fafc;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.send-control:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(2, 6, 23, 0.8);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.send-control::placeholder {
    color: #475569;
}

select.send-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

textarea.send-control {
    resize: none;
    min-height: 100px;
}

.send-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.char-counter {
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.char-counter.safe { color: #64748b; }
.char-counter.warn { color: #fbbf24; }
.char-counter.danger { color: #fb7185; }

.send-btn {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border: none;
    color: white;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.4);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.send-btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -9px;
    margin-left: -9px;
}

.send-btn.loading {
    color: transparent;
}

.send-btn.loading .spinner {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.operations-grid.with-send {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, 0.85fr);
}

@media (max-width: 1400px) {
    .operations-grid.with-send {
        grid-template-columns: 1fr 1fr;
    }
    .operations-grid.with-send .table-card {
        grid-column: span 2;
    }
}

@media (max-width: 992px) {
    .operations-grid.with-send {
        grid-template-columns: 1fr;
    }
    .operations-grid.with-send .table-card {
        grid-column: span 1;
    }
}

.phone-tone-online .phone-frame {
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.5), 0 0 0 1px rgba(34, 197, 94, 0.14);
}

.phone-tone-stale .phone-frame {
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.5), 0 0 0 1px rgba(251, 191, 36, 0.14);
}

.phone-tone-offline .phone-frame {
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.5), 0 0 0 1px rgba(244, 63, 94, 0.14);
}

.device-modal-content {
    background: rgba(2, 6, 23, 0.96);
    color: var(--text-primary);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.6);
}

.device-modal-header {
    padding: 24px 28px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.device-modal-body {
    padding: 20px 28px 28px;
}

.device-modal-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.device-summary-health,
.device-summary-id,
.device-modal-section {
    margin-top: 16px;
}

.device-summary-health,
.device-summary-id,
.device-modal-section {
    padding: 18px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.device-summary-id {
    color: var(--text-muted);
    word-break: break-all;
}

.device-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.device-modal-actions .btn {
    min-height: 44px;
    border-radius: 14px;
}

.secondary-actions .btn {
    background: rgba(15, 23, 42, 0.44);
}

.device-result-payload {
    margin: 12px 0 0;
    padding: 14px;
    overflow: auto;
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
}

@media (max-width: 992px) {
    .device-modal-summary-grid,
    .phone-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.page-hero-split {
    align-items: center;
}

.stats-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toolbar-card .card-body,
.page-table-card,
.warning-banner {
    padding: 24px;
}

.toolbar-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(18px);
}

.warning-banner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #fde68a;
    background: rgba(120, 53, 15, 0.22);
    border: 1px solid rgba(251, 191, 36, 0.22);
    border-radius: var(--radius-lg);
    box-shadow: var(--panel-shadow);
}

.warning-banner strong {
    color: #fef3c7;
}

.warning-banner span {
    color: #fcd34d;
}

.pagination-indicator {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.page-footer-controls {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.device-modal-footer {
    padding: 0 28px 28px;
    border-top: none;
}

.message-detail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.message-detail-block {
    padding: 16px 18px;
    color: var(--text-soft);
    line-height: 1.65;
    background: rgba(15, 23, 42, 0.52);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 18px;
    word-break: break-word;
}

@media (max-width: 992px) {
    .device-modal-summary-grid,
    .phone-info-grid,
    .message-detail-grid,
    .stats-grid-compact {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .dashboard-hero,
    .hero-health,
    .hero-insight,
    .metric-card,
    .chart-card,
    .table-card,
    .devices-card,
    .sidebar-footer-card,
    .devices-filter-card .card-body,
    .device-modal-header,
    .device-modal-body,
    .device-modal-section,
    .device-summary-health,
    .device-summary-id,
    .toolbar-card .card-body,
    .page-table-card,
    .warning-banner,
    .device-modal-footer {
        padding: 20px;
        border-radius: 20px;
    }

    .main-content {
        padding: 16px;
    }

    .hero-btn,
    .phone-actions,
    .phone-actions .btn {
        width: 100%;
    }

    .health-meta-grid,
    .device-modal-summary-grid,
    .phone-info-grid,
    .phone-actions,
    .message-detail-grid,
    .stats-grid-compact {
        grid-template-columns: 1fr;
    }

    .page-footer-controls {
        flex-direction: column;
    }

    .devices-phone-grid {
        justify-content: center;
    }
}

/* --- ТЕЛЕМЕТРИЯ УСТРОЙСТВ --- */

.phone-telemetry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.phone-telemetry-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.08);
    font-size: 0.82rem;
    color: var(--text-soft);
}

.phone-telemetry-item.full-width {
    grid-column: 1 / -1;
}

.phone-telemetry-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.phone-telemetry-value {
    font-weight: 700;
    color: #f8fafc;
    font-size: 0.85rem;
}

.phone-telemetry-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Батарея — прогресс-бар */
.battery-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.battery-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.12);
    overflow: hidden;
}

.battery-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.battery-bar-fill.level-high {
    background: linear-gradient(90deg, #34d399, #22c55e);
}

.battery-bar-fill.level-mid {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.battery-bar-fill.level-low {
    background: linear-gradient(90deg, #fb7185, #ef4444);
}

.battery-percent {
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.battery-percent.level-high { color: #34d399; }
.battery-percent.level-mid { color: #fbbf24; }
.battery-percent.level-low { color: #fb7185; }

/* Ошибки — подсветка */
.telemetry-errors {
    color: #fb7185;
    font-weight: 700;
}

.telemetry-errors-zero {
    color: #34d399;
}

/* Модалка — секция телеметрии */
.telemetry-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.telemetry-detail-card {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.telemetry-detail-card .meta-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-bottom: 6px;
}

.telemetry-detail-card strong {
    display: block;
    color: #f8fafc;
    font-size: 0.95rem;
}

.telemetry-detail-card.full-width {
    grid-column: 1 / -1;
}

.telemetry-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.no-telemetry-hint {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed rgba(148, 163, 184, 0.15);
    border-radius: 16px;
}

@media (max-width: 768px) {
    .telemetry-detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .phone-telemetry,
    .telemetry-detail-grid {
        grid-template-columns: 1fr;
    }
}
