/* Base styles shared across all pages */
:root {
    --accent: #667eea;
    --accent2: #764ba2;
    --green: #10b981;
    --red: #ef4444;
    --orange: #f59e0b;
    --surface: #ffffff;
    --soft: #f4f7fb;
    --line: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --button-radius: 10px;
    --button-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    --button-shadow-hover: 0 12px 24px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f7fa;
    color: var(--text);
}

/* ── Page header ── */
.page-header {
    padding: 16px 24px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(248,250,252,0.96) 0%, rgba(243,247,252,0.96) 100%);
    color: #607085;
}
.page-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-kicker {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #6c757d;
    margin-bottom: 6px;
}
.page-header-copy p {
    margin: 0;
    max-width: 720px;
    line-height: 1.55;
    font-size: 14px;
}
.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Navigation links ── */
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: var(--button-radius);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: white;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: var(--button-shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.nav-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--button-shadow-hover);
    filter: brightness(1.02);
}
.nav-link.home    { background: #6c757d; }
.nav-link.jobs    { background: #28a745; }
.nav-link.struct  { background: #f59e0b; }
.nav-link.neb     { background: #8b5cf6; }
.nav-link.setup   { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.nav-link.api     { background: #0ea5e9; }
.nav-link.logout  { background: #dc3545; }

/* ── Container card ── */
.container {
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(217,229,244,0.9);
    box-shadow: 0 18px 48px rgba(15,23,42,0.08);
    overflow: hidden;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Page title ── */
h1.page-title {
    color: white;
    margin: 0;
    padding: 24px 24px 20px;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,0.16), transparent 28%),
        linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    font-size: 30px;
    font-weight: 300;
    letter-spacing: -0.02em;
}

/* ── Buttons ── */
.btn,
.submit-btn,
.delete-btn,
.kill-btn,
button {
    transition: transform 0.18s ease, box-shadow 0.18s ease,
                border-color 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}
.submit-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    color: white;
    padding: 12px 35px;
    border: 1px solid rgba(93, 111, 207, 0.35);
    border-radius: var(--button-radius);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(102, 126, 234, 0.24);
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(102, 126, 234, 0.28); }

.delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(180deg, #eb5757 0%, #d93f3f 100%);
    color: white;
    padding: 7px 12px;
    border: 1px solid rgba(185, 28, 28, 0.24);
    border-radius: var(--button-radius);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: var(--button-shadow);
}
.delete-btn:hover { transform: translateY(-1px); box-shadow: var(--button-shadow-hover); }

.kill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(180deg, #ff8c00 0%, #e07800 100%);
    color: white;
    padding: 7px 12px;
    border: 1px solid rgba(180, 90, 0, 0.24);
    border-radius: var(--button-radius);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: var(--button-shadow);
}
.kill-btn:hover { transform: translateY(-1px); box-shadow: var(--button-shadow-hover); }

/* ── Forms ── */
.form-group { display: block !important; clear: both !important; float: none !important; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; color: #495057; font-size: 13px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box !important;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ── Feedback messages ── */
.loading { display: none; color: var(--accent); font-style: italic; margin-top: 15px; }
.error { color: #dc3545; background: #f8d7da; padding: 15px; border-radius: 6px; margin: 15px 0; border: 1px solid #f5c6cb; }
.success { color: #155724; background: #d4edda; padding: 15px; border-radius: 6px; margin: 15px 0; border: 1px solid #c3e6cb; }
.help-text { color: #6c757d; font-size: 12px; margin-top: 6px; }

/* ── Dict/nested sections ── */
.dict-section {
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #e8f4f8 0%, #d1ecf1 100%);
    border-radius: 8px;
    border: 2px solid #bee5eb;
    box-sizing: border-box !important;
}
.dict-section h4 {
    margin: -15px -15px 15px -15px;
    padding: 8px 15px;
    color: #0c5460;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #17a2b8;
    background: rgba(255,255,255,0.7);
    border-radius: 6px 6px 0 0;
}

/* ── Health indicator (fixed top-right) ── */
.health-indicators {
    position: fixed;
    top: 10px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #e9ecef;
    border-radius: 999px;
    padding: 4px 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 9999;
}
.tiny-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #adb5bd;
    display: inline-block;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06) inset;
}
.tiny-dot.on  { background: #28a745; }
.tiny-dot.off { background: #dc3545; }
.health-label { font-size: 11px; color: #6c757d; }

/* ── Node finder overlay ── */
.node-finder-overlay[hidden] { display: none !important; }
.node-finder-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.node-finder-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
}
.node-finder-dialog {
    position: relative;
    width: min(100%, 520px);
    padding: 28px;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.28);
    color: #1e293b;
}
.node-finder-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.9);
    color: #334155;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}
.node-finder-kicker {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
}
.node-finder-dialog h2 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: #0f172a;
}
.node-finder-copy {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}
.node-finder-form {
    display: flex;
    gap: 12px;
    align-items: stretch;
}
.node-finder-input {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    font-size: 15px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
.node-finder-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}
.node-finder-submit {
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.node-finder-submit[disabled] { opacity: 0.7; cursor: wait; }
.node-finder-status {
    min-height: 24px;
    margin-top: 14px;
    font-size: 14px;
    color: #475569;
}
.node-finder-status.error   { color: #b91c1c; }
.node-finder-status.success { color: #0f766e; }
.node-finder-hint { margin-top: 6px; font-size: 12px; color: #64748b; }
body.node-finder-open { overflow: hidden; }

/* ── Daemon toast ── */
.daemon-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2147483100;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    max-width: 380px;
    padding: 14px 18px;
    border-radius: 14px;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 14px;
    font-family: inherit;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.32);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}
.daemon-toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.daemon-toast[hidden] { display: none !important; }
.daemon-toast .daemon-toast-icon { font-size: 18px; flex-shrink: 0; }
.daemon-toast.success { background: linear-gradient(135deg, #0f766e 0%, #1d4ed8 100%); }
.daemon-toast.error   { background: linear-gradient(135deg, #b91c1c 0%, #7c3aed 100%); }
.daemon-toast.busy    { background: #334155; }

/* ── Responsive ── */
@media (max-width: 768px) {
    body { padding: 10px; }
    .page-header { padding: 16px; }
    .node-finder-overlay { padding: 14px; }
    .node-finder-dialog { padding: 22px 18px 18px; border-radius: 18px; }
    .node-finder-form { flex-direction: column; }
    .node-finder-submit { min-height: 48px; }
}
