@font-face {
    font-family: 'Vazirmatn';
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
}

:root {
    --teal: #00C0C3;
    --teal-dark: #009496;
    --teal-light: #E4FBFB;
    --red: #E5484D;
    --red-light: #FDE9E9;
    --text: #1A2B2B;
    --text-muted: #6B8080;
    --border: #D6ECEC;
    --bg: #F4FBFB;
    --surface: #ffffff;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    direction: rtl;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

[data-theme="dark"] {
    --bg: #0B1414;
    --text: #E4FBFB;
    --text-muted: #7FA3A3;
    --border: #1F3A3A;
    --surface: #14201F;
    --teal-dark: #4DD8DA;
}

/* ---------- Color themes (accent color, independent of light/dark) ---------- */
[data-accent="blue"] { --teal: #3B82F6; --teal-dark: #1D4ED8; --teal-light: #EFF6FF; --bg: #F2F7FE; }
[data-theme="dark"][data-accent="blue"] { --teal-dark: #60A5FA; --bg: #0B1220; }

[data-accent="purple"] { --teal: #8B5CF6; --teal-dark: #6D28D9; --teal-light: #F5F3FF; --bg: #F8F5FE; }
[data-theme="dark"][data-accent="purple"] { --teal-dark: #A78BFA; --bg: #130B1F; }

[data-accent="orange"] { --teal: #F97316; --teal-dark: #C2410C; --teal-light: #FFF7ED; --bg: #FFF8F1; }
[data-theme="dark"][data-accent="orange"] { --teal-dark: #FB923C; --bg: #1A100B; }

[data-accent="green"] { --teal: #22C55E; --teal-dark: #15803D; --teal-light: #F0FDF4; --bg: #F1FBF4; }
[data-theme="dark"][data-accent="green"] { --teal-dark: #4ADE80; --bg: #0B160F; }

[data-accent="pink"] { --teal: #EC4899; --teal-dark: #BE185D; --teal-light: #FDF2F8; --bg: #FEF3F8; }
[data-theme="dark"][data-accent="pink"] { --teal-dark: #F472B6; --bg: #1A0B14; }

[data-accent="indigo"] { --teal: #6366F1; --teal-dark: #4338CA; --teal-light: #EEF2FF; --bg: #F3F3FE; }
[data-theme="dark"][data-accent="indigo"] { --teal-dark: #818CF8; --bg: #0F0F1F; }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .icon-btn { background: var(--surface); }
[data-theme="dark"] .attention-banner { background: #2A1414; border-color: #4A2323; }
[data-theme="dark"] .attention-banner-title,
[data-theme="dark"] .attention-timer .time,
[data-theme="dark"] .attention-timer .label { color: #FF9B9B; }

.app-shell { display: flex; min-height: 100vh; }
.main-shell { flex: 1; min-width: 0; }

.sidebar-desktop { display: none; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}
.topbar .brand { font-weight: 700; color: var(--teal-dark); font-size: 18px; }

.desktop-only-date {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}
@media (min-width: 769px) { .desktop-only-date { display: block; } }

.datetime-chip {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg);
    border-radius: 999px;
    padding: 6px 8px 6px 16px;
}
.datetime-part {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--teal-dark); font-weight: 600;
}
.datetime-greg { font-size: 12px; color: var(--text-muted); }
.datetime-sep { width: 1px; height: 14px; background: var(--border); display: inline-block; }
.datetime-clock {
    display: flex; align-items: center; gap: 6px;
    background: var(--surface); border-radius: 999px; padding: 5px 12px;
    box-shadow: 0 1px 3px rgba(0, 150, 150, 0.15);
    color: var(--teal-dark);
}
.datetime-clock span { font-size: 13px; font-weight: 700; color: var(--teal-dark); font-variant-numeric: tabular-nums; }

.icon-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    background: var(--bg);
}
.icon-btn:hover { color: var(--teal-dark); background: var(--teal-light); }

.icon-btn-plain {
    width: 38px; height: 38px; border: none; background: none; padding: 0;
    -webkit-appearance: none; appearance: none;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); cursor: pointer;
}
.icon-btn-plain:hover { color: var(--teal-dark); }

.desktop-only-icon { display: none; }
@media (min-width: 769px) { .desktop-only-icon { display: flex; } }

.theme-swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-swatch-form { display: inline-block; }
.theme-swatch {
    width: 40px; height: 40px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.theme-swatch.active { border-color: var(--text); }

body.has-bottom-nav { padding-bottom: 76px; }

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    flex: 1;
    max-width: 110px;
}
.bottom-nav a.active { color: var(--teal-dark); }
.bottom-nav a:hover { color: var(--teal-dark); }

@media (min-width: 769px) {
    body.has-bottom-nav { padding-bottom: 0; }
    .bottom-nav { display: none; }
    .mobile-only-logout { display: none; }

    .sidebar-desktop {
        display: flex;
        flex-direction: column;
        width: 240px;
        flex-shrink: 0;
        background: var(--surface);
        border-left: 1px solid var(--border);
        height: 100vh;
        padding: 20px 16px;
        position: fixed;
        top: 0;
        right: 0;
        overflow-y: auto;
    }
    .main-shell { margin-right: 240px; }
    .sidebar-brand {
        font-weight: 700;
        color: var(--teal-dark);
        font-size: 16px;
        padding: 0 8px 18px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 12px;
    }
    .sidebar-desktop nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
    .sidebar-desktop nav a {
        display: flex; align-items: center; gap: 10px;
        padding: 10px 12px; border-radius: 12px;
        color: var(--text-muted); font-size: 14px; font-weight: 500;
    }
    .sidebar-desktop nav a:hover { background: var(--teal-light); color: var(--teal-dark); }
    .sidebar-desktop nav a.active { background: var(--teal-light); color: var(--teal-dark); }
    .sidebar-logout {
        display: flex; align-items: center; gap: 10px;
        padding: 10px 12px; border-radius: 12px;
        color: var(--text-muted); font-size: 13px; font-weight: 500;
        border-top: 1px solid var(--border); margin-top: 12px; padding-top: 16px;
    }
    .sidebar-logout:hover { color: var(--red); }

    .topbar { border-radius: 16px; margin: 20px 24px 0; border: 1px solid var(--border); border-bottom: 1px solid var(--border); }
    .topbar .brand { display: none; }
}

.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 18px;
}

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid-stats .card { margin-bottom: 0; }

.stat-box { text-align: center; padding: 14px; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--teal-dark); }
.stat-box .label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.site-card { display: block; }
.site-card .badge { margin-bottom: 10px; }
.site-card-body { display: flex; align-items: center; }

/* ---------- Dashboard overview (reference design) ---------- */
.overview-total { text-align: center; padding: 26px 20px; }
.icon-circle-lg {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--teal-light); color: var(--teal-dark);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
}
.overview-total .num { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.overview-total .label { color: var(--text-muted); font-size: 14px; }

.status-mini-card { text-align: center; padding: 18px; }
.status-mini-card .icon-wrap { margin-bottom: 10px; display: flex; justify-content: center; }
.status-mini-card .num { font-size: 22px; font-weight: 700; }
.status-mini-card .label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.status-dot.lg { width: 20px; height: 20px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 12px; }
.section-header h3 { margin: 0; font-size: 16px; }
.section-header a { color: var(--teal-dark); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 4px; }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; margin-inline-end: 4px; }
.badge-sm { font-size: 10px; padding: 2px 8px; }
.badge-sm .badge-dot { width: 5px; height: 5px; }

@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); }
    70% { box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 0%, transparent); }
}
.badge-dot.pulse { animation: pulseDot 1.6s ease-out infinite; }

.site-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.site-card-name-row { display: flex; align-items: center; gap: 6px; }
.uptime-block .label { color: var(--text-muted); font-size: 12px; margin-bottom: 2px; }
.uptime-block .value { color: #22C55E; font-weight: 700; font-size: 15px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 30, 30, 0.45);
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
    z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface);
    border-radius: 18px;
    padding: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
}

@media (min-width: 769px) {
    .modal-box {
        max-width: 640px;
        padding: 28px;
    }
    .modal-box table th, .modal-box table td { font-size: 15px; padding: 12px 14px; }
}

.site-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 10px;
    background: var(--surface);
    transition: box-shadow .15s;
}
.site-row:hover, .site-card:hover { box-shadow: 0 2px 10px rgba(0,150,150,0.08); }

.status-dot {
    width: 12px; height: 12px; border-radius: 50%;
    display: inline-block; margin-inline-end: 10px;
}
.status-dot.up { background: #22C55E; box-shadow: 0 0 0 4px #DCFCE7; }
.status-dot.down { background: var(--red); box-shadow: 0 0 0 4px var(--red-light); }
.status-dot.unknown { background: #9CA3AF; box-shadow: 0 0 0 4px #F3F4F6; }

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.badge.up { background: #DCFCE7; color: #166534; }
.badge.down { background: var(--red-light); color: #991B1B; }
.badge.unknown { background: #F3F4F6; color: #4B5563; }

.btn {
    display: inline-block;
    padding: 9px 22px;
    border-radius: 999px;
    border: none;
    background: var(--teal);
    color: #fff;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { background: var(--teal-dark); }
.btn.secondary { background: var(--surface); color: var(--teal-dark); border: 1px solid var(--teal); }
.btn.danger { background: var(--surface); color: var(--red); border: 1px solid var(--red); }
.btn.small { padding: 6px 16px; font-size: 13px; }

input[type=text], input[type=password], input[type=url], input[type=number], input[type=tel], select {
    width: 100%;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--teal); border-color: transparent; }

label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.field { margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); font-size: 14px; }
table th { color: var(--text-muted); font-weight: 500; font-size: 13px; }

.flash { padding: 12px 18px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #DCFCE7; color: #166534; }
.flash.error { background: var(--red-light); color: #991B1B; }

#toastContainer {
    position: fixed;
    bottom: 90px; left: 16px; right: 16px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 300;
    pointer-events: none;
}
@media (min-width: 769px) {
    #toastContainer { left: 24px; right: auto; bottom: 24px; width: 320px; }
}
.toast {
    background: var(--teal-dark);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    border-right: 3px solid var(--teal);
    font-size: 13px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s, transform .2s;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: none; }
.toast.toast-error { background: #7A1F1F; border-right-color: var(--red); }

/* ---------- Dashboard v2 ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 620px) { .dash-kpis { grid-template-columns: repeat(4, 1fr); } }
.dash-kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dash-kpi .kpi-icon {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.dash-kpi .kpi-icon.teal { background: var(--teal-light); color: var(--teal-dark); }
.dash-kpi .kpi-icon.red { background: var(--red-light); color: var(--red); }
.dash-kpi .kpi-icon.green { background: #DCFCE7; color: #166534; }
.dash-kpi .kpi-icon.amber { background: #FEF3C7; color: #92400E; }
.dash-kpi .kpi-num { font-size: 22px; font-weight: 700; }
.dash-kpi .kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.attention-banner {
    background: var(--red-light); border: 1px solid #F5C2C2; border-radius: 18px;
    padding: 16px; margin-bottom: 16px;
}
.attention-banner-title { color: #991B1B; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.attention-banner-body { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.attention-timer { text-align: center; flex-shrink: 0; }
.attention-timer .time { font-size: 20px; font-weight: 700; color: #991B1B; font-variant-numeric: tabular-nums; }
.attention-timer .label { font-size: 11px; color: #991B1B; opacity: .8; }
.attention-icon {
    width: 48px; height: 48px; border-radius: 14px; background: var(--surface); color: var(--red);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.attention-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dash-panels { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
@media (min-width: 900px) { .dash-panels { grid-template-columns: 1.2fr 1fr 1fr; } }

.event-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: none; padding-bottom: 0; }
.event-icon {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.event-icon.down { background: var(--red-light); color: var(--red); }
.event-icon.up { background: #DCFCE7; color: #166534; }

.telegram-panel { text-align: center; }
.telegram-panel .tg-icon {
    width: 52px; height: 52px; border-radius: 50%; background: #E6F1FB; color: #185FA5;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 10px;
}
.telegram-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-end: 4px; }

/* ---------- Sites page v2 ---------- */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
    position: absolute; inset: 0; background: #D1D5DB; border-radius: 999px; cursor: pointer; transition: .2s;
}
.toggle-switch .slider:before {
    content: ''; position: absolute; height: 18px; width: 18px; right: 3px; top: 3px;
    background: var(--surface); border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .slider { background: var(--teal); }
.toggle-switch input:checked + .slider:before { transform: translateX(-20px); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar input[type=text] { flex: 1; min-width: 180px; }
.filter-bar select { min-width: 130px; }

@media (min-width: 769px) {
    .filter-bar { flex-wrap: nowrap; }
    .filter-bar input[type=text] { flex: 0 1 300px; min-width: 220px; }
    .filter-bar select { flex: 0 0 auto; min-width: 110px; width: auto; }
}

.kebab-wrap { position: relative; display: inline-block; }
.kebab-btn {
    width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
    color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.kebab-btn:hover { background: var(--bg); }
.kebab-menu {
    position: absolute; top: 100%; left: 0; margin-top: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 140px; z-index: 40; display: none; overflow: hidden;
}
.kebab-menu.open { display: block; }
.kebab-menu button, .kebab-menu a {
    display: block; width: 100%; text-align: right; padding: 10px 14px; font-size: 13px;
    border: none; background: none; color: var(--text); cursor: pointer;
}
.kebab-menu button:hover, .kebab-menu a:hover { background: var(--bg); }
.kebab-menu .danger-item { color: var(--red); }

.pagination-bar { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--text-muted); }
.pagination-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pagination-bar select { width: auto; min-width: 56px; padding: 5px 8px; font-size: 12px; }
.pager-btns { display: flex; align-items: center; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.pager-btns .pager-ellipsis { padding: 0 4px; color: var(--text-muted); flex-shrink: 0; }
.pager-btns button {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); cursor: pointer; flex-shrink: 0;
}
.pager-btns button.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.pager-btns button:disabled { opacity: .4; cursor: default; }

.summary-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 620px) { .summary-cards { grid-template-columns: 1fr 1fr; } }
.summary-card { display: flex; align-items: center; gap: 12px; }
.summary-card .summary-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.summary-card .summary-icon.red { background: var(--red-light); color: var(--red); }
.summary-card .summary-icon.teal { background: var(--teal-light); color: var(--teal-dark); }
.summary-card .summary-title { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }

.add-site-toggle-btn { width: 100%; }
@media (min-width: 769px) { .add-site-toggle-btn { width: auto; } }

/* ---------- Alerts page ---------- */
.alert-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.alert-tabs button {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    padding: 9px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.alert-tabs button.active { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }

.type-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.type-tag.down { background: var(--red-light); color: #991B1B; }
.type-tag.slow { background: #FEF3C7; color: #92400E; }
.type-tag.ssl { background: #E6F1FB; color: #185FA5; }

@media (max-width: 768px) {
    .type-tag { max-width: 130px; }
}

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; color: var(--teal-dark); font-size: 20px; }

.uptime-bar { display: flex; gap: 2px; height: 28px; }
.uptime-bar .seg { flex: 1; border-radius: 3px; }

.hour-bar-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hour-bar { display: flex; gap: 3px; height: 40px; min-width: 600px; }
.hour-group {
    flex: 1;
    display: flex;
    gap: 1px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px;
    box-sizing: border-box;
}
.hour-group .subseg { flex: 1; height: 100%; border-radius: 1px; min-width: 1px; }
.hour-group .subseg.up { background: #22C55E; }
.hour-group .subseg.down { background: #E5484D; }
.hour-group .subseg.unknown { background: #E5E7EB; }
.hour-bar-labels { display: flex; gap: 3px; margin-top: 6px; min-width: 600px; }
.hour-label { flex: 1; text-align: center; font-size: 10px; color: var(--text-muted); }
.seg.up { background: #22C55E; }
.seg.down { background: var(--red); }
.seg.unknown { background: #E5E7EB; }

.muted { color: var(--text-muted); font-size: 13px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 480px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 100px;
    gap: 12px;
    align-items: end;
}

/* ---------- Responsive breakpoints ---------- */
@media (max-width: 768px) {
    .topbar { padding: 12px 16px; }
    .topbar .brand { font-size: 16px; }

    .container { padding: 16px 12px; }
    .card { padding: 14px; border-radius: 14px; }

    .grid-stats { grid-template-columns: repeat(2, 1fr); }
    .stat-box { padding: 10px; }
    .stat-box .num { font-size: 20px; }

    .site-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }
    .site-row > div:last-child { text-align: start; }

    .form-grid { grid-template-columns: 1fr; }

    table th, table td { padding: 8px; font-size: 13px; }

    .uptime-bar { overflow-x: auto; }
    .uptime-bar .seg { min-width: 6px; }

    .btn { width: 100%; text-align: center; }
    .site-row .btn, table .btn { width: auto; }

    h1 { font-size: 20px; }
    h2 { font-size: 18px; }

    div[style*="justify-content:space-between"] { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 420px) {
    .grid-stats { grid-template-columns: 1fr 1fr; }
    .topbar .brand { font-size: 15px; }
}


/* ---------- Support tickets ---------- */
.badge.answered { background: #E6F1FB; color: #185FA5; }
.chat-thread { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 78%; }
.chat-msg.mine { align-self: flex-start; }
.chat-msg.theirs { align-self: flex-end; }
.chat-bubble {
    padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6;
    white-space: pre-wrap; word-break: break-word;
}
.chat-msg.mine .chat-bubble { background: var(--teal-light); color: var(--text); border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; padding: 0 4px; }
.chat-msg.mine .chat-meta { text-align: right; }
.chat-msg.theirs .chat-meta { text-align: left; }

/* ---------- Host resources card (admin) ---------- */
.resource-bar-bg { background: var(--bg); border-radius: 6px; overflow: hidden; height: 12px; margin-top: 8px; }
.resource-bar-fill { height: 100%; background: #22C55E; transition: width .3s; }
.resource-bar-fill.warn { background: #F59E0B; }
.resource-bar-fill.danger { background: #E5484D; }
.resource-value { font-size: 22px; font-weight: 700; margin: 4px 0; }

/* ---------- Host resources cards (matches reference design) ---------- */
.resource-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 14px;
}
@media (max-width: 900px) { .resource-cards-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .resource-cards-row { grid-template-columns: 1fr; } }

.resource-card { padding: 20px; }
.resource-card-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 14px; color: var(--text-muted); margin-bottom: 14px;
}
.resource-icon-circle {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.resource-badge {
    font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.resource-value { font-size: 20px; font-weight: 700; margin: 4px 0 10px; }
.resource-pill {
    background: var(--bg); border-radius: 10px; padding: 8px 12px;
    font-size: 12px; color: var(--text-muted); margin-top: 12px;
}
.resource-subline {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted); margin-top: 10px;
}
.resource-kv-list { margin-top: 12px; }
.resource-kv-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.resource-kv-row:last-child { border-bottom: none; }
.resource-kv-row span { color: var(--text-muted); }
.resource-kv-row b { font-weight: 700; }

.resource-server-info-card { margin-top: 16px; }
.resource-server-info-body { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.resource-server-illustration {
    width: 200px; height: 162px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
@media (max-width: 560px) { .resource-server-illustration { width: 150px; height: 122px; } }
.resource-info-table { flex: 1; min-width: 260px; width: 100%; }
.resource-info-table td { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.resource-info-table tr:last-child td { border-bottom: none; }
.resource-info-label { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.resource-info-table td:last-child { text-align: left; font-weight: 600; }
.resource-server-footer {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--text-muted); margin-top: 14px;
}