/* monopole.systems // four-quadrant systems dashboard */

:root {
    --bg-terminal: #0d1117;
    --bg-panel: #161b22;
    --text-primary: #c9d1d9;
    --link-blue: #58a6ff;
    --status-green: #3fb950;
    --alert-red: #f85149;
    --warn-yellow: #d29922;
    --border-dark: #21262d;

    --text-dim: #6e7681;
    --text-mid: #8b949e;

    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

    --metrics-bar-h: 36px;
    --status-bar-h: 28px;
    --gap: 12px;
}

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

html, body {
    height: 100%;
    background: var(--bg-terminal);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(1200px 800px at 80% -10%, rgba(88, 166, 255, 0.06), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(63, 185, 80, 0.04), transparent 60%),
        linear-gradient(var(--bg-terminal), var(--bg-terminal));
    background-attachment: fixed;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--link-blue);
    background: rgba(88, 166, 255, 0.08);
    padding: 1px 6px;
    border-radius: 3px;
}

/* ===== Metrics top bar ===== */

.metrics-bar {
    height: var(--metrics-bar-h);
    background: var(--bg-terminal);
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.metrics-bar::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.4), transparent);
    opacity: 0.6;
    pointer-events: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.brand-mark {
    color: var(--status-green);
    font-weight: 600;
}

.brand-name {
    color: var(--text-primary);
    font-weight: 500;
}

.brand-tag {
    color: var(--text-dim);
}

.metrics-stream {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.metric {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.metric-label {
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.metric-value {
    color: var(--status-green);
    font-weight: 500;
}

.metric-sep {
    color: var(--border-dark);
    user-select: none;
}

.clock {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-mid);
    flex-shrink: 0;
}

.clock-label {
    color: var(--text-dim);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.clock-value {
    color: var(--link-blue);
    font-weight: 500;
}

/* ===== Dashboard grid ===== */

.dashboard {
    display: grid;
    grid-template: 1fr 1fr / 1fr 1fr;
    gap: var(--gap);
    flex: 1;
    padding: var(--gap);
    min-height: 0;
}

.quadrant {
    background: var(--bg-panel);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.quadrant::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.quadrant:hover {
    border-color: rgba(88, 166, 255, 0.35);
}

.quadrant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-dark);
    background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
    flex-shrink: 0;
    gap: 12px;
}

.quadrant-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.quadrant-title h2 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: var(--text-primary);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    background: rgba(88, 166, 255, 0.04);
}

.quadrant-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.quadrant-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== Status dots ===== */

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-dim);
}

.dot-healthy {
    background: var(--status-green);
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.4);
    animation: pulseHealthy 2.4s ease-in-out infinite;
}

.dot-warning {
    background: var(--warn-yellow);
}

.dot-critical {
    background: var(--alert-red);
    box-shadow: 0 0 6px rgba(248, 81, 73, 0.6);
    animation: pulseCritical 1.1s ease-in-out infinite;
}

@keyframes pulseHealthy {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.45); }
    50% { box-shadow: 0 0 0 4px rgba(63, 185, 80, 0); }
}

@keyframes pulseCritical {
    0%, 100% { box-shadow: 0 0 4px rgba(248, 81, 73, 0.6); }
    50% { box-shadow: 0 0 10px rgba(248, 81, 73, 0.9); }
}

.badge {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.08em;
    font-weight: 500;
    text-transform: uppercase;
    border: 1px solid var(--border-dark);
}

.badge-healthy {
    color: var(--status-green);
    border-color: rgba(63, 185, 80, 0.4);
    background: rgba(63, 185, 80, 0.08);
}

.badge-info {
    color: var(--link-blue);
    border-color: rgba(88, 166, 255, 0.4);
    background: rgba(88, 166, 255, 0.08);
}

.badge-warn {
    color: var(--warn-yellow);
    border-color: rgba(210, 153, 34, 0.4);
    background: rgba(210, 153, 34, 0.08);
}

.badge-critical {
    color: var(--alert-red);
    border-color: rgba(248, 81, 73, 0.4);
    background: rgba(248, 81, 73, 0.08);
}

.micro {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* ===== Q1 Status ===== */

.status-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) transparent;
}

.status-list::-webkit-scrollbar {
    width: 6px;
}

.status-list::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 3px;
}

.status-row {
    display: grid;
    grid-template-columns: 14px 1fr auto 80px 44px;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    border-left: 2px solid transparent;
    transition: background 0.15s ease;
}

.status-row:hover {
    background: rgba(88, 166, 255, 0.04);
    border-left-color: var(--link-blue);
}

.row-label {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-meta {
    color: var(--text-dim);
    font-size: 0.7rem;
}

.row-bar {
    height: 4px;
    background: rgba(110, 118, 129, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--status-green), rgba(63, 185, 80, 0.6));
    transition: width 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.bar-fill.bar-warning {
    background: linear-gradient(90deg, var(--warn-yellow), rgba(210, 153, 34, 0.5));
}

.bar-fill.bar-critical {
    background: linear-gradient(90deg, var(--alert-red), rgba(248, 81, 73, 0.5));
}

.row-value {
    color: var(--text-mid);
    text-align: right;
    font-size: 0.75rem;
}

.status-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border-top: 1px solid var(--border-dark);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-mid);
    flex-shrink: 0;
}

/* ===== Q2 Network Map ===== */

.quadrant-body-graph {
    position: relative;
    padding: 4px;
}

.netmap {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.netmap-grid line {
    stroke: rgba(110, 118, 129, 0.12);
    stroke-width: 1;
}

.netmap-links line {
    stroke: rgba(88, 166, 255, 0.25);
    stroke-width: 1;
    transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.netmap-links line.active {
    stroke: rgba(88, 166, 255, 0.7);
    stroke-width: 1.5;
}

.netmap-pulses circle {
    fill: var(--link-blue);
    opacity: 0.85;
}

.netmap-nodes g.node {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.netmap-nodes g.node:hover {
    transform: scale(1.15);
    transform-origin: center;
}

.netmap-nodes circle.halo {
    fill-opacity: 0.35;
}

.netmap-nodes circle.core {
    stroke: var(--bg-panel);
    stroke-width: 1.2;
}

.netmap-nodes circle.core.healthy { fill: var(--status-green); }
.netmap-nodes circle.core.warning { fill: var(--warn-yellow); }
.netmap-nodes circle.core.critical { fill: var(--alert-red); }

.netmap-nodes text {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--text-mid);
    pointer-events: none;
    text-anchor: middle;
}

.netmap-legend {
    position: absolute;
    bottom: 10px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}

.netmap-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.netmap-hover {
    margin-left: auto;
    color: var(--link-blue);
}

/* ===== Q3 Event Log ===== */

.ghost-btn {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    padding: 3px 8px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.ghost-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-mid);
}

.ghost-btn.active {
    color: var(--link-blue);
    border-color: rgba(88, 166, 255, 0.5);
    background: rgba(88, 166, 255, 0.08);
}

.quadrant-body-log {
    padding: 0;
}

.event-log {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) transparent;
}

.event-log::-webkit-scrollbar {
    width: 6px;
}

.event-log::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 3px;
}

.event-row {
    display: grid;
    grid-template-columns: 96px 56px 1fr;
    gap: 10px;
    padding: 5px 14px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    border-left: 2px solid transparent;
    color: var(--text-mid);
    align-items: baseline;
    transition: background 0.15s ease;
}

.event-row:hover {
    background: rgba(88, 166, 255, 0.04);
}

.event-row.severity-info { border-left-color: var(--link-blue); }
.event-row.severity-warn { border-left-color: var(--warn-yellow); }
.event-row.severity-err { border-left-color: var(--alert-red); }

.event-row.new-row {
    animation: rowFlash 0.6s ease-out;
}

@keyframes rowFlash {
    0% { background: rgba(88, 166, 255, 0.18); }
    100% { background: transparent; }
}

.event-time {
    color: var(--text-dim);
    font-size: 0.72rem;
}

.event-tag {
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

.event-row.severity-info .event-tag { color: var(--link-blue); }
.event-row.severity-warn .event-tag { color: var(--warn-yellow); }
.event-row.severity-err .event-tag { color: var(--alert-red); }

.event-msg {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-msg .src {
    color: var(--text-dim);
    margin-right: 4px;
}

.log-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-dark);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    flex-shrink: 0;
    color: var(--status-green);
}

.cursor-prompt {
    color: var(--status-green);
}

.cursor-blink {
    color: var(--status-green);
    animation: blink 1.05s steps(1) infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

.log-footer .micro {
    margin-left: auto;
}

/* ===== Q4 Documentation ===== */

.quadrant-body-docs {
    padding: 0;
}

.docs-nav {
    display: flex;
    gap: 4px;
    padding: 8px 14px 0;
    border-bottom: 1px solid var(--border-dark);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.docs-tab {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-dim);
    padding: 6px 12px 8px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

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

.docs-tab.active {
    color: var(--link-blue);
    border-bottom-color: var(--link-blue);
}

.docs-panels {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) transparent;
}

.docs-panels::-webkit-scrollbar {
    width: 6px;
}

.docs-panels::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 3px;
}

.docs-panel {
    display: none;
    animation: fadeIn 0.25s ease;
}

.docs-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.docs-panel h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.docs-panel p {
    font-size: 0.85rem;
    color: var(--text-mid);
    margin-bottom: 12px;
    line-height: 1.55;
}

.docs-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: grid;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.docs-list li {
    color: var(--text-primary);
    padding: 5px 0;
    border-bottom: 1px dashed var(--border-dark);
}

.docs-list li:last-child {
    border-bottom: none;
}

.kbd {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 1px 6px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    color: var(--link-blue);
    background: rgba(88, 166, 255, 0.06);
    margin-right: 6px;
}

.codeblock {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    background: var(--bg-terminal);
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    padding: 10px 12px;
    line-height: 1.55;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre;
}

.c-c { color: var(--text-dim); }
.c-k { color: var(--link-blue); }
.c-g { color: var(--status-green); }
.c-r { color: var(--alert-red); }
.c-y { color: var(--warn-yellow); }

.docs-endpoints {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 4px;
}

.docs-endpoints li {
    display: grid;
    grid-template-columns: 48px auto 1fr;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-dark);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.docs-endpoints li:last-child { border-bottom: none; }

.docs-endpoints code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.verb {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-align: center;
    padding: 2px 0;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.06em;
    border: 1px solid;
}

.verb-get { color: var(--status-green); border-color: rgba(63,185,80,0.4); background: rgba(63,185,80,0.08); }
.verb-post { color: var(--link-blue); border-color: rgba(88,166,255,0.4); background: rgba(88,166,255,0.08); }
.verb-put { color: var(--warn-yellow); border-color: rgba(210,153,34,0.4); background: rgba(210,153,34,0.08); }
.verb-del { color: var(--alert-red); border-color: rgba(248,81,73,0.4); background: rgba(248,81,73,0.08); }

.endpoint-note {
    color: var(--text-dim);
    font-size: 0.74rem;
    text-align: right;
}

.docs-callout {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    padding: 10px 12px;
    border-left: 2px solid var(--warn-yellow);
    background: rgba(210, 153, 34, 0.06);
    color: var(--warn-yellow);
    border-radius: 0 3px 3px 0;
    margin-top: 8px;
}

/* ===== Status bar ===== */

.status-bar {
    height: var(--status-bar-h);
    background: var(--bg-terminal);
    border-top: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 14px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    flex-shrink: 0;
}

.status-text {
    color: var(--text-mid);
    white-space: nowrap;
}

.status-sep {
    color: var(--border-dark);
}

.status-center {
    flex: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.ticker {
    color: var(--link-blue);
    white-space: nowrap;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.status-right .kbd {
    margin-right: 0;
}

/* ===== Responsive collapse ===== */

@media (max-width: 980px) {
    .dashboard {
        grid-template: repeat(4, minmax(280px, 1fr)) / 1fr;
    }
    html, body {
        overflow: auto;
    }
    body {
        height: auto;
        min-height: 100vh;
    }
}

@media (max-width: 720px) {
    .brand-tag {
        display: none;
    }
    .metrics-bar {
        gap: 10px;
        padding: 0 10px;
    }
    .metrics-stream {
        font-size: 0.7rem;
        gap: 8px;
    }
    .metric-sep {
        display: none;
    }
    .status-row {
        grid-template-columns: 14px 1fr 60px 40px;
    }
    .status-row .row-meta {
        display: none;
    }
    .endpoint-note {
        display: none;
    }
    .docs-endpoints li {
        grid-template-columns: 48px 1fr;
    }
    .status-bar {
        font-size: 0.66rem;
    }
    .status-right .status-text:first-child {
        display: none;
    }
}
