/* ============================================
   MikroTik Monitoring - Custom Dark Theme CSS
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1923;
    --bg-secondary: #1a2736;
    --bg-card: #1e2d3d;
    --bg-card-hover: #243447;
    --bg-input: #162230;
    --border-color: #2a3f52;
    --border-focus: #0ea5e9;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #0ea5e9;
    --accent-hover: #38bdf8;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --sidebar-width: 250px;
    --header-height: 60px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.4);
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-brand small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    padding: 8px 20px 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(14, 165, 233, 0.05);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent);
    border-left-color: var(--accent);
}

.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    opacity: 0.8;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.content-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 18px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-header-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.content-header .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
}

.content-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 6px;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.35);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.mobile-nav-toggle:hover {
    border-color: rgba(14, 165, 233, 0.6);
    background: rgba(14, 165, 233, 0.2);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 23, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 95;
}

.header-clock {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.content-body {
    padding: 25px 30px;
}

/* Public Monitoring Layout */
.public-layout {
    min-height: 100vh;
}

.public-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.public-header-left {
    min-width: 0;
}

.public-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.public-body {
    padding: 24px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(14, 165, 233, 0.3);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: rgba(14, 165, 233, 0.15); color: var(--accent); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(42, 63, 82, 0.5);
    vertical-align: middle;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(14, 165, 233, 0.03);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a1a;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-green 2s infinite;
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Ping Monitor Cards */
.ping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.dashboard-tag-filter-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-tag-filter-wrap label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.dashboard-tag-filter-wrap .form-control {
    min-width: 170px;
    padding: 6px 10px;
    font-size: 12px;
}

.ping-group-section {
    margin-bottom: 20px;
}

.ping-group-title {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 6px 10px;
    border-left: 3px solid var(--accent);
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-sm);
}

.ping-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.ping-card.online {
    border-color: rgba(34, 197, 94, 0.3);
}

.ping-card.offline {
    border-color: rgba(239, 68, 68, 0.3);
}

.ping-card-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.ping-card-header .client-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ping-card-header .client-name {
    font-weight: 600;
    font-size: 14px;
}

.ping-card-header .client-ip {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.ping-card-header .client-router {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.ping-card-header .client-refresh {
    margin-top: 2px;
    font-size: 11px;
    color: rgba(148, 163, 184, 0.9);
}

.ping-card-header .client-tags-inline {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ping-card-header .latency {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    line-height: 1.2;
}

.ping-card-header .latency.good { color: var(--success); }
.ping-card-header .latency.medium { color: var(--warning); }
.ping-card-header .latency.bad { color: var(--danger); }
.ping-card-header .latency.dead { color: var(--danger); }

.ping-card-body {
    padding: 14px 18px;
}

.ping-history-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ping-metrics {
    margin-bottom: 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
}

.packet-loss-value {
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.packet-loss-value.good {
    color: var(--success);
}

.packet-loss-value.medium {
    color: var(--warning);
}

.packet-loss-value.bad {
    color: var(--danger);
}

.ping-line-wrap {
    height: 48px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.ping-line-chart-wrap {
    position: relative;
    width: 100%;
    height: 46px;
}

.ping-line-chart {
    width: 100%;
    height: 46px;
    overflow: visible;
}

.ping-axis {
    stroke: rgba(148, 163, 184, 0.3);
    stroke-width: 0.6;
}

.ping-gridline {
    stroke: rgba(148, 163, 184, 0.2);
    stroke-dasharray: 2 2;
    stroke-width: 0.5;
}

.ping-line {
    fill: none;
    stroke: var(--success);
    stroke-width: 1.6;
    vector-effect: non-scaling-stroke;
}

.ping-point.success {
    fill: var(--success);
}

.ping-point.fail {
    fill: var(--danger);
}

.ping-point {
    cursor: pointer;
    transition: r 0.15s ease, stroke 0.15s ease;
    stroke: rgba(255, 255, 255, 0);
    stroke-width: 0.8;
}

.ping-point:hover {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 1.2;
}

.ping-line-tooltip {
    position: absolute;
    z-index: 5;
    transform: translate(-50%, -100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

.ping-line-tooltip.show {
    opacity: 1;
}

.ping-history-list {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 132px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    scrollbar-width: thin;
    scrollbar-color: rgba(14, 165, 233, 0.65) rgba(15, 23, 42, 0.55);
}

.ping-history-list::-webkit-scrollbar {
    width: 8px;
}

.ping-history-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.55);
    border-radius: 999px;
}

.ping-history-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.9), rgba(14, 165, 233, 0.78));
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.25);
}

.ping-history-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(34, 211, 238, 1), rgba(14, 165, 233, 0.92));
}

.ping-history-item {
    padding: 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.15);
}

.ping-history-time {
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.ping-history-value {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.ping-history-item.success .ping-history-value {
    color: var(--success);
}

.ping-history-item.fail .ping-history-value {
    color: var(--danger);
}

.ping-source-note {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
    margin-right: 4px;
    margin-bottom: 4px;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Device selector */
.device-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.device-selector label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.device-selector select {
    flex: 1;
    max-width: 400px;
}

/* Modal / Confirm */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-box h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.modal-box p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.ping-check-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.ping-cmd-output {
    margin: 0;
    background: #0b1622;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #dbe7f5;
    padding: 12px;
    min-height: 180px;
    max-height: 340px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.45;
}

.ping-cmd-summary {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Utility */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: 'Courier New', monospace; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none; }

.tag-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    margin-right: 8px;
    cursor: grab;
    color: var(--text-muted);
    user-select: none;
}

.tag-drag-handle:hover {
    color: var(--accent);
}

.tag-drag-handle.disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

#tags-body tr[data-tag-id] {
    cursor: default;
}

#tags-body tr[data-tag-id].tag-row-dragging {
    opacity: 0.55;
}

#tags-body tr[data-tag-id].tag-row-drop-before td {
    border-top: 2px solid var(--accent);
}

#tags-body tr[data-tag-id].tag-row-drop-after td {
    border-bottom: 2px solid var(--accent);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: min(84vw, 320px);
        z-index: 120;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        margin-left: 0;
    }

    .content-header {
        padding: 12px 14px;
        align-items: stretch;
        gap: 10px;
        flex-direction: column;
    }

    .content-header-left {
        width: 100%;
    }

    .content-header h1 {
        font-size: 18px;
        line-height: 1.2;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .content-header-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-clock {
        font-size: 12px;
    }

    .content-body {
        padding: 12px;
    }

    .public-header {
        padding: 12px 14px;
        flex-wrap: wrap;
    }

    .public-body {
        padding: 12px;
    }

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

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

    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .card-header > * {
        width: 100%;
    }

    .card-header [style*="min-width:320px"] {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .dashboard-tag-filter-wrap {
        width: 100%;
        flex-wrap: wrap;
    }

    .dashboard-tag-filter-wrap .form-control {
        min-width: 0;
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .device-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .device-selector select {
        max-width: 100%;
    }

    .ping-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ping-card-header .latency {
        font-size: 16px;
    }

    .ping-metrics {
        flex-wrap: wrap;
        gap: 6px 10px;
    }

    .modal-box {
        width: calc(100% - 16px);
        max-height: calc(100vh - 24px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 900px) {
    .table-wrapper {
        overflow: visible;
    }

    .table-wrapper table,
    .table-wrapper thead,
    .table-wrapper tbody,
    .table-wrapper tr,
    .table-wrapper td {
        display: block;
        width: 100%;
    }

    .table-wrapper thead {
        display: none;
    }

    .table-wrapper tbody tr {
        margin-bottom: 10px;
        padding: 4px 10px;
        border: 1px solid rgba(42, 63, 82, 0.7);
        border-radius: var(--radius-sm);
        background: rgba(0, 0, 0, 0.12);
    }

    .table-wrapper tbody td {
        padding: 9px 0;
        font-size: 13px;
        border-bottom: 1px dashed rgba(148, 163, 184, 0.2);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

    .table-wrapper tbody td::before {
        content: attr(data-label);
        flex: 1;
        text-align: left;
        font-size: 10px;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
    }

    .table-wrapper tbody td:last-child {
        border-bottom: 0;
    }

    .table-wrapper tbody td[colspan],
    .table-wrapper tbody td[data-static="true"] {
        display: block;
        text-align: left;
    }

    .table-wrapper tbody td[colspan]::before,
    .table-wrapper tbody td[data-static="true"]::before {
        content: none;
    }

    .table-wrapper tbody td .btn-group {
        justify-content: flex-end;
    }
}

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

    thead th,
    tbody td {
        padding: 10px 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-info h4 {
        font-size: 20px;
    }

    .ping-card-header,
    .ping-card-body {
        padding: 12px;
    }

    .public-header h1 {
        font-size: 18px;
    }
}
