* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    background: #0a0a14; color: #e0e0e0; min-height: 100vh;
    direction: rtl; text-align: right; overflow-x: hidden;
}

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; position: relative; }

/* Sidebar overlay */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 98;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
}

/* Sidebar */
.sidebar {
    position: fixed; top: 0; right: -280px; width: 260px; height: 100vh;
    background: linear-gradient(180deg, #12122a 0%, #0e0e20 100%);
    border-left: 1px solid #1e1e3a;
    z-index: 99; transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; padding: 0;
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
}

.menu-open .sidebar { right: 0; }
.menu-open .sidebar-overlay { display: block; }

.sidebar-header {
    padding: 28px 20px 20px;
    text-align: center;
    border-bottom: 1px solid #1e1e3a;
}

.sidebar-logo {
    width: 52px; height: 52px; border-radius: 16px;
    background: linear-gradient(135deg, #4361ee, #5856d6);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 24px; margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(67,97,238,0.3);
}

.sidebar-title { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-sub { font-size: 11px; color: #666; margin-top: 4px; }

.sidebar-nav { flex: 1; padding: 20px 12px; overflow-y: auto; }

.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 16px; border-radius: 14px;
    color: #777; text-decoration: none; font-size: 13px; font-weight: 500;
    transition: all .25s cubic-bezier(.4,0,.2,1); margin-bottom: 4px;
    position: relative; overflow: hidden;
}
.nav-item::before {
    content: ''; position: absolute; inset: 0; border-radius: 14px;
    opacity: 0; transition: opacity .25s;
    background: linear-gradient(135deg, rgba(67,97,238,.08), rgba(88,86,214,.04));
}
.nav-item:hover { color: #e0e0e0; transform: translateX(-4px); }
.nav-item:hover::before { opacity: 1; }
.nav-item:active { transform: scale(.97); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(67,97,238,.15), rgba(88,86,214,.08));
    color: #5b7bff; font-weight: 700;
    border: 1px solid rgba(67,97,238,.2);
    box-shadow: 0 4px 16px rgba(67,97,238,.1);
}
.nav-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
    background: rgba(255,255,255,.04);
    transition: background .25s, transform .25s;
}
.nav-item:hover .nav-icon { background: rgba(255,255,255,.08); transform: scale(1.05); }
.nav-item.active .nav-icon {
    background: linear-gradient(135deg, #4361ee, #5856d6);
    color: #fff; box-shadow: 0 2px 10px rgba(67,97,238,.3);
}
.nav-text { flex: 1; }
.nav-item::after {
    content: '‹'; position: absolute; left: 16px;
    color: rgba(255,255,255,.08); font-size: 18px; font-weight: 700;
    transition: color .25s, transform .25s;
}
.nav-item:hover::after { color: rgba(255,255,255,.2); transform: translateX(-4px); }
.nav-item.active::after { color: #4361ee; }

.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid #1e1e3a;
    text-align: center;
}
.sidebar-version { font-size: 11px; color: #444; }

/* Main content area */
.main-content {
    flex: 1; margin-right: 0; transition: margin-right 0.3s;
    min-width: 0;
}

/* Top bar */
.topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    background: #0e0e20;
    border-bottom: 1px solid #1e1e38;
    position: sticky; top: 0; z-index: 50;
}

.hamburger {
    width: 40px; height: 40px; border: none;
    background: rgba(255,255,255,.04);
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px;
    border-radius: 12px; transition: all 0.25s; flex-shrink: 0;
    border: 1px solid rgba(255,255,255,.06);
}
.hamburger:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.1); }
.hamburger:active { transform: scale(0.92); }
.hamburger span {
    display: block; width: 18px; height: 2px;
    background: #aaa; border-radius: 2px; transition: all 0.3s cubic-bezier(.4,0,.2,1);
}
.menu-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: #4361ee; }
.menu-open .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: #4361ee; }

.topbar-title {
    flex: 1; font-size: 15px; font-weight: 600; color: #ccc;
}

.topbar-datetime {
    display: flex; align-items: center; gap: 12px; direction: ltr;
}
.topbar-clock {
    font-size: 20px; font-weight: 700; color: #4361ee;
    font-family: 'Vazirmatn', monospace; letter-spacing: 1px;
}
.topbar-date {
    font-size: 14px; font-weight: 600; color: #ccc;
    font-family: 'Vazirmatn', monospace; direction: rtl; padding-right: 10px;
    border-right: 1px solid #333;
}

/* Content area below topbar */
.content-area { padding: 0; }

/* ============ DEVICE SELECTOR BAR (clickable, opens modal) ============ */
.device-selector-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 18px; margin: 0 12px 12px;
    background: linear-gradient(135deg, #1a1a30, #16162a);
    border-radius: 12px; border: 1px solid #2a2a3e;
    cursor: pointer; transition: all 0.2s; user-select: none;
}
.device-selector-bar:hover { border-color: #4361ee40; background: #1e1e36; }
.device-selector-bar:active { transform: scale(0.99); }

.ds-label { font-size: 16px; flex-shrink: 0; }
.ds-name { font-size: 14px; font-weight: 600; color: #f0f0f0; flex-shrink: 0; }
.ds-name.muted { color: #666; }
.ds-id {
    font-size: 11px; padding: 2px 8px; border-radius: 4px;
    background: #4361ee20; color: #4361ee; font-weight: 600; flex-shrink: 0;
}
.ds-status {
    font-size: 11px; color: #666; margin-right: auto; flex-shrink: 0;
}
.ds-status.online { color: #089981; }
.ds-status.offline { color: #f23645; }
.ds-arrow { font-size: 12px; color: #555; flex-shrink: 0; }

/* Device selection modal */
.device-modal {
    background: #16162a; border-radius: 20px; max-width: 480px;
    width: 92%; max-height: 80vh; display: flex; flex-direction: column;
    border: 1px solid #2a2a3e; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: modalUp 0.3s ease;
}
@keyframes modalUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.device-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 12px; border-bottom: 1px solid #2a2a3e;
}
.device-modal-header h2 { font-size: 18px; font-weight: 700; color: #f0f0f0; margin: 0; }
.modal-close {
    width: 32px; height: 32px; border: none; border-radius: 8px;
    background: #1a1a2e; color: #888; font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #2a2a3e; color: #f0f0f0; }

.device-modal-list {
    overflow-y: auto; padding: 12px 16px 20px; flex: 1;
}

.device-modal-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: 14px;
    cursor: pointer; transition: all 0.2s; margin-bottom: 6px;
    border: 1px solid transparent;
}
.device-modal-item:hover { background: #1e1e36; border-color: #2a2a3e; }
.device-modal-item.selected {
    background: #4361ee10; border-color: #4361ee30;
}

.dmi-icon { flex-shrink: 0; width: 20px; text-align: center; }
.dmi-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    background: #555;
}
.dmi-dot.online { background: #089981; box-shadow: 0 0 6px #089981; }

.dmi-info { flex: 1; min-width: 0; }
.dmi-name { font-size: 15px; font-weight: 600; color: #f0f0f0; margin-bottom: 4px; }
.dmi-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.dmi-tag {
    font-size: 10px; padding: 1px 7px; border-radius: 4px;
    background: #4361ee20; color: #4361ee; font-weight: 600;
}
.dmi-tag.outline { background: transparent; border: 1px solid #2a2a3e; color: #888; }
.dmi-lastseen { font-size: 11px; color: #999; }
.dmi-lastseen .never { color: #f2364580; }

.dmi-check {
    width: 28px; height: 28px; border-radius: 50%;
    background: #4361ee; color: #fff; font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ============ DASHBOARD (existing) ============ */
.dashboard { max-width: 1200px; margin: 0 auto; padding: 0 12px 12px; }

/* Loading spinner for _Host.cshtml */
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid #1e1e38;
    border-top-color: #4361ee;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ DASHBOARD (original layout) ============ */

/* Error banner */
.error-banner {
    padding: 12px 18px; border-radius: 10px; margin-bottom: 16px;
    background: #3d1f1f; color: #ff6b6b; border: 1px solid #5c2a2a;
    font-size: 13px;
}

/* Loading */
.loading { text-align: center; padding: 80px 20px; color: #999; }
.loading p { margin-top: 16px; font-size: 14px; }
.spinner {
    width: 40px; height: 40px; border: 3px solid #2a2a4a;
    border-top-color: #4361ee; border-radius: 50%;
    animation: spin .8s linear infinite; margin: 0 auto;
}

/* ============ UNIFIED INFO CARD ============ */
.info-card {
    background: linear-gradient(160deg, #12122a, #181830);
    border: 1px solid #1e1e3a;
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
    transition: border-color .4s, box-shadow .4s;
}
.info-card.online { border-color: #2ec4b620; }
.info-card.offline { border-color: #ff6b6b20; }
.info-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    transition: background .4s;
}
.info-card.online::before { background: linear-gradient(90deg, #2ec4b6, #089981); }
.info-card.offline::before { background: linear-gradient(90deg, #ff6b6b, #f23645); }

/* ============ HEADER (compact, mobile-first) ============ */
.ht-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px 2px;
}
.ht-left { display: flex; align-items: center; gap: 10px; font-size: 11px; color: #888; }
.ht-date { direction: ltr; }
.ht-time { direction: ltr; }
.ht-right {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
    background: #555; flex-shrink: 0;
}
.info-card.online .status-dot { background: #2ec4b6; box-shadow: 0 0 6px #2ec4b6; }
.info-card.offline .status-dot { background: #ff6b6b; box-shadow: 0 0 6px #ff6b6b; }
.info-card.online .ht-status-text { color: #2ec4b6; }
.info-card.offline .ht-status-text { color: #ff6b6b; }
.ht-status-text { }

/* Main content — center info + avatar + device */
.ht-main {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 16px 8px;
    cursor: pointer; user-select: none;
}
.ht-main:hover { background: rgba(255,255,255,0.02); }
.ht-main:active { transform: scale(0.99); }

.ht-avatar { flex-shrink: 0; margin-right: auto; }
.center-avatar-img {
    width: 50px; height: 50px; border-radius: 50%; object-fit: cover;
    border: 2px solid #4361ee; background: #1a1a2e; display: block;
}
.ht-avatar .center-avatar-fallback {
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; background: #1a1a2e;
    border: 2px solid #2a2a4e;
}

.ht-info { flex: 1; min-width: 0; }
.ht-name {
    font-size: 15px; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.ht-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 3px; }
.ht-meta .badge {
    display: inline-block; background: #4361ee; color: #fff;
    padding: 1px 9px; border-radius: 5px; font-size: 10px; font-weight: 600;
}
.ht-meta .badge.outline { background: transparent; border: 1px solid #4361ee; color: #4361ee; }

.ht-arrow { font-size: 10px; color: #555; flex-shrink: 0; padding: 4px; }

/* Device info in header */
.ht-device {
    display: flex; align-items: center; gap: 5px;
    font-size: 11px; color: #aaa; margin-top: 2px;
}
.ht-device-icon { flex-shrink: 0; }
.ht-device-name { font-weight: 600; color: #ccc; }
.ht-device-id {
    font-family: 'Courier New', monospace; direction: ltr;
    background: #1e1e3a; padding: 0 6px; border-radius: 3px;
    color: #7ec8e3; font-size: 10px;
}

/* Footer */
.ht-footer { padding: 0 16px 10px; }
.ht-update { font-size: 11px; color: #888; }

/* ============ PROGRESS RING CARDS ============ */
.cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.card {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 24px 10px 16px;
    border-radius: 16px;
    background: linear-gradient(160deg, #12122a 0%, #181830 100%);
    border: 1px solid #1e1e3a;
    position: relative; overflow: hidden;
    transition: transform .3s ease, border-color .4s, box-shadow .4s;
}
.card::after {
    content: ''; position: absolute; bottom: 0; left: 8%; right: 8%;
    height: 3px; border-radius: 3px; opacity: 0.5;
}
.card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.card:hover::after { opacity: 1; }

.card.power { --accent: #4361ee; }
.card.reactive { --accent: #e67300; }
.card.voltage { --accent: #ff9f1c; }
.card.current { --accent: #4cc9f0; }
.card.pf { --accent: #7b2cbf; }

.power::after { background: linear-gradient(90deg, transparent, #4361ee, transparent); }
.energy::after { background: linear-gradient(90deg, transparent, #2ec4b6, transparent); }
.reactive::after { background: linear-gradient(90deg, transparent, #e67300, transparent); }
.voltage::after { background: linear-gradient(90deg, transparent, #ff9f1c, transparent); }
.current::after { background: linear-gradient(90deg, transparent, #4cc9f0, transparent); }
.pf::after { background: linear-gradient(90deg, transparent, #7b2cbf, transparent); }

.progress-ring { flex-shrink: 0; margin-bottom: 10px; }
.ring-track { fill: none; stroke: #161638; stroke-width: 7; }
.ring-fill {
    fill: none; stroke-width: 7; stroke-linecap: round;
    transform: rotate(-90deg); transform-origin: 54px 54px;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 50%, transparent));
}
.card:hover .ring-fill {
    filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 70%, transparent));
}
.card-label { font-size: 11px; color: #ccc; font-weight: 500; }

/* ============ SECTIONS ============ */
.section { margin-bottom: 24px; }
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.section-title {
    font-size: 16px; font-weight: 700; margin: 0;
    color: #fff; padding-bottom: 8px; border-bottom: 2px solid #4361ee80;
    flex: 1;
}

/* ============ LAYOUT TOGGLE ============ */
.layout-toggle {
    display: flex; gap: 4px;
    background: #0e0e20; padding: 3px; border-radius: 10px;
    border: 1px solid #1e1e38;
}
.lay-btn {
    width: 32px; height: 28px; border: none; border-radius: 7px;
    background: transparent; color: #555; cursor: pointer;
    font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s; padding: 0;
}
.lay-btn:hover { color: #888; background: #1a1a2e; }
.lay-btn.active { color: #fff; background: #4361ee; }

/* ============ PHASE GRID ============ */
.phase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.phase-card {
    padding: 16px; border-radius: 14px; border: 1px solid #2a2a4a;
    background: #1a1a2e; position: relative; overflow: hidden;
}
.phase-a .phase-header { color: #ff4d6d; }
.phase-b .phase-header { color: #f9c74f; }
.phase-c .phase-header { color: #43b581; }
.phase-header {
    font-weight: 700; font-size: 14px; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.phase-card.disconnected { opacity: 0.5; border-color: #ff3333; background: #1a0a0a; }
.phase-dot.off { background: #555 !important; box-shadow: none !important; }
.phase-cut-badge {
    font-size: 10px; background: #ff3333; color: #fff;
    padding: 2px 8px; border-radius: 10px; font-weight: 700;
    margin-right: auto;
}
.phase-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.phase-a .phase-dot { background: #ff4d6d; box-shadow: 0 0 8px rgba(255,77,109,0.5); }
.phase-b .phase-dot { background: #f9c74f; box-shadow: 0 0 8px rgba(249,199,79,0.5); }
.phase-c .phase-dot { background: #43b581; box-shadow: 0 0 8px rgba(67,181,129,0.5); }
.phase-stats { display: flex; flex-direction: column; gap: 8px; }
.phase-stat {
    display: flex; justify-content: space-between; font-size: 13px;
    padding: 6px 8px; border-radius: 6px;
}
.phase-stat span:first-child { color: #bbb; }
.phase-stat span:last-child { color: #fff; font-weight: 700; direction: ltr; }

/* ============ CONSUMPTION GRID ============ */
.cons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.cons-card {
    padding: 14px 16px; border-radius: 12px; border: 1px solid #2a2a4a;
    background: #1a1a2e; display: flex; flex-direction: column; gap: 4px;
}
.cons-card.wide { grid-column: 1 / -1; }
.cons-card.backfill { border-color: #2ec4b6; background: #0a2a2a; }
.cons-lbl { font-size: 11px; color: #ccc; text-align: right; }
.cons-val { font-size: 22px; font-weight: 700; color: #fff; direction: ltr; text-align: right; }
.cons-val span { font-size: 11px; color: #888; font-weight: 400; margin-right: 4px; }
.cons-sub { font-size: 12px; color: #ddd; direction: ltr; text-align: right; }

/* Center avatar (used in upload modal) */
.center-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4361ee;
    background: #1a1a2e;
}
.center-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #4361ee;
    border-color: #2a2a4e;
    background: #1a1a2e;
}

/* Alarms */
.no-alarms { padding: 24px; text-align: center; color: #2ec4b6; font-size: 14px; }
.alarm-list { display: flex; flex-direction: column; gap: 8px; }
.alarm-item {
    display: flex; align-items: start; gap: 12px;
    padding: 12px 16px; border-radius: 12px;
    border: 1px solid #2a2a4a; transition: background .2s;
}
.alarm-item:hover { background: #1a1a2e; }
.severity-critical { border-right: 3px solid #ff6b6b; }
.severity-warning { border-right: 3px solid #ffd166; }
.severity-info { border-right: 3px solid #4cc9f0; }
.alarm-icon { font-size: 18px; flex-shrink: 0; }
.alarm-content { flex: 1; min-width: 0; }
.alarm-title { font-weight: 600; font-size: 13px; color: #fff; }
.alarm-msg { font-size: 12px; color: #bbb; margin-top: 2px; }
.alarm-time { font-size: 11px; color: #999; margin-top: 4px; direction: ltr; text-align: left; }
.alarm-badge {
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
    flex-shrink: 0;
}
.severity-critical .alarm-badge { background: #ff6b6b20; color: #ff6b6b; }
.severity-warning .alarm-badge { background: #ffd16620; color: #ffd166; }
.severity-info .alarm-badge { background: #4cc9f020; color: #4cc9f0; }

/* Resolved alarm section */
.resolved-alarm-section { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 10px; }
.resolved-alarm-header { font-size: 12px; color: #4ade80; margin-bottom: 8px; font-weight: 600; }
.resolved-alarm-list { display: flex; flex-direction: column; gap: 6px; }
.severity-resolved { background: rgba(74,222,128,.04) !important; border-right: 3px solid #4ade80 !important; }
.severity-resolved .alarm-icon { opacity: .7; }
.severity-resolved .alarm-content { opacity: .7; }
.severity-resolved .alarm-badge.resolved-badge { background: rgba(74,222,128,.12); color: #4ade80; }

/* Alarm phase blink animation */
@keyframes alarm-pulse {
    0%, 100% { border-color: var(--phase-clr, #ff4d6d); box-shadow: 0 0 8px color-mix(in srgb, var(--phase-clr, #ff4d6d) 20%, transparent); }
    50% { border-color: #ff0000; box-shadow: 0 0 20px rgba(255,0,0,0.5), 0 0 40px rgba(255,0,0,0.2); }
}
@keyframes alarm-pulse-warning {
    0%, 100% { border-color: var(--phase-clr, #f9c74f); }
    50% { border-color: #ff8800; box-shadow: 0 0 16px rgba(255,136,0,0.3); }
}
.phase-card.critical-alarm {
    animation: alarm-pulse 1.2s ease-in-out infinite;
    border-color: #ff0000 !important;
    box-shadow: 0 0 20px rgba(255,0,0,0.2);
}
.phase-card.warning-alarm {
    animation: alarm-pulse-warning 1.5s ease-in-out infinite;
    border-color: #ff8800 !important;
}

/* Phase stat row highlight */
.phase-stat.alarm-param {
    background: rgba(255,0,0,0.08);
    border-left: 3px solid #ff3333;
    margin: 0 -8px;
    padding: 6px 8px !important;
}
.phase-stat.alarm-param span:last-child { color: #ff6b6b; }

/* Silence button */
.silence-btn {
    padding: 6px 12px;
    border: 1px solid #ff6b6b40;
    border-radius: 8px;
    background: rgba(255,107,107,0.1);
    color: #ff6b6b;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: Vazirmatn, sans-serif;
    transition: all .2s;
    flex-shrink: 0;
}
.silence-btn:hover {
    background: rgba(255,107,107,0.2);
    border-color: #ff6b6b80;
}

/* Phase tag in alarm item */
.alarm-item .phase-tag {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #2a2a4a;
    color: #888;
    font-weight: 600;
    margin-right: 4px;
}

/* Charts section — dynamic layout grid */
.charts-stack { display: grid; gap: 14px; }
.charts-stack.layout-0 { grid-template-columns: 1fr; }
.charts-stack.layout-1 { grid-template-columns: 1fr 1fr; }
.charts-stack.layout-2 { grid-template-columns: 1fr 1fr 1fr; }
.chart-wide {
    background: #111125;
    border: 1px solid #1e1e38;
    border-radius: 12px;
    padding: 14px 16px 8px;
    position: relative;
    overflow: hidden;
    transition: border-color .3s, box-shadow .3s;
    min-height: 0;
}
.chart-wide::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #f23645, #089981, #2962ff);
    opacity: 0.5;
    border-radius: 12px 12px 0 0;
}
.chart-wide:hover { border-color: #2a2a4a; }
.chart-label {
    font-size: 12px; color: #bbb; font-weight: 600;
    margin-bottom: 8px; padding-right: 8px;
    border-right: 2px solid #4361ee;
}
.chart-canvas-wrap { position: relative; width: 100%; height: 180px; }
.layout-0 .chart-canvas-wrap { height: 220px; }
.layout-1 .chart-canvas-wrap { height: 200px; }
.layout-2 .chart-canvas-wrap { height: 180px; }

.footer-text {
    text-align: center; font-size: 11px; color: #999; margin-top: 20px; padding-bottom: 24px;
}

/* ============ SUMMARY DRAWER ============ */
.summary-fab {
    position: fixed; bottom: 24px; left: 24px; z-index: 100;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: #fff; border: none; font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 20px rgba(67,97,238,.4);
    transition: transform .2s, box-shadow .2s;
}
.summary-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(67,97,238,.5); }
.summary-fab:active { transform: scale(.95); }

.summary-overlay {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
    animation: sumOverlayIn .25s ease-out;
}
@keyframes sumOverlayIn { from { opacity: 0 } to { opacity: 1 } }

.summary-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 151;
    width: min(380px, 88vw); max-width: 420px;
    background: #14142a; border-left: 1px solid #1e1e3a;
    display: flex; flex-direction: column;
    animation: sumDrawerIn .3s ease-out;
    box-shadow: 4px 0 30px rgba(0,0,0,.4);
}
@keyframes sumDrawerIn { from { transform: translateX(-100%) } to { transform: translateX(0) } }

.summary-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.summary-header h3 { margin: 0; font-size: 16px; color: #f0f0f0; }
.summary-close {
    background: none; border: none; color: #888;
    font-size: 18px; cursor: pointer; padding: 4px;
}
.summary-close:hover { color: #fff; }

.summary-body {
    flex: 1; overflow-y: auto; padding: 12px 20px 24px;
}

.sum-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06); border-radius: 12px;
    margin-bottom: 14px;
}
.sum-avatar { flex-shrink: 0; }
.sum-avatar-img {
    width: 44px; height: 44px; border-radius: 50%;
    object-fit: cover; border: 2px solid #4361ee;
}
.sum-avatar-fallback {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; background: #1a1a2e;
    border: 2px solid #2a2a4e;
}
.sum-info { flex: 1; min-width: 0; }
.sum-name { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.sum-meta { display: flex; gap: 5px; flex-wrap: wrap; }
.sum-meta .badge {
    display: inline-block; background: #4361ee; color: #fff;
    padding: 1px 9px; border-radius: 5px; font-size: 10px; font-weight: 600;
}
.sum-meta .badge.outline { background: transparent; border: 1px solid #4361ee; color: #4361ee; }

.sum-section { margin-bottom: 16px; }
.sum-section-title {
    font-size: 12px; font-weight: 700; color: #888;
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px;
}
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sum-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.sum-item {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px; padding: 10px 12px; text-align: center;
}
.sum-item-label { font-size: 10px; color: #888; margin-bottom: 4px; }
.sum-item-value { font-size: 16px; font-weight: 700; color: #f0f0f0; direction: ltr; }
.sum-item-value.small { font-size: 13px; }

/* Tariff selector in summary */
.sum-tariff-row { margin-bottom: 4px; }
.sum-tariff-select {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
    color: #e0e0e0; font-size: 13px; font-family: Vazirmatn, sans-serif; outline: none;
    cursor: pointer;
}
.sum-tariff-select:focus { border-color: #4361ee; }
.sum-tariff-select option { background: #1a1a2e; color: #e0e0e0; }

/* Date inputs */
.sum-date-row { display: flex; gap: 10px; }
.sum-date-field { flex: 1; }
.sum-date-field label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.sum-date-input {
    width: 100%; padding: 9px 12px; border-radius: 10px;
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
    color: #e0e0e0; font-size: 13px; font-family: Vazirmatn, sans-serif; outline: none;
    direction: ltr;
}
.sum-date-input:focus { border-color: #4361ee; }
.sum-date-input::placeholder { color: #555; }

/* Calculate button */
.sum-calc-btn {
    width: 100%; padding: 12px; border: none; border-radius: 12px;
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: #fff; font-size: 14px; font-weight: 700;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
    margin-bottom: 16px; transition: opacity .2s, transform .2s;
}
.sum-calc-btn:hover { opacity: .9; transform: translateY(-1px); }
.sum-calc-btn:disabled { opacity: .5; cursor: default; transform: none; }

/* Summary tables */
.sum-table-wrap { overflow-x: auto; margin-bottom: 4px; }
.sum-table { width: 100%; border-collapse: collapse; font-size: 12px; font-family: Vazirmatn, sans-serif; }
.sum-table th {
    background: rgba(255,255,255,.04); padding: 6px 5px; text-align: center;
    font-weight: 600; color: #999; border-bottom: 1px solid rgba(255,255,255,.06);
    white-space: nowrap;
}
.sum-table th small { font-weight: 400; color: #666; }
.sum-table td { padding: 6px 5px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.04); color: #ccc; }
.sum-table tfoot td { font-weight: 700; background: rgba(255,255,255,.03); color: #f0f0f0; border-top: 1px solid rgba(67,97,238,.3); }

/* Bill card with rows */
.sum-bill {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px; padding: 16px;
}
.sum-bill.no-tariff { border-color: rgba(255,255,255,.05); opacity: .6; }
.sum-bill-row {
    display: flex; justify-content: space-between; padding: 5px 0;
    font-size: 12px; color: #ccc;
}
.sum-bill-row.penalty { color: #ef5350; }
.sum-bill-row.bonus { color: #66bb6a; }
.sum-bill-row.total { font-size: 16px; font-weight: 800; color: #f0f0f0; padding-top: 8px; }
.sum-bill-divider { height: 1px; background: rgba(255,255,255,.08); margin: 4px 0; }
.sum-bill-note { font-size: 11px; color: #888; text-align: center; margin-top: 10px; }

.sum-status {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px; border-radius: 10px;
    font-size: 13px; font-weight: 600; margin-top: 4px;
}
.sum-status.online { background: rgba(46,196,182,.08); color: #2ec4b6; }
.sum-status.offline { background: rgba(255,107,107,.08); color: #ff6b6b; }
.sum-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.sum-status.online .sum-status-dot { background: #2ec4b6; box-shadow: 0 0 6px #2ec4b6; }
.sum-status.offline .sum-status-dot { background: #ff6b6b; box-shadow: 0 0 6px #ff6b6b; }

@media (max-width: 480px) {
    .summary-drawer { width: 88vw; }
    .sum-item-value { font-size: 14px; }
    .sum-date-row { flex-direction: column; gap: 8px; }
}

/* ============ BILLING / TARIFFS PAGE ============ */
.billing-page { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; direction: rtl; }
.billing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.billing-header h1 { font-size: 20px; font-weight: 700; color: #f0f0f0; margin: 0; }

.tariff-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 16px 20px; margin-bottom: 14px; transition: box-shadow .2s; }
.tariff-card:hover { border-color: rgba(67,97,238,.3); box-shadow: 0 4px 20px rgba(67,97,238,.08); }
.tariff-card.inactive { opacity: .55; }
.tariff-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.tariff-header strong { font-size: 15px; color: #e0e0e0; }
.tariff-desc { font-size: 12px; color: #888; margin-top: 2px; }
.badge-inactive { font-size: 10px; background: #553; color: #da0; padding: 1px 7px; border-radius: 8px; margin-right: 6px; }
.tariff-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sm { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); color: #ccc; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; font-family: Vazirmatn, sans-serif; }
.btn-sm:hover { background: rgba(255,255,255,.12); }
.btn-sm.danger:hover { background: rgba(200,50,50,.25); border-color: rgba(200,50,50,.3); }
.tariff-body { font-size: 12px; color: #aaa; }
.tariff-slots { margin-bottom: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slot-label { font-weight: 600; color: #ccc; min-width: 60px; }
.slot { background: rgba(255,255,255,.05); padding: 2px 10px; border-radius: 10px; font-size: 11px; }
.slot.offpeak { color: #4fc3f7; }
.slot.midpeak { color: #ffb74d; }
.slot.peak { color: #ef5350; }
.tariff-rates-summary { margin-top: 6px; font-size: 12px; color: #999; }
.tariff-rates-summary b { color: #e0e0e0; }

/* Tariff form modal */
.modal-lg { max-width: 560px; width: 90%; text-align: right; max-height: 85vh; overflow-y: auto; border-radius: 18px; }
.modal-lg h3, .modal-lg h4 { color: #f0f0f0; margin: 16px 0 10px; text-align: right; }
.modal-lg h3:first-child { margin-top: 0; }
.modal-lg h4 { font-size: 14px; border-bottom: 1px solid rgba(255,255,255,.06); padding-bottom: 6px; }
.modal-lg .form-row { margin-bottom: 10px; text-align: right; }
.modal-lg .form-row label { display: block; font-size: 12px; color: #aaa; margin-bottom: 4px; text-align: right; }
.modal-lg .form-row input[type="text"],
.modal-lg .form-row input[type="number"] {
    width: 100%; padding: 8px 10px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
    color: #e0e0e0; font-size: 13px; font-family: Vazirmatn, sans-serif; outline: none;
}
.modal-lg .form-row input:focus { border-color: #4361ee; }
.modal-lg .form-row input[type="checkbox"] { margin-left: 6px; vertical-align: middle; }
.form-row-group { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.form-row-group .form-row { margin-bottom: 0; }
.form-row-group .form-row label { font-size: 11px; margin-bottom: 2px; display: block; }
.form-row-group .form-row input { font-size: 12px; padding: 5px 8px; font-family: Vazirmatn, sans-serif; }
.form-error { color: #ef5350; font-size: 12px; margin-top: 8px; }

/* Rates table */
.rates-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.rates-table th, .rates-table td { padding: 8px 10px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.06); }
.rates-table th { font-size: 12px; color: #999; }
.rates-table input {
    width: 100px; text-align: center; padding: 6px 8px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
    color: #e0e0e0; font-size: 13px; font-family: Vazirmatn, sans-serif; outline: none;
}
.rates-table input:focus { border-color: #4361ee; }

/* Calculator */
.calc-section { margin-top: 32px; }
.calc-section h2 { font-size: 18px; font-weight: 700; color: #f0f0f0; margin-bottom: 16px; }
.calc-form { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; padding: 16px 20px; }
.calc-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.calc-row .form-row { flex: 1; min-width: 160px; }
.calc-row .form-row label { font-size: 11px; display: block; margin-bottom: 4px; color: #aaa; }
.calc-select, .calc-input {
    width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
    color: #e0e0e0; padding: 8px 12px; border-radius: 8px; font-size: 13px;
    font-family: Vazirmatn, sans-serif; outline: none;
}
.calc-select:focus, .calc-input:focus { border-color: #4361ee; }
.calc-select option { background: #1a1a2e; color: #e0e0e0; }
.calc-result { margin-top: 16px; }
.calc-period { font-size: 12px; color: #888; margin-bottom: 10px; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 12px; font-family: Vazirmatn, sans-serif; }
.calc-table th { background: rgba(255,255,255,.04); padding: 8px 6px; text-align: center; font-weight: 600; color: #aaa; border-bottom: 1px solid rgba(255,255,255,.08); }
.calc-table td { padding: 7px 6px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.04); color: #ccc; }
.calc-table tfoot td { font-weight: 700; background: rgba(255,255,255,.03); color: #f0f0f0; border-top: 2px solid rgba(67,97,238,.3); }
.calc-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.calc-summary-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 12px 14px; text-align: center; }
.calc-summary-card.total { border-color: #4361ee; background: rgba(67,97,238,.08); }
.calc-summary-card.penalty { border-color: #ef5350; background: rgba(239,83,80,.08); }
.calc-summary-card.bonus { border-color: #66bb6a; background: rgba(102,187,106,.08); }
.cs-label { font-size: 11px; color: #888; margin-bottom: 4px; }
.cs-value { font-size: 16px; font-weight: 700; color: #f0f0f0; }
.calc-summary-card.total .cs-value { color: #4361ee; }
.calc-summary-card.penalty .cs-value { color: #ef5350; }
.calc-summary-card.bonus .cs-value { color: #66bb6a; }

.text-muted { font-size: 12px; color: #888; }
.text-justify { text-align: justify !important; text-justify: auto; }
.empty-state { text-align: center; padding: 40px 20px; color: #666; font-size: 14px; }
.btn-primary {
    padding: 10px 20px; border: none; border-radius: 8px;
    background: #4361ee; color: #fff; font-size: 13px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: #3651d4; }
.btn-primary:disabled { opacity: .5; cursor: default; }

/* ============ DEVICES PAGE ============ */
.devices-page {
    max-width: 720px; margin: 0 auto; padding: 20px 16px 60px;
    direction: rtl;
}

/* Center manager card on devices page */
.center-mgr-card {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}
.center-mgr-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}
.center-mgr-avatar {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}
.center-mgr-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4361ee;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #4361ee;
}
.center-mgr-img-fallback {
    background: #1a1a2e;
    border-color: #2a2a4e;
}
.center-mgr-edit {
    position: absolute;
    bottom: -2px;
    left: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4361ee;
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
    box-shadow: 0 2px 8px rgba(67,97,238,.4);
}
.center-mgr-avatar:hover .center-mgr-edit { opacity: 1; }
.center-mgr-avatar:hover .center-mgr-img { filter: brightness(.7); }
.center-mgr-text { flex: 1; }
.center-mgr-name { font-size: 15px; font-weight: 700; color: #fff; }
.center-mgr-meta { font-size: 12px; color: #777; margin-top: 2px; }
.center-mgr-tariff { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.center-mgr-tariff label { font-size: 11px; color: #888; }
.tariff-select {
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    color: #e0e0e0; padding: 4px 10px; border-radius: 6px; font-size: 12px;
    font-family: Vazirmatn, sans-serif; cursor: pointer; outline: none;
}
.tariff-select option { background: #1a1a2e; color: #e0e0e0; }
.tariff-select:focus { border-color: #4361ee; }

.devices-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}

.devices-header h1 {
    font-size: 20px; font-weight: 700; color: #f0f0f0; margin: 0;
}

.btn-add {
    padding: 10px 20px; border: none; border-radius: 10px;
    background: #4361ee; color: #fff; font-size: 13px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
    transition: background 0.2s;
}
.btn-add:hover { background: #3651d4; }

.devices-toast {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
    font-size: 13px; font-weight: 600;
}
.devices-toast.error { background: #f2364520; color: #f23645; border: 1px solid #f2364540; }

/* Device form card */
.device-form-card {
    background: #16162a; border-radius: 12px; padding: 20px 24px;
    margin-bottom: 20px; border: 1px solid #2a2a3e;
}
.device-form-card h3 { font-size: 15px; font-weight: 600; color: #f0f0f0; margin-bottom: 16px; }

.device-form-card .form-row { margin-bottom: 12px; }
.device-form-card .form-row label {
    display: block; font-size: 12px; color: #aaa; margin-bottom: 4px;
}
.device-form-card .form-row input[type="text"] {
    width: 100%; padding: 10px 14px; border-radius: 8px;
    border: 1px solid #2a2a3e; background: #1a1a2e; color: #f0f0f0;
    font-size: 14px; font-family: Vazirmatn, sans-serif; outline: none;
}
.device-form-card .form-row input[type="text"]:focus { border-color: #4361ee; }
.device-form-card .form-row input[type="checkbox"] { margin-left: 8px; }

.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-save-form {
    flex: 1; padding: 10px; border: none; border-radius: 8px;
    background: #4361ee; color: #fff; font-size: 13px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
}
.btn-save-form:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-cancel {
    padding: 10px 20px; border: 1px solid #2a2a3e; border-radius: 8px;
    background: transparent; color: #888; font-size: 13px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
}
.btn-cancel:hover { background: #1a1a2e; }

/* Device list */
.devices-list { display: flex; flex-direction: column; gap: 10px; }

.devices-empty {
    text-align: center; padding: 60px 20px; color: #666;
}
.devices-empty .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.devices-empty p { font-size: 15px; }
.devices-empty .empty-hint { font-size: 12px; color: #555; margin-top: 6px; }

.device-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; border-radius: 12px;
    background: #16162a; border: 1px solid #2a2a3e;
    transition: all 0.2s;
}
.device-card:hover { border-color: #3a3a5e; background: #1a1a30; }
.device-card.inactive { opacity: 0.6; }

.device-status-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.device-card.active .device-status-dot { background: #089981; box-shadow: 0 0 6px #089981; }
.device-card.inactive .device-status-dot { background: #555; }

.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 15px; font-weight: 600; color: #f0f0f0; margin-bottom: 4px; }
.device-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.device-tag {
    font-size: 11px; padding: 2px 8px; border-radius: 4px;
    background: #4361ee20; color: #4361ee; font-weight: 600;
}
.device-tag.outline { background: transparent; border: 1px solid #2a2a3e; color: #888; }
.device-lastseen { font-size: 11px; color: #555; }
.device-lastseen .never { color: #f2364580; }

.device-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
    width: 36px; height: 36px; border: none; border-radius: 8px;
    background: transparent; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.btn-icon:hover { background: #1a1a2e; }
.btn-icon.danger:hover { background: #3d1f1f; }

/* Modal overlay (shared for delete + device selector) */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; animation: fadeIn .15s ease;
}
.modal-box {
    background: #1a1a2e; border-radius: 18px; padding: 28px 32px;
    max-width: 400px; width: 90%; border: 1px solid #2a2a3e;
    text-align: center; animation: slideUp .2s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-box h3 { font-size: 18px; color: #f0f0f0; margin-bottom: 12px; }
.modal-box p { font-size: 14px; color: #888; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-cancel {
    flex: 1; padding: 10px 20px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
    background: transparent; color: #aaa; font-size: 13px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
}
.btn-cancel:hover { background: rgba(255,255,255,.05); }
.btn-danger {
    flex: 1; padding: 12px; border: none; border-radius: 8px;
    background: #f23645; color: #fff; font-size: 14px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
}

/* ============ ALARM MANAGEMENT PAGE ============ */
.alarms-page {
    max-width: 1200px; margin: 0 auto; padding: 16px 12px 40px;
    direction: rtl;
}
.alarms-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.alarms-header h1 { font-size: 20px; font-weight: 700; color: #f0f0f0; margin: 0; }
.alarms-actions { display: flex; align-items: center; gap: 14px; }
.alarms-count { font-size: 13px; color: #888; font-weight: 600; }
.btn-clear-all {
    padding: 8px 16px; border: none; border-radius: 8px;
    background: #3d1f1f; color: #ff6b6b; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: Vazirmatn, sans-serif;
    transition: background .2s; display: flex; align-items: center; gap: 4px;
}
.btn-clear-all:hover:not(:disabled) { background: #5c2a2a; }
.btn-clear-all:disabled { opacity: .4; cursor: default; }

/* Filter bar */
.alarms-filter {
    display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
    background: #16162a; padding: 12px 16px; border-radius: 12px;
    border: 1px solid #2a2a3e; align-items: center;
}
.filter-group select {
    padding: 8px 12px; border-radius: 8px; border: 1px solid #2a2a3e;
    background: #1a1a2e; color: #e0e0e0; font-size: 12px; font-weight: 500;
    font-family: Vazirmatn, sans-serif; outline: none; cursor: pointer;
    min-width: 110px;
}
.filter-group select:focus { border-color: #4361ee; }
.btn-refresh {
    padding: 8px 16px; border: none; border-radius: 8px;
    background: #4361ee; color: #fff; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: Vazirmatn, sans-serif;
    margin-right: auto; transition: background .2s;
}
.btn-refresh:hover { background: #3651d4; }

/* Table */
.alarms-table-wrap {
    background: #16162a; border-radius: 12px; border: 1px solid #2a2a3e;
    overflow-x: auto;
}
.alarms-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
    min-width: 600px;
}
.alarms-table th {
    padding: 12px 14px; text-align: right; font-weight: 600;
    font-size: 11px; color: #555; border-bottom: 1px solid #2a2a3e;
    white-space: nowrap; user-select: none;
}
.alarms-table td { padding: 12px 14px; border-bottom: 1px solid #1e1e30; }
.alarm-row:last-child td { border-bottom: none; }
.alarm-row:hover { background: rgba(255,255,255,0.02); }
.alarm-row.resolved { opacity: .55; }
.col-sev { width: 36px; text-align: center !important; }
.col-title { min-width: 180px; }
.col-phase { width: 60px; text-align: center !important; }
.col-value { width: 70px; text-align: center !important; direction: ltr; }
.col-time { width: 100px; text-align: center !important; direction: ltr; }
.col-status { width: 90px; text-align: center !important; }
.col-actions { width: 80px; text-align: center !important; }

.sev-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.sev-dot.sev-critical { background: #ff6b6b; box-shadow: 0 0 6px rgba(255,107,107,.5); }
.sev-dot.sev-warning { background: #ffd166; box-shadow: 0 0 6px rgba(255,209,102,.5); }
.sev-dot.sev-info { background: #4cc9f0; box-shadow: 0 0 6px rgba(76,201,240,.5); }

.alarm-title { font-weight: 600; color: #f0f0f0; font-size: 13px; }
.alarm-msg { font-size: 11px; color: #666; margin-top: 2px; }

.phase-tag {
    font-size: 10px; padding: 2px 8px; border-radius: 4px;
    background: #2a2a4a; color: #888; font-weight: 600;
}
.phase-tag.phase-a { background: #ff4d6d20; color: #ff4d6d; }
.phase-tag.phase-b { background: #f9c74f20; color: #f9c74f; }
.phase-tag.phase-c { background: #43b58120; color: #43b581; }

.alarm-time-main { font-size: 13px; color: #e0e0e0; font-weight: 600; }
.alarm-time-sub { font-size: 10px; color: #555; margin-top: 1px; }

.status-tag {
    font-size: 11px; padding: 3px 10px; border-radius: 8px;
    font-weight: 600; white-space: nowrap;
}
.status-tag.active { background: #ff6b6b20; color: #ff6b6b; }
.status-tag.resolved { background: #2ec4b620; color: #2ec4b6; }

.btn-action {
    width: 30px; height: 30px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 14px; transition: background .2s;
    margin: 0 2px; display: inline-flex; align-items: center; justify-content: center;
}
.btn-resolve { background: #2ec4b620; color: #2ec4b6; }
.btn-resolve:hover { background: #2ec4b640; }
.btn-delete { background: #ff6b6b20; color: #ff6b6b; }
.btn-delete:hover { background: #ff6b6b40; }

/* Empty state */
.alarms-empty {
    text-align: center; padding: 60px 20px;
    background: #16162a; border-radius: 12px; border: 1px solid #2a2a3e;
}
.alarms-empty-icon { font-size: 48px; margin-bottom: 16px; }
.alarms-empty p { font-size: 15px; color: #888; }
.alarms-empty-hint { font-size: 12px; color: #555; margin-top: 6px !important; }

/* Pagination */
.alarms-pager {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 16px; padding: 12px;
}
.pager-btn {
    padding: 8px 12px; border: 1px solid #2a2a3e; border-radius: 8px;
    background: transparent; color: #888; cursor: pointer;
    font-size: 13px; font-family: Vazirmatn, sans-serif;
    transition: all .2s;
}
.pager-btn:hover:not(:disabled) { background: #1a1a2e; color: #f0f0f0; }
.pager-btn:disabled { opacity: .3; cursor: default; }
.pager-info { font-size: 13px; color: #555; padding: 0 8px; }

/* Toast */
.alarms-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    padding: 10px 20px; border-radius: 10px;
    background: #1a1a2e; color: #2ec4b6; font-size: 13px; font-weight: 600;
    border: 1px solid #2ec4b640; z-index: 300; animation: toastUp .3s ease;
}
@keyframes toastUp { from { transform: translateX(-50%) translateY(20px); opacity:0; } to { transform: translateX(-50%) translateY(0); opacity:1; } }

/* Alarm page mobile */
@media (max-width: 700px) {
    .alarms-filter { flex-direction: column; }
    .filter-group select { width: 100%; min-width: 0; }
    .btn-refresh { width: 100%; margin-right: 0; }
    .alarms-table { font-size: 12px; min-width: 0; }
    .col-title { min-width: 120px; }
    .alarms-header { flex-direction: column; align-items: stretch; text-align: center; }
    .alarms-actions { justify-content: center; }
}

/* ============ RESPONSIVE ============ */
@media (min-width: 768px) {
    .dashboard { padding: 0 24px 24px; }
    .ht-bar { padding: 12px 24px 4px; }
    .ht-left { font-size: 13px; }
    .ht-main { padding: 6px 24px 10px; gap: 16px; }
    .center-avatar-img { width: 58px; height: 58px; }
    .ht-avatar .center-avatar-fallback { width: 58px; height: 58px; font-size: 26px; }
    .ht-name { font-size: 18px; }
    .ht-meta .badge { font-size: 11px; padding: 2px 11px; }
    .ht-device { font-size: 12px; }
    .ht-footer { padding: 2px 24px 14px; }
    .ht-arrow { padding: 8px; }
    .cards { gap: 16px; }
    .card { padding: 28px 14px 18px; }
    .phase-grid { gap: 16px; }
    .phase-card { padding: 20px; }
}
@media (max-width: 860px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
    .cons-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .card { padding: 20px 8px 14px; }
    .progress-ring { width: 80px; height: 80px; }
    .phase-grid { grid-template-columns: 1fr; }
    .cons-grid { grid-template-columns: 1fr; }
    .ht-bar { padding: 6px 12px 2px; }
    .ht-left { font-size: 10px; gap: 6px; }
    .ht-right { font-size: 11px; }
    .ht-main { padding: 4px 12px 6px; gap: 10px; }
    .center-avatar-img { width: 44px; height: 44px; }
    .ht-avatar .center-avatar-fallback { width: 44px; height: 44px; font-size: 18px; }
    .ht-name { font-size: 13px; }
    .ht-meta .badge { font-size: 9px; padding: 1px 7px; }
    .ht-device { font-size: 10px; gap: 4px; }
    .ht-footer { padding: 0 12px 8px; }
    .ht-update { font-size: 10px; }
    .status-dot { width: 6px; height: 6px; }
}
@media (max-width: 700px) {
    .phase-grid { grid-template-columns: 1fr; }
}

/* ============================================
   Landing Page (News/Home)
   ============================================ */
.landing-root {
    position: relative;
    min-height: 100vh;
    background: #0a0a14;
    overflow-x: hidden;
    font-family: Vazirmatn, sans-serif;
    display: flex;
    flex-direction: column;
}

.landing-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.landing-root::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(67,97,238,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(67,97,238,.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}
.landing-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #0a0a14 0%, #1a1a2e 30%, #16213e 60%, #0a0a14 100%);
    background-size: 400% 400%;
    animation: gradShift 20s ease infinite;
}
@keyframes gradShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .15;
    animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 {
    width: 500px; height: 500px;
    background: #4361ee;
    top: -10%; left: -10%;
    animation-delay: 0s;
}
.orb-2 {
    width: 400px; height: 400px;
    background: #7209b7;
    bottom: -10%; right: -10%;
    animation-delay: -4s;
}
.orb-3 {
    width: 350px; height: 350px;
    background: #3a0ca3;
    top: 40%; left: 50%;
    animation-delay: -8s;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -60px) scale(1.1); }
    66% { transform: translate(-40px, 40px) scale(.9); }
}

/* ============ LANDING HEADER ============ */
.landing-header {
    position: relative;
    z-index: 10;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(10,10,20,.6);
    backdrop-filter: blur(16px);
}
.landing-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.landing-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.landing-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.landing-logo-icon { font-size: 22px; }
.landing-logo-text { display: flex; flex-direction: column; }
.landing-logo-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.landing-logo-sub {
    font-size: 10px;
    color: #666;
}
.landing-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 24px;
    border-radius: 50px;
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .25s, box-shadow .25s;
    box-shadow: 0 4px 20px rgba(67, 97, 238, .3);
}
.landing-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(67, 97, 238, .45);
}

/* ============ NEWS CLOCK (inline in header) ============ */
.news-clock {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}
.news-clock .nc-time { color: #888; font-weight: 600; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Mid-section info cards */
.news-mid-section {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 28px auto 0;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Announcement card */
.news-announce-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(67,97,238,.08);
    border: 1px solid rgba(67,97,238,.15);
    border-radius: 14px;
    padding: 14px 18px;
}
.news-announce-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.news-announce-body {
    flex: 1;
    min-width: 0;
}
.news-announce-label {
    font-size: 11px;
    font-weight: 700;
    color: #5b7bff;
    margin-bottom: 2px;
}
.news-announce-text {
    font-size: 12px;
    color: rgba(255,255,255,.65);
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-announce-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    color: #4ade80;
    background: rgba(74,222,128,.12);
    padding: 3px 10px;
    border-radius: 20px;
}

/* Description card */
.news-desc-card {
    position: relative;
    display: flex;
    gap: 20px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 16px;
    padding: 24px 24px 20px;
    overflow: hidden;
}
.news-desc-glow {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(67,97,238,.12), transparent 70%);
    pointer-events: none;
}
.news-desc-icon {
    font-size: 32px;
    flex-shrink: 0;
    margin-top: 2px;
}
.news-desc-body {
    flex: 1;
    min-width: 0;
}
.news-desc-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
}
.news-desc-text {
    font-size: 12px;
    color: rgba(255,255,255,.55);
    line-height: 1.8;
    margin: 0 0 16px;
}
.news-desc-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.news-desc-stat {
    display: flex;
    flex-direction: column;
}
.nds-value {
    font-size: 13px;
    font-weight: 700;
    color: #5b7bff;
}
.nds-label {
    font-size: 10px;
    color: #666;
}

@media (max-width: 768px) {
    .news-mid-section { padding: 0 16px; }
    .news-announce-card { flex-wrap: wrap; gap: 8px; }
    .news-desc-card { flex-direction: column; gap: 12px; }
    .news-desc-stats { gap: 14px; }
}

/* Featured article */
.news-featured {
    position: relative;
    z-index: 1;
    padding: 4px 24px;
    max-width: 960px;
    margin: 0 auto;
}
.news-featured-card {
    max-width: 960px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    transition: transform .4s, box-shadow .4s;
    animation: fadeUp .6s ease-out backwards;
    animation-delay: .1s;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
}
.news-featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0,0,0,.4);
    border-color: rgba(67,97,238,.15);
}
.news-featured-img {
    flex: 0 0 45%;
    overflow: hidden;
    min-height: 220px;
}
.news-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.news-featured-card:hover .news-featured-img img {
    transform: scale(1.02);
}
.news-featured-body {
    flex: 1;
    padding: 24px 28px 28px;
    min-width: 0;
}
.news-featured-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 6px;
    background: #4361ee;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 10px;
}
.news-featured-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.3;
}
.news-featured-summary {
    font-size: 13px;
    color: rgba(255,255,255,.65);
    margin: 0 0 12px;
    line-height: 1.7;
}
.news-featured-fulltext {
    font-size: 13px;
    color: #bbb;
    line-height: 1.9;
    margin-bottom: 0;
    padding: 14px 28px 20px;
    background: rgba(255,255,255,.03);
    border-top: 1px solid rgba(255,255,255,.06);
    width: 100%;
    flex-basis: 100%;
}
.news-featured-more {
    background: none;
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .25s;
    font-family: inherit;
}
.news-featured-more:hover {
    background: rgba(255,255,255,.1);
    border-color: #fff;
}

/* News articles section */
.news-section {
    position: relative;
    z-index: 1;
    padding: 30px 20px 80px;
}
.news-section-title {
    max-width: 960px;
    margin: 0 auto 18px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.news-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to left, rgba(67,97,238,.3), transparent);
}
.news-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.news-loading {
    text-align: center;
    color: #888;
    font-size: 14px;
    padding: 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.news-loading p { margin: 0; }
.news-empty {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 40px 0;
}

/* News Slider */
.news-slider-section {
    padding: 0 24px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.news-slider {
    position: relative;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 16 / 7;
    min-height: 200px;
    max-height: 480px;
    background: #111128;
    border: 1px solid rgba(255,255,255,.06);
}
.news-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .8s ease-in-out;
    pointer-events: none;
}
.news-slide.active {
    opacity: 1;
    pointer-events: auto;
}
.news-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.news-slide-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 24px 20px;
    background: linear-gradient(to top, rgba(0,0,0,.8), transparent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-align: right;
}
.news-slider-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}
.news-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.5);
    background: transparent;
    cursor: pointer;
    transition: all .3s;
    padding: 0;
}
.news-slider-dot.active {
    background: #fff;
    border-color: #fff;
    transform: scale(1.2);
}
.news-slider-dot:hover { border-color: #fff; }

@media (max-width: 768px) {
    .news-slider-section { padding: 0 16px; }
    .news-slider { border-radius: 14px; aspect-ratio: 16 / 9; min-height: 160px; }
    .news-slide-title { font-size: 13px; padding: 24px 16px 14px; }
}

.news-card {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity .6s ease-out, transform .6s cubic-bezier(.22,1,.36,1), box-shadow .35s;
}
.news-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .6s ease-out, transform .6s cubic-bezier(.22,1,.36,1);
}
.news-card:hover {
    transform: translateY(-4px) scale(1.005);
    box-shadow: 0 16px 48px rgba(0,0,0,.4);
    border-color: rgba(67, 97, 238, .15);
}
.news-card-inner {
    display: flex;
    flex-direction: row-reverse;
    gap: 0;
}
.news-card-img {
    flex: 0 0 240px;
    overflow: hidden;
    position: relative;
    align-self: stretch;
}
.news-card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to left, transparent 60%, rgba(10,10,20,.4));
}
.news-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s;
}
.news-card:hover .news-card-img img {
    transform: scale(1.06);
}
.news-card-body {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}
.news-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.4;
}
.news-card-summary {
    font-size: 12px;
    color: #999;
    margin: 0 0 10px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card-fulltext {
    font-size: 12px;
    color: #bbb;
    line-height: 1.8;
    margin-bottom: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,.03);
    border-radius: 8px;
    border-right: 3px solid #4361ee;
}
.news-card-more {
    align-self: flex-start;
    background: none;
    border: 1px solid rgba(67, 97, 238, .25);
    color: #4361ee;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .25s;
    font-family: inherit;
}
.news-card-more:hover {
    background: rgba(67, 97, 238, .1);
    border-color: #4361ee;
}

/* ============================================
   News Management (admin CRUD)
   ============================================ */
.news-mgr {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}
.news-mgr-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.news-mgr-hdr h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
.news-mgr-add {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: #4361ee;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s;
}
.news-mgr-add:hover { background: #3651d4; }
.news-mgr-saving {
    text-align: center;
    color: #4361ee;
    font-size: 13px;
    padding: 12px;
}

/* Form overlay */
.news-mgr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 999;
}
.news-mgr-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #1a1a2e;
    border: 1px solid #2a2a3e;
    border-radius: 16px;
    padding: 28px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}
.news-mgr-form h3 {
    margin: 0 0 20px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}
.nfld {
    margin-bottom: 14px;
}
.nfld label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
    font-weight: 600;
}
.ninp {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    background: #0a0a14;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color .2s;
}
.ninp:focus { border-color: #4361ee; outline: none; }
textarea.ninp { resize: vertical; }
.nfld-row {
    display: flex;
    gap: 14px;
}
.nmgr-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.nmgr-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s;
}
.nmgr-save { background: #4361ee; color: #fff; }
.nmgr-save:hover { background: #3651d4; }
.nmgr-cancel { background: #2a2a3e; color: #888; }
.nmgr-cancel:hover { background: #3a3a4e; }
.nmgr-edit { background: #2a2a3e; color: #4361ee; padding: 8px 12px; }
.nmgr-edit:hover { background: #3a3a4e; }
.nmgr-del { background: #2a2a3e; color: #ff3b30; padding: 8px 12px; }
.nmgr-del:hover { background: #3a3a4e; }

.nmgr-preview {
    margin-top: 8px;
}
.nmgr-preview img {
    max-width: 200px;
    max-height: 120px;
    border-radius: 8px;
    border: 1px solid #2a2a3e;
}

/* List items */
.news-mgr-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.news-mgr-loading, .news-mgr-empty {
    text-align: center;
    color: #666;
    font-size: 13px;
    padding: 40px 0;
}
.nmgr-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    align-items: center;
}
.nmgr-item.inactive { opacity: .5; }
.nmgr-item-img {
    flex: 0 0 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
}
.nmgr-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.nmgr-item-body { flex: 1; min-width: 0; }
.nmgr-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}
.nmgr-item-summary {
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nmgr-item-meta {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    display: flex;
    gap: 12px;
}
.nmgr-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================
   Styled File Upload Drop Zone
   ============================================ */
.file-drop {
    position: relative;
    border: 2px dashed #2a2a4e;
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .3s, background .3s;
    background: rgba(255,255,255,.02);
    overflow: hidden;
}
.file-drop:hover {
    border-color: #4361ee;
    background: rgba(67, 97, 238, .05);
}
.file-drop input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.file-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.file-drop-icon { font-size: 28px; }
.file-drop-text { font-size: 13px; color: #aaa; font-weight: 600; }
.file-drop-hint { font-size: 11px; color: #555; }

/* Upload preview inside drop zone */
.file-drop-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 100px;
}
.file-drop-preview img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
    object-fit: contain;
}
.file-drop-clear {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255,59,48,.85);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    z-index: 3;
    line-height: 1;
}
.file-drop-clear:hover { background: #ff3b30; }

/* Standalone preview (below drop zone) */
.upload-preview {
    display: flex;
    justify-content: center;
}
.upload-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 10px;
    border: 2px solid #2a2a4e;
    object-fit: cover;
}

/* ============================================
   Center Avatar (dashboard)
   ============================================ */
.info-center-avatar {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}
.center-avatar-edit {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4361ee;
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
    box-shadow: 0 2px 8px rgba(67,97,238,.4);
}
.info-center-avatar:hover .center-avatar-edit {
    opacity: 1;
}
.info-center-avatar:hover .center-avatar {
    filter: brightness(.7);
}

/* Responsive */
@media (max-width: 700px) {
    .landing-header-inner { height: auto; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
    .landing-header-right { gap: 8px; flex-wrap: wrap; }
    .landing-logo-title { font-size: 13px; }
    .landing-logo-sub { font-size: 9px; }
    .landing-logo-icon { font-size: 18px; }
    .landing-login-btn { font-size: 12px; padding: 6px 18px; }
    .news-clock { font-size: 9px; }
    .news-featured { padding: 0 16px; }
    .news-mid-section { padding: 0 16px; }
    .news-slider-section { padding: 0 16px; }
    .news-section-title { padding: 0 16px; }
    .news-container { padding: 0 16px; }
    .news-featured-card { flex-direction: column; border-radius: 14px; }
    .news-featured-body { padding: 18px 20px 22px; }
    .news-featured-title { font-size: 17px; }
    .news-featured-img { flex: none; max-height: 200px; min-height: 140px; }
    .news-featured-img img { object-fit: cover; }
    .news-section { padding: 20px 16px 60px; }
    .news-card-inner { flex-direction: column; }
    .news-card-img { flex: none; max-height: 160px; }
    .news-card-img::after { background: linear-gradient(to top, rgba(10,10,20,.4), transparent 60%); }
    .news-card-body { padding: 14px 16px; }
    .news-mgr { padding: 14px; }
    .news-mgr-form { padding: 20px; width: 95%; }
    .nmgr-item { flex-wrap: wrap; }
    .news-footer { padding: 24px 20px; }
}

/* Footer */
.news-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.02);
    padding: 32px 20px;
    margin-top: auto;
}
.news-footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.news-footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.news-footer-logo { font-size: 18px; }
.news-footer-copy {
    font-size: 11px;
    color: #555;
}
.slider-card {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    overflow: hidden;
    transition: transform .3s, box-shadow .3s;
}
.slider-card.inactive { opacity: .5; }
.slider-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.slider-card-img {
    aspect-ratio: 16/9;
    overflow: hidden;
}
.slider-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.slider-card-body { padding: 12px 14px; }
.slider-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}
.slider-card-meta {
    font-size: 11px;
    color: #666;
    display: flex;
    gap: 12px;
}
.slider-card-meta .status-on { color: #4ade80; }
.slider-card-meta .status-off { color: #f43f5e; }
.slider-card-actions {
    display: flex;
    gap: 6px;
    padding: 8px 14px 12px;
}

/* ============ SHARED: Centers + Devices pages ============ */

/* ── Select dropdown ── */
.select-wrap { position: relative; }
.select-wrap::after {
    content: "▾";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 12px;
    pointer-events: none;
}
.form-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border-radius: 10px;
    border: 1px solid #2a2a3e;
    background: #1a1a2e;
    color: #f0f0f0;
    font-size: 14px;
    font-family: Vazirmatn, sans-serif;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.form-select:focus { border-color: #4361ee; }
.form-select option { background: #1a1a2e; color: #e0e0e0; padding: 8px; }

/* ── Form row ── */
.form-row { margin-bottom: 14px; text-align: right; }
.form-row label {
    display: block; font-size: 12px; color: #aaa;
    margin-bottom: 5px; font-weight: 500;
}
.form-input {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1px solid #2a2a3e; background: #1a1a2e; color: #f0f0f0;
    font-size: 14px; font-family: Vazirmatn, sans-serif; outline: none;
    transition: border-color 0.2s; box-sizing: border-box;
}
.form-input:focus { border-color: #4361ee; }
.form-input::placeholder { color: #555; }
.form-check {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
}
.form-check input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: #4361ee; cursor: pointer;
}
.form-check label {
    font-size: 14px; color: #ccc; cursor: pointer; margin-bottom: 0;
}

/* ── Modal shared ── */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; animation: fadeIn 0.15s ease;
}
.modal-panel {
    background: #1a1a2e; border-radius: 18px;
    border: 1px solid #2a2a3e; width: 100%; max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.2s ease;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h3 {
    font-size: 17px; font-weight: 700; color: #f0f0f0; margin: 0;
}
.modal-close {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: rgba(255, 255, 255, 0.06); color: #888;
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; gap: 10px; padding: 0 24px 20px; }

/* ── Delete confirm ── */
.delete-icon-wrap {
    width: 56px; height: 56px; border-radius: 50%;
    background: #3d1f1f; display: flex; align-items: center;
    justify-content: center; margin: 0 auto 16px;
}
.delete-icon-wrap svg { width: 28px; height: 28px; }
.delete-msg {
    font-size: 14px; color: #999; text-align: center; line-height: 1.7;
}
.delete-msg strong { color: #f0f0f0; }

/* ── Buttons ── */
.btn-primary {
    flex: 1; padding: 11px 16px; border: none; border-radius: 10px;
    background: #4361ee; color: #fff; font-size: 14px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #3651d4; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    flex: 1; padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px;
    background: transparent; color: #aaa; font-size: 14px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
    transition: all 0.15s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.04); color: #ddd; }

.btn-danger {
    flex: 1; padding: 11px 16px; border: none; border-radius: 10px;
    background: #d32f2f; color: #fff; font-size: 14px; font-weight: 600;
    font-family: Vazirmatn, sans-serif; cursor: pointer;
    transition: background 0.2s;
}
.btn-danger:hover { background: #b71c1c; }

/* ── Card list ── */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; border-radius: 14px;
    background: #16162a; border: 1px solid #2a2a3e;
    transition: all 0.2s;
}
.card-item:hover { border-color: #3a3a5e; background: #1a1a30; }
.card-item.inactive { opacity: 0.55; }
.card-avatar {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
    background: #1a1a2e; border: 1px solid #2a2a3e;
}
.card-avatar.center-avatar { background: #4361ee18; color: #4361ee; }
.card-avatar.device-avatar { background: #08998118; color: #089981; }
.card-info { flex: 1; min-width: 0; }
.card-name {
    font-size: 15px; font-weight: 600; color: #f0f0f0;
    display: flex; align-items: center; gap: 8px;
}
.card-meta {
    font-size: 12px; color: #666; margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub { font-size: 11px; color: #555; margin-top: 2px; }
.card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.card-btn {
    width: 36px; height: 36px; border: none; border-radius: 10px;
    background: transparent; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; color: #888;
}
.card-btn:hover { background: rgba(255, 255, 255, 0.06); color: #ccc; }
.card-btn.danger:hover { background: #3d1f1f; color: #f23645; }

/* ── Status dot ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online { background: #089981; box-shadow: 0 0 6px #089981; }
.status-dot.offline { background: #555; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 48px; opacity: 0.4; margin-bottom: 12px; }
.empty-title { font-size: 16px; color: #888; margin-bottom: 6px; }
.empty-hint { font-size: 13px; color: #555; }

/* ── Page error ── */
.page-error {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
    font-size: 13px; font-weight: 500;
    background: #f2364520; color: #f23645;
    border: 1px solid #f2364540;
    display: flex; align-items: center; gap: 8px;
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Mobile modal ── */
@media (max-width: 600px) {
    .modal-panel {
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
        align-self: flex-end;
    }
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .card-item { padding: 14px; }
}

/* ============ SCROLLBAR ============ */
/* Hide default scrollbar globally — fade-in on hover */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.08);
    border-radius: 10px;
    transition: background .3s;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent; }

/* Modal scrollable body fix */
.modal-scroll-body {
    overflow-y: auto;
    max-height: 60vh;
    padding-right: 4px;
}
.modal-scroll-body::-webkit-scrollbar { width: 4px; }
.modal-scroll-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }

/* Sidebar scroll */
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: 10px; }
