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

:root {
    --bg: #07060C;
    --surface: #0f0e14;
    --surface-hover: #1a1820;
    --border: #27242f;
    --text: #FFFFFF;
    --text-muted: #a0a0aa;
    --primary: #5BF4AE;
    --primary-hover: #4de09d;
    --secondary: #F9BD48;
    --tertiary-purple: #CD71FD;
    --tertiary-blue: #5DBEF5;
    --success: #5BF4AE;
    --warning: #F9BD48;
    --danger: #ff6b6b;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Login */
.login-card {
    max-width: 400px;
    margin: 15vh auto;
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.login-logo {
    height: 32px;
    margin-bottom: 1.5rem;
}
.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block; font-size: 0.875rem; color: var(--text-muted);
    margin-bottom: 0.5rem; font-weight: 500;
}
.form-group input {
    width: 100%; padding: 0.75rem 1rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 0.9rem; transition: all 0.2s ease;
}
.form-group input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 244, 174, 0.1);
}
.error { color: var(--danger); font-size: 0.875rem; margin-top: 1rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.625rem 1.25rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.875rem;
    transition: all 0.2s ease; font-weight: 500;
}
.btn:hover { background: var(--surface-hover); border-color: var(--primary); }
.btn-primary {
    background: var(--primary); border-color: var(--primary); color: var(--bg);
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 20px rgba(91, 244, 174, 0.3);
}
.btn-sm { padding: 0.375rem 1rem; font-size: 0.8rem; }

/* Header */
header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem; border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.header-logo {
    height: 28px;
}
.header-right { display: flex; align-items: center; gap: 1rem; }
#user-display { color: var(--text-muted); font-size: 0.875rem; }

/* Badge */
.badge {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600;
}
.badge-online { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-offline { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--primary); }

/* Main */
main { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-header h2 { font-size: 1.5rem; font-weight: 600; }
.controls { display: flex; gap: 0.75rem; margin-left: auto; }
.controls input, .controls select {
    padding: 0.5rem 1rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.875rem; transition: border-color 0.2s;
}
.controls input:focus, .controls select:focus {
    outline: none; border-color: var(--primary);
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 1rem; text-align: left; border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
th {
    color: var(--text-muted); font-weight: 600; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface);
}
tbody tr { cursor: pointer; transition: all 0.2s ease; }
tbody tr:hover { background: rgba(91, 244, 174, 0.05); }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.online { background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.status-dot.offline { background: var(--danger); }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
    padding: 0.5rem 1rem; border: none; background: none; color: var(--text-muted);
    cursor: pointer; font-size: 0.875rem; border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Log Viewer */
.log-controls { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.log-controls select {
    padding: 0.5rem 1rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.875rem; transition: border-color 0.2s;
}
.log-controls select:focus { outline: none; border-color: var(--primary); }
.log-viewer {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.25rem; font-family: var(--mono); font-size: 0.8rem;
    max-height: 500px; overflow-y: auto; line-height: 1.6;
}
.log-line { white-space: pre-wrap; word-break: break-all; }
.log-line .ts { color: var(--text-muted); }
.log-line .level-INFO { color: var(--tertiary-blue); }
.log-line .level-WARNING { color: var(--warning); }
.log-line .level-ERROR { color: var(--danger); }
.log-line .source { color: var(--tertiary-purple); }

/* Info Grid */
.info-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem;
}
.info-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.5rem;
    transition: all 0.2s ease;
}
.info-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(91, 244, 174, 0.1);
}
.info-card .label {
    font-size: 0.75rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.info-card .value { font-size: 1.25rem; margin-top: 0.5rem; font-weight: 600; }

/* Data Table */
.data-table { width: 100%; }
.data-table tbody tr { cursor: default; }

/* Navigation */
.main-nav {
    display: inline-flex;
    gap: 1rem;
    margin-left: 2rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-link.active {
    background: rgba(91, 244, 174, 0.15);
    color: var(--primary);
    border: 1px solid rgba(91, 244, 174, 0.3);
}

/* Approvals */
.badge-warning {
    background: #ffc107;
    color: #000;
}

.badge-success {
    background: #28a745;
    color: white;
}

.actions {
    white-space: nowrap;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.modal-body {
    padding: 1.75rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.modal-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

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

/* Workflow tree */
.workflow-tree { margin-top: 1.25rem; }

.task-list { display: flex; flex-direction: column; gap: 2px; }

.task-node { border-radius: 8px; transition: background 0.15s; }
.task-node.task-disabled { opacity: 0.5; }

.task-node-header {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}
.task-node-header:hover { border-color: rgba(91, 244, 174, 0.3); }

.task-icon {
    font-size: 0.625rem; color: var(--text-muted); width: 1rem; text-align: center; flex-shrink: 0;
}
.task-toggle { cursor: pointer; }
.task-toggle:hover { color: var(--primary); }

.task-name { font-size: 0.875rem; font-weight: 500; flex: 1; }

.task-type-badge {
    display: inline-flex; padding: 0.125rem 0.5rem;
    background: rgba(205, 113, 253, 0.15); color: var(--tertiary-purple);
    border-radius: 9999px; font-size: 0.6875rem; font-weight: 600;
}

.task-disabled-badge {
    display: inline-flex; padding: 0.125rem 0.5rem;
    background: rgba(255, 107, 107, 0.15); color: var(--danger);
    border-radius: 9999px; font-size: 0.6875rem; font-weight: 600;
}

.task-result { width: 1.25rem; text-align: center; flex-shrink: 0; }

.task-children {
    margin-left: 1.25rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
    margin-top: 2px;
}
