/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #2563eb;
    --primary-blue-dark: #1d4ed8;
    --primary-blue-light: #60a5fa;
    --bg-gray: #f5f5f7;
    --card-white: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-gray: #e5e7eb;
    --green: #10b981;
    --green-bg: #d1fae5;
    --red: #ef4444;
    --red-bg: #fee2e2;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary-blue: #3b82f6;
    --primary-blue-dark: #2563eb;
    --primary-blue-light: #60a5fa;
    --bg-gray: #0f172a;
    --card-white: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-gray: #334155;
    --green: #10b981;
    --green-bg: #064e3b;
    --red: #ef4444;
    --red-bg: #7f1d1d;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--card-white);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-gray);
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.logo:hover {
    background: var(--bg-gray);
}

.logo img {
    height: 40px;
    width: auto;
    display: block;
}

/* Dark mode logo background */
[data-theme="dark"] .logo {
    background: white;
    padding: 8px 12px;
}

[data-theme="dark"] .logo:hover {
    background: #f9fafb;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-gray);
    border: 1px solid var(--border-gray);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--card-white);
    border-color: var(--text-tertiary);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

.btn-back {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-back:hover {
    background: var(--bg-gray);
    border-color: var(--text-tertiary);
}

/* Admin Menu Dropdown */
.admin-menu {
    position: relative;
}

.admin-menu-button {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.admin-menu-button:hover {
    background: var(--bg-gray);
    border-color: var(--text-tertiary);
}

.admin-menu-button svg {
    width: 16px;
    height: 16px;
}

.admin-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-white);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.admin-menu.active .admin-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.admin-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-gray);
}

.admin-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.admin-dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.admin-dropdown-item:hover {
    background: var(--bg-gray);
}

.admin-dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--primary-blue);
    flex-shrink: 0;
}

.admin-dropdown-item .item-text {
    flex: 1;
}

.admin-dropdown-item .item-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--primary-blue);
    color: white;
    border-radius: 12px;
    font-weight: 600;
}

.admin-dropdown-item.danger {
    color: var(--red);
}

.admin-dropdown-item.danger svg {
    color: var(--red);
}

/* Main Content */
.main-content {
    padding-bottom: 48px;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Card Styles */
.card {
    background: var(--card-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-gray);
    transition: all 0.2s;
}

.card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* Server Grid (Listing Page) */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.server-card {
    background: var(--card-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-gray);
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

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

.server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-gray);
}

.server-tag .tag-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.server-tag h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 4px 0 0 0;
    color: var(--text-primary);
}

.server-card-body {
    margin-bottom: 16px;
}

.server-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.server-card-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-gray);
}

.view-details {
    color: var(--primary-blue);
    font-size: 14px;
    font-weight: 600;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    gap: 6px;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.online {
    background: var(--green-bg);
    color: var(--green);
}

.status-badge.online::before {
    background: var(--green);
}

.status-badge.offline {
    background: var(--red-bg);
    color: var(--red);
}

.status-badge.offline::before {
    background: var(--red);
}

/* Server Detail Page Layout */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.card-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-value-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icon Buttons */
.icon-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all 0.2s;
    border-radius: 4px;
}

.icon-btn:hover {
    background: var(--bg-gray);
    color: var(--primary-blue);
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* SSH Card */
.ssh-card {
    margin-bottom: 24px;
}

.ssh-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ssh-header h3 {
    margin-bottom: 4px;
}

.text-sm {
    font-size: 14px;
}

.text-red {
    color: var(--red);
}

.settings-btn {
    padding: 8px;
}

/* Two Column Grid */
.two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-gray);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--primary-blue);
}

/* Speed Test Metrics */
.speed-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-icon.download {
    background: #dbeafe;
    color: var(--primary-blue);
}

.metric-icon.upload {
    background: #fce7f3;
    color: #ec4899;
}

.metric-icon.ping {
    background: #d1fae5;
    color: var(--green);
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
}

.btn-primary:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-secondary:hover {
    background: var(--primary-blue);
    color: white;
}

/* Three Column Grid */
.three-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* Info List */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 8px 0;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--border-gray);
}

.info-row .info-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.info-row .info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.cpu-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Monitoring Section */
.section-subtitle {
    font-size: 16px;
    font-weight: 600;
    margin: 32px 0 16px 0;
    color: var(--text-primary);
    padding-top: 24px;
    border-top: 1px solid var(--border-gray);
}

.section-subtitle:first-of-type {
    border-top: none;
    margin-top: 24px;
}

.monitoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 32px;
    margin-bottom: 24px;
}

.monitor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Progress Ring */
.progress-ring {
    position: relative;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-circle-bg {
    fill: none;
    stroke: var(--border-gray);
    stroke-width: 8;
}

.progress-ring-circle {
    fill: none;
    stroke: var(--primary-blue);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}

/* Dark mode adjustments for progress rings */
[data-theme="dark"] .power-indicator circle {
    fill: #1e293b;
}

.progress-text {
    font-size: 24px;
    font-weight: 700;
    fill: var(--text-primary);
    text-anchor: middle;
    transform: rotate(90deg);
    transform-origin: center;
}

.progress-label {
    font-size: 12px;
    font-weight: 600;
    fill: var(--text-secondary);
    text-anchor: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transform: rotate(90deg);
    transform-origin: center;
}

.monitor-detail {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Power Indicator */
.power-indicator {
    position: relative;
}

/* Throughput Grid */
.throughput-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.throughput-item {
    background: var(--bg-gray);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.throughput-icon {
    width: 40px;
    height: 40px;
    background: var(--card-white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 4px;
}

.throughput-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.throughput-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Temperature */
.temperature-item {
    background: var(--bg-gray);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.temperature-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.temp-icon {
    font-size: 20px;
}

.temperature-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Uptime */
.uptime-value {
    background: var(--bg-gray);
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .page-header h1 {
        font-size: 24px;
    }

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

    .overview-grid,
    .two-col-grid,
    .three-col-grid {
        grid-template-columns: 1fr;
    }

    .monitoring-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .card-value-large {
        font-size: 24px;
    }
}

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

/* ───────── Общо табло и допълнителни секции (Hope.Cloud v3) ───────── */
:root {
    --amber: #f59e0b;
    --amber-bg: #fef3c7;
    --grey-bg: #e5e7eb;
}
[data-theme="dark"] {
    --amber: #fbbf24;
    --amber-bg: #78350f;
    --grey-bg: #334155;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.summary-tile {
    background: var(--card-white);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}
.summary-tile .s-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.summary-tile .s-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.summary-tile .s-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.summary-tile.ok .s-value { color: var(--green); }
.summary-tile.warn .s-value { color: var(--amber); }
.summary-tile.bad .s-value { color: var(--red); }

.alert-banner {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 14px;
}
.alert-banner.warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 32px 0 16px;
}
.section-title h2 { font-size: 22px; font-weight: 700; }
.section-title a { font-size: 14px; font-weight: 600; color: var(--primary-blue); text-decoration: none; }

.meter { height: 6px; background: var(--grey-bg); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; background: var(--primary-blue); border-radius: 3px; }
.meter > span.hot { background: var(--amber); }
.meter > span.crit { background: var(--red); }
.meter-row { margin-top: 10px; font-size: 13px; }
.meter-row .meter-head { display: flex; justify-content: space-between; color: var(--text-secondary); }

.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.stream-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card-white);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stream-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stream-thumb { aspect-ratio: 16 / 9; background: var(--grey-bg); display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); font-size: 13px; font-weight: 600; }
.stream-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stream-body { padding: 12px 14px 14px; }
.stream-name { font-size: 15px; font-weight: 600; }
.stream-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stream-card .pill { position: absolute; top: 10px; right: 10px; }

.pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--grey-bg);
    color: var(--text-secondary);
}
.pill.st-ok { background: var(--green-bg); color: var(--green); }
.pill.st-warn { background: var(--amber-bg); color: var(--amber); }
.pill.st-bad { background: var(--red-bg); color: var(--red); }
.pill.st-muted { background: var(--grey-bg); color: var(--text-secondary); }

.section-card, .section-grid { margin-top: 24px; }
.info-value.wrap { white-space: normal; text-align: right; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.copyable { cursor: pointer; }
.copyable:hover { color: var(--primary-blue); }
.muted-inline { margin-left: 6px; font-size: 12px; color: var(--text-tertiary); }
.footnote { font-size: 12px; color: var(--text-tertiary); margin-top: 12px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-tertiary); padding: 8px 12px; border-bottom: 1px solid var(--border-gray); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-gray); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
.tile { background: var(--bg-gray); border-radius: 10px; padding: 10px 14px; }
.tile-label { font-size: 12px; color: var(--text-secondary); }
.tile-value { font-size: 18px; font-weight: 700; }

.port-toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border-gray); background: var(--card-white); color: var(--text-primary); border-radius: 20px; padding: 4px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.chip.active { background: var(--primary-blue); border-color: var(--primary-blue); color: #fff; }
.port-search { border: 1px solid var(--border-gray); background: var(--card-white); color: var(--text-primary); border-radius: 8px; padding: 6px 12px; font-size: 14px; font-family: inherit; min-width: 200px; }

details.more { margin-top: 16px; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--primary-blue); margin-bottom: 8px; }
.speedtest-frame { width: 100%; height: 540px; border: 1px solid var(--border-gray); border-radius: 10px; background: #fff; }

@media (max-width: 640px) {
    .data-table thead { display: none; }
    .data-table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: none; }
    .data-table td::before { content: attr(data-label); color: var(--text-tertiary); font-size: 12px; }
    .data-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border-gray); }
}

/* ───────── Графики ───────── */
.chart-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chart-head h3 { margin-bottom: 0; }
.chart-block { margin-top: 16px; }
.chart-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.chart-stat { font-weight: 400; font-size: 13px; color: var(--text-secondary); }
.legend { margin-left: 10px; font-weight: 400; font-size: 12px; color: var(--text-secondary); }
.legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: baseline; }
.chart-tip i { margin-left: 0; }
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid-line { stroke: var(--border-gray); stroke-width: 1; }
.chart-svg .axis-text { fill: var(--text-tertiary); font-size: 11px; font-family: inherit; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { opacity: 0.12; }
.chart-svg .cursor { stroke: var(--text-tertiary); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { display: none; position: absolute; top: 4px; background: var(--card-white); color: var(--text-primary); border: 1px solid var(--border-gray); border-radius: 8px; box-shadow: var(--shadow-md); padding: 6px 10px; font-size: 12px; line-height: 1.5; pointer-events: none; white-space: nowrap; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--text-tertiary); font-size: 14px; }

/* ───────── Форми и бутони (аларми) ───────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.field.check label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.form-input { width: 100%; border: 1px solid var(--border-gray); background: var(--card-white); color: var(--text-primary); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-family: inherit; }
.form-input:focus { outline: 2px solid var(--primary-blue-light); outline-offset: 0; }
.inline-form { display: inline; }
.btn-small { border: 1px solid var(--border-gray); background: var(--card-white); color: var(--text-primary); border-radius: 8px; padding: 4px 12px; font-size: 13px; font-family: inherit; cursor: pointer; }
.btn-small:hover { background: var(--bg-gray); }
.btn-small.danger { color: var(--red); border-color: var(--red); }
button.btn-primary { border: none; cursor: pointer; font-family: inherit; font-size: 14px; }
.add-row { display: grid; grid-template-columns: 2fr 1.2fr auto; gap: 12px; align-items: end; margin-top: 16px; }
.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 24px; font-weight: 600; font-size: 14px; background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }
@media (max-width: 640px) { .add-row { grid-template-columns: 1fr; } }

/* ───────── Начална страница: основно съдържание + дясна колона ───────── */
.header-actions a { text-decoration: none; white-space: nowrap; }
.header-actions .btn-secondary { width: auto; }

.home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}
.home-content { grid-column: 1; grid-row: 1; min-width: 0; }
.home-side {
    grid-column: 2; grid-row: 1;
    position: sticky; top: 16px;
    display: flex; flex-direction: column; gap: 16px;
}
.home-content .section-title:first-child, #liveMain > .section-title:first-child { margin-top: 0; }
.home-content .servers-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.side-tiles { display: flex; flex-direction: column; gap: 12px; }
.side-title { font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-tertiary); }
.side-updated { font-size: 12px; color: var(--text-tertiary); }
.home-side .summary-tile .s-value { font-size: 26px; }

.speed-card .s-label { margin-top: 4px; }
.speed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 8px; }
.speed-grid > div { background: var(--bg-gray); border-radius: 10px; padding: 8px 12px; }
.speed-grid .k { display: block; font-size: 12px; color: var(--text-secondary); }
.speed-grid .v { display: block; font-size: 16px; font-weight: 700; }
.speed-btn { width: 100%; margin: 12px 0 8px; }
.speed-btn:disabled { opacity: 0.6; cursor: default; }
.speed-err { color: var(--red); font-weight: 600; }

@media (max-width: 1100px) {
    .home-layout { grid-template-columns: minmax(0, 1fr); }
    .home-side, .home-content { grid-column: 1; position: static; }
    .home-side { grid-row: 1; }
    .home-content { grid-row: 2; }
    .side-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .side-tiles .side-title, .side-tiles .side-updated { grid-column: 1 / -1; }
}
