:root {
    --bg: #0A0F18;
    --surface: #111827;
    --surface-2: #1A2436;
    --text: #E8EEF6;
    --text-muted: #8CA0B8;
    --text-dim: #8CA0B8;
    --text-faint: #5C6F88;
    --border: #26354A;
    --border-strong: #31435C;
    --accent: #38BDF8;
    --accent-dim: #0E2A3A;
    --ok: #34D399;
    --warn: #FBBF24;
    --risk: #F87171;
    --risk-bg: #2A1216;
    --radius: 8px;
    --radius-sm: 5px;
    --gap: 14px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-lift: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px var(--border);
}

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

body {
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 26px;
    font-weight: 650;
    color: var(--accent);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Grid Layouts */
.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
}

@media (max-width: 1200px) {
    .grid-3col {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--gap);
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 16px;
    font-weight: 650;
    margin-bottom: 16px;
    color: var(--text);
}

.status-group {
    margin-bottom: 16px;
}

.status-group:last-child {
    margin-bottom: 0;
}

.status-group h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-value {
    font-weight: 600;
    color: var(--text);
}

.metric-value.ok {
    color: var(--ok);
}

.metric-value.warn {
    color: var(--warn);
}

.metric-value.risk {
    color: var(--risk);
}

/* Status Indicators */
.status-indicator::before {
    content: '●';
    margin-right: 6px;
}

.status-indicator.online {
    color: var(--ok);
}

.status-indicator.offline {
    color: var(--risk);
}

.status-indicator.unknown {
    color: var(--text-muted);
}

/* Buttons */
.btn-icon {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

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

/* Tasks */
.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tasks-filters {
    display: flex;
    gap: 8px;
}

.filter-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--text);
}

.filter-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--gap);
}

.task-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.2s;
}

.task-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lift);
}

.task-item.overdue {
    border-left: 3px solid var(--risk);
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.task-checkbox {
    margin-top: 2px;
}

.task-label {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.task-track {
    padding: 2px 8px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.task-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.task-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.task-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--gap);
}

.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    position: relative;
}

.service-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
}

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

.service-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.service-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.service-status {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 12px;
}

.service-status.online {
    color: var(--ok);
}

.service-status.offline {
    color: var(--risk);
}

/* Logs */
.logs-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.logs-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    max-height: 600px;
    overflow-y: auto;
}

.log-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-family: ui-monospace, monospace;
    font-size: 13px;
}

.log-item:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: var(--text-muted);
    margin-right: 12px;
}

.log-type {
    color: var(--accent);
    margin-right: 12px;
}

.log-level-info {
    color: var(--ok);
}

.log-level-warn {
    color: var(--warn);
}

.log-level-error {
    color: var(--risk);
}

/* Alerts */
.alerts-container {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warn);
    background: var(--surface-2);
}

.alert-item.warning {
    border-left-color: var(--warn);
}

.alert-item.error {
    border-left-color: var(--risk);
}

.alert-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.alert-message {
    font-size: 13px;
}

/* Cron Jobs */
.cron-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.cron-item:last-child {
    border-bottom: none;
}

.cron-name {
    font-weight: 600;
    margin-bottom: 4px;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lift);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 650;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Loading */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}
