:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-sub: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --terminal-bg: #1e1e1e;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.nav-item:hover {
    background: #f9fafb;
    color: var(--text-main);
}

.nav-item.active {
    background: #eef2ff;
    color: var(--primary);
}

/* Control Panel in Sidebar */
.control-box {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 24px;
    overflow: auto;
}

.control-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-sub);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.ctrl-row {
    margin-bottom: 16px;
}

.ctrl-label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-main);
}

.ctrl-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.ctrl-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.ctrl-textarea {
    min-height: 130px;
    resize: vertical;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
}

.address-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: Consolas, 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
}

.ctrl-hint {
    margin-top: 6px;
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.4;
}

.ctrl-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 13px;
    margin-bottom: 10px;
    cursor: pointer;
}

.ctrl-check input {
    accent-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

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

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Main Content */
.main-view {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
}

.view-section.hidden {
    display: none;
}

.view-section.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-dot.running {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-value.blue {
    color: var(--primary);
}

.stat-value.green {
    color: var(--success);
}

.stat-value.red {
    color: var(--danger);
}

/* Monitor & Log Split View */
.split-view {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    /* Monitor 稍大一点 */
    gap: 24px;
    height: 500px;
    /* 固定高度 */
}

.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 24px;
}

.form-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-body label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.settings-panel {
    max-width: 760px;
}

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

.panel-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
}

.action-btn:hover {
    background: #f3f4f6;
}

.monitor-body {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px;
}

.monitor-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: contain;
}

.log-body {
    flex: 1;
    background: var(--terminal-bg);
    padding: 16px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
}

.log-entry {
    margin-bottom: 2px;
    word-break: break-all;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2px 0;
}

.hidden {
    display: none !important;
}

/* Table Styling */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

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

.mono {
    font-family: Consolas, 'JetBrains Mono', monospace;
}

.small-cell {
    max-width: 360px;
    font-size: 12px;
    color: #374151;
    word-break: break-word;
}

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

.empty-tip {
    color: #666;
    text-align: center;
}

.error-text {
    color: var(--danger);
    text-align: center;
}

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

.status-tag {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    color: #4b5563;
}

.status-tag.success {
    background: #dcfce7;
    color: #166534;
}

.status-tag.fail {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 1200px) {
    .stats-grid,
    .split-view,
    .grid-2 {
        grid-template-columns: 1fr;
        height: auto;
    }

    body {
        overflow: auto;
        height: auto;
    }

    .sidebar {
        min-height: 100vh;
    }
}

th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-sub);
    text-align: left;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 24px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f9fafb;
}

.status-pill {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pill.success {
    background: #dcfce7;
    color: #166534;
}

.status-pill.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill.neutral {
    background: #f3f4f6;
    color: #4b5563;
}
