/* ============================================
   骨干网资源管理系统 - 样式
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --bg: #f1f5f9;
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%);
    --sidebar-solid: #13112b;
    --sidebar-text: #a5b4cf;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: #818cf8;
    --sidebar-active-bg: rgba(129, 140, 248, 0.12);
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #334155;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --info: #6366f1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Navbar ===== */
.navbar {
    background: #fff;
    border-bottom: none;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 0 0 var(--border);
}
.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1 0%, #818cf8 50%, #a78bfa 100%);
    opacity: 0.7;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.nav-logo {    width: 36px;    height: 36px;    display: flex;    align-items: center;    justify-content: center;    border-radius: 8px;    object-fit: contain;}

.nav-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-username {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    background: #eef2ff;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid #e0e7ff;
}

/* ===== Layout ===== */
.main-layout {
    display: flex;
    flex: 1;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    background-color: var(--sidebar-solid);
    padding: 16px 0;
    flex-shrink: 0;
    overflow-y: auto;
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.nav-menu {
    list-style: none;
}

.nav-section-title {
    color: #6366f1;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 20px 20px 8px;
    font-weight: 700;
    opacity: 0.7;
}

.nav-item {
    /* spacing handled by link */
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 1px 8px 1px 0;
    border-radius: 0 8px 8px 0;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
    border-left-color: rgba(129, 140, 248, 0.3);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: #c7d2fe;
    border-left-color: var(--sidebar-active);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.08);
}

.nav-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    opacity: 0.85;
}

.nav-link.active .nav-icon {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(129, 140, 248, 0.4));
}

.badge {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* ===== Content ===== */
.content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
}

.page-desc {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 14px;
}

.page-actions {
    flex-shrink: 0;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Quick Links ===== */
.quick-links {
    margin-bottom: 24px;
}

.quick-links h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #1e293b;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.quick-link-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: block;
}

.quick-link-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(26,115,232,0.1);
    transform: translateY(-1px);
}

.ql-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}

.ql-title {
    font-weight: 600;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.ql-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Module Intro ===== */
.module-intro h2 {
    font-size: 16px;
    margin-bottom: 12px;
}

.module-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.module-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.module-card h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: #1e293b;
}

.module-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
}

.module-card ul {
    list-style: none;
    font-size: 13px;
    color: var(--text);
}

.module-card ul li::before {
    content: "\2713";
    color: var(--success);
    margin-right: 6px;
}

/* ===== Toolbar ===== */
.toolbar {
    margin-bottom: 16px;
}

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

.form-input, .form-select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
}

.form-input { min-width: 200px; }
.form-select { min-width: 120px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: #fff;
    transition: all 0.15s;
}

.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: #fff; color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.perm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.perm-matrix td { vertical-align: middle; }

/* ===== Data Table ===== */
.data-table {
    width: 100%;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-collapse: collapse;
}

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: #f8fafc; }

.data-table a { color: var(--primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 32px !important;
}

/* ===== Status Tags ===== */
.status-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-online { background: #dcfce7; color: #166534; }
.status-offline { background: #f1f5f9; color: #64748b; }
.status-maintenance { background: #fef9c3; color: #854d0e; }
.status-fault { background: #fee2e2; color: #991b1b; }
.status-up { background: #dcfce7; color: #166534; }
.status-down { background: #fee2e2; color: #991b1b; }

/* ===== Severity Tags ===== */
.severity-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.severity-critical { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.severity-major { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.severity-minor { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.severity-warning { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.alert-row.severity-critical { border-left: 3px solid var(--danger); }
.alert-row.severity-major { border-left: 3px solid #f97316; }
.alert-row.severity-minor { border-left: 3px solid var(--warning); }

/* ===== Detail Grid ===== */
.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.detail-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: #1e293b;
}

.detail-table {
    width: 100%;
}

.detail-table td {
    padding: 6px 0;
    font-size: 13px;
    vertical-align: top;
}

.detail-table .label {
    color: var(--text-muted);
    width: 100px;
    font-weight: 500;
}

/* ===== Code Block ===== */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== Pagination ===== */
.pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.page-links {
    display: flex;
    gap: 4px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text);
    background: #fff;
}

.page-link:hover { background: var(--bg); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Topology ===== */
.topology-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.topology-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.topo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.topo-node {
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.topo-node:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.topo-node.status-online { border-color: #86efac; }
.topo-node.status-offline { border-color: #cbd5e1; }
.topo-node.status-fault { border-color: #fca5a5; }
.topo-node.status-maintenance { border-color: #fde68a; }

.topo-node-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    margin: 0 auto 8px;
    color: var(--primary);
}

.topo-node-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.topo-node-ip {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.topo-node-status {
    margin-bottom: 8px;
}

.topo-node-link {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
}

.topo-node-link:hover { text-decoration: underline; }

.topo-links-list h3 {
    font-size: 14px;
    margin-bottom: 8px;
}

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

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

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

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 14px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: #fff;
    letter-spacing: 0.3px;
}

.text-muted { color: var(--text-muted); font-size: 12px; }
.text-danger { color: #dc2626; }
.text-warn { color: #d97706; }

/* ===== Dashboard ===== */
.dash-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }

.ring {
    --pct: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
    background: conic-gradient(#6366f1 calc(var(--pct) * 1%), #e2e8f0 0);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ring span {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #4f46e5;
}

.health-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}
.health-healthy { background: #dcfce7; color: #166534; }
.health-warning { background: #fef9c3; color: #854d0e; }
.health-critical { background: #fee2e2; color: #991b1b; }
.health-unknown { background: #f1f5f9; color: #64748b; }

.dash-chart-grid,
.dash-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.dash-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-chart-grid .dash-panel,
.dash-split .dash-panel { margin-bottom: 0; }
.dash-panel h2 {
    font-size: 15px;
    margin-bottom: 12px;
    color: #1e293b;
}
.dash-chart { width: 100%; height: 260px; }
.dash-table { border: none; }
.dash-more {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}
.dash-more:hover { text-decoration: underline; }
.issue-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.issue-list li {
    padding: 8px 12px;
    background: #f8fafc;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    font-size: 13px;
    color: #334155;
}
.empty-hint { color: var(--text-muted); font-size: 13px; padding: 16px 0; }

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.st-active { background: #fee2e2; color: #dc2626; }
.st-acknowledged { background: #fef3c7; color: #d97706; }
.st-resolved { background: #dcfce7; color: #16a34a; }
.st-ignored { background: #f1f5f9; color: #64748b; }

@media (max-width: 960px) {
    .dash-chart-grid,
    .dash-split { grid-template-columns: 1fr; }
}

/* ===== Auth / accounts ===== */
.nav-role {
    font-size: 11px;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 4px;
}
.nav-logout {
    margin-left: 12px;
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
}
.nav-logout:hover { color: #ef4444; }
.flash-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-warning { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.flash-info { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.form-label { display: block; font-weight: 600; font-size: 13px; color: #475569; margin-bottom: 5px; }