/* © 2026 Irixs B.V. — Irixs Insight UI (Irixs brand book) */

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

:root {
    /* Surfaces */
    --paper:#FAF7F2; --cream:#F2EBDD; --tan:#E5D8C2; --white:#FFFFFF;
    /* Text */
    --ink:#1A0E22; --ink-soft:#3A2E45; --muted:#6E6878;
    /* Brand */
    --purple:#340C46; --purple-light:#46235A; --purple-mid:#7D2776; --purple-deep:#1B0626;
    /* Accent */
    --yellow:#FDB940; --yellow-soft:#FDE2A8; --yellow-deep:#A06200;
    --cyan:#0081BD; --orange:#F68C3D; --pink:#C64B9B;
    /* Status */
    --success:#1A7F4B; --success-soft:#D1FAE5;
    --warning:#A06200; --warning-soft:#FDE2A8;
    --danger:#B91C1C; --danger-soft:#FEE2E2;
    --info:#0081BD; --info-soft:#DBEAFE;
    /* Structure */
    --rule:rgba(52,12,70,.14); --rule-soft:rgba(52,12,70,.07); --rule-focus:rgba(52,12,70,.55);
    --ease:cubic-bezier(.22,.61,.36,1); --ease-out:cubic-bezier(.16,1,.3,1);
    --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px;
    --space-6:24px; --space-8:32px; --space-10:40px; --space-12:48px; --space-16:64px;
    --radius-sm:4px; --radius-md:6px; --radius-lg:10px; --radius-pill:999px;
    --shadow-sm:0 1px 3px rgba(52,12,70,.08),0 1px 2px rgba(52,12,70,.06);
    --shadow-md:0 4px 12px rgba(52,12,70,.10),0 2px 6px rgba(52,12,70,.07);
    --shadow-lg:0 12px 32px rgba(52,12,70,.14),0 4px 12px rgba(52,12,70,.08);
}

html, body { height: 100%; }
body {
    font-family: 'Poppins', sans-serif;
    background: var(--paper); color: var(--ink);
    font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography helpers ─────────────────────────────────────────────── */
.text-h3 { font-size: clamp(18px,1.6vw,22px); font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; }
.text-body { font-size: 15px; line-height: 1.6; font-weight: 400; }
.eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
    color: var(--purple); display: inline-flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.eyebrow::before { content: ""; width: 20px; height: 1px; background: var(--purple); }
.muted-note { font-size: 13.5px; color: var(--muted); }
.section-caption {
    font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); margin: 14px 0 8px;
}
.accent-bar {
    width: 48px; height: 3px; border-radius: 2px;
    background: linear-gradient(90deg, var(--yellow), var(--purple-mid)); margin: 14px 0 0;
}

/* ── App shell ──────────────────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 60px 1fr;
    height: 100vh; overflow: hidden;
}
.topnav {
    grid-column: 1 / -1;
    height: 60px; background: var(--purple-deep);
    display: flex; align-items: center; gap: 24px; padding: 0 24px;
    border-bottom: 1px solid rgba(250,247,242,.10); z-index: 100;
}
.topnav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.topnav-brand:hover { text-decoration: none; }
.topnav-logo { height: 28px; width: auto; }
.topnav-product {
    color: var(--paper); font-weight: 600; font-size: 15px; letter-spacing: .01em;
    padding-left: 12px; border-left: 1px solid rgba(250,247,242,.18);
}
.topnav-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topnav-user { color: rgba(250,247,242,.78); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav-signout { color: var(--paper) !important; border-color: rgba(250,247,242,.25) !important; }
.topnav-signout:hover { background: rgba(250,247,242,.10) !important; }

.workspace-switcher { display: inline-flex; align-items: center; gap: 8px; }
.workspace-switcher-icon { font-size: 14px; filter: grayscale(1) brightness(1.6); }
.workspace-select {
    font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 500;
    color: var(--paper); background: rgba(250,247,242,.10);
    border: 1px solid rgba(250,247,242,.20); border-radius: var(--radius-md);
    padding: 6px 10px; cursor: pointer; max-width: 260px;
}
.workspace-select option { color: var(--ink); }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.app-sidebar {
    background: var(--paper); border-right: 1px solid var(--rule);
    padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
}
.sidebar-label {
    font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
    color: var(--muted); padding: 16px 12px 6px;
}
.sidebar-search { padding: 0 8px 8px; }
.sidebar-apps { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }
.sidebar-item {
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500; color: var(--ink-soft);
    text-decoration: none; cursor: pointer; transition: all .15s var(--ease);
}
.sidebar-item:hover { background: var(--cream); color: var(--ink); text-decoration: none; }
.sidebar-item.active { background: rgba(52,12,70,.08); color: var(--purple); font-weight: 600; }
.sidebar-item.active::before {
    content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px;
    background: var(--yellow); border-radius: 0 2px 2px 0;
}
.sidebar-item-icon { font-size: 13px; opacity: .8; flex-shrink: 0; }
.sidebar-app-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.app-content { overflow-y: auto; padding: 32px; background: var(--paper); }

/* ── Page header ────────────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: clamp(22px,2.5vw,28px); font-weight: 600; color: var(--ink); letter-spacing: -0.025em; }
.page-subtitle { font-size: 14px; color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb-sep { color: var(--tan); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-md);
    font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 600;
    cursor: pointer; border: none; transition: all .2s var(--ease); white-space: nowrap;
}
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-primary { background: var(--purple); color: var(--paper); }
.btn-primary:hover { background: var(--purple-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; color: var(--purple); border: 1.5px solid var(--purple); }
.btn-secondary:hover { background: var(--cream); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--rule); }
.btn-ghost:hover { background: var(--cream); border-color: var(--tan); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-control {
    width: 100%; padding: 9px 13px; border: 1.5px solid var(--tan); border-radius: var(--radius-md);
    font-family: 'Poppins', sans-serif; font-size: 14px; color: var(--ink); background: var(--white); line-height: 1.5;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control::placeholder { color: var(--muted); font-weight: 300; }
.form-control:hover { border-color: var(--purple-mid); }
.form-control:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(52,12,70,.12); }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
.range-select { width: auto; padding-right: 30px; cursor: pointer; }

.input-affix { position: relative; display: inline-flex; align-items: center; }
.input-affix .form-control { padding-left: 32px; min-width: 240px; }
.input-affix-icon { position: absolute; left: 10px; font-size: 12px; opacity: .6; pointer-events: none; }

/* ── Cards & grid ───────────────────────────────────────────────────── */
.card-grid { display: grid; gap: 20px; }
.card-grid-4 { grid-template-columns: repeat(4,1fr); }
@media (max-width:900px) { .card-grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width:520px) { .card-grid-4 { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-lg);
    padding: 22px 20px; position: relative; overflow: hidden;
}
.stat-card::before {
    content: ""; position: absolute; left: 0; top: 0; height: 4px; width: 100%;
    background: linear-gradient(90deg, var(--yellow), var(--cyan));
}
.stat-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.stat-value { font-size: 34px; font-weight: 600; color: var(--purple); line-height: 1; letter-spacing: -0.04em; margin-top: 10px; }

/* ── Panels ─────────────────────────────────────────────────────────── */
.panel { background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; }
.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.panel-body { padding: 20px; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; }
.table-wrap.table-flush { border: none; border-radius: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead { background: var(--cream); }
.data-table th {
    padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .10em;
    text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule);
}
.data-table td { padding: 12px 16px; color: var(--ink-soft); border-bottom: 1px solid var(--rule-soft); line-height: 1.5; vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s var(--ease); }
.data-table tbody tr:hover { background: var(--cream); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.num-danger { color: var(--danger); }
.data-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table th.sortable:hover { color: var(--purple); }
.data-table th.sort-asc::after { content: " ↑"; color: var(--purple); }
.data-table th.sort-desc::after { content: " ↓"; color: var(--purple); }
.row-clickable { cursor: pointer; }
.row-danger { background: rgba(185,28,28,.05); }
.row-detail td { background: var(--paper); padding: 16px 20px; }
.row-detail:hover td { background: var(--paper); }
.app-name { font-weight: 600; color: var(--ink); }
.cell-muted { color: var(--muted); font-size: 13px; }
.cell-mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.cell-break { word-break: break-word; }
.cell-sub { color: var(--muted); font-size: 12px; margin-left: 4px; }
.cell-chevron { text-align: right; color: var(--muted); }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}
.badge-default { background: var(--cream); color: var(--ink-soft); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ── Period deltas & anomalies ──────────────────────────────────────── */
.panel-subtitle { font-size: 12.5px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta-up { color: var(--danger); }
.delta-down { color: var(--success); }
.delta-neutral { color: var(--muted); }
.data-table td .delta { margin-top: 0; justify-content: flex-end; }
.attention-phrase { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.empty-state.empty-state-sm { padding: 28px 24px; }
.empty-state.empty-state-sm .empty-state-icon { width: 40px; height: 40px; font-size: 18px; margin-bottom: 12px; color: var(--success); }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); }
.tab {
    padding: 10px 18px; font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 500; color: var(--muted);
    background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; transition: all .15s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--purple); font-weight: 600; border-bottom-color: var(--purple); }
.tab-count { display: inline-flex; padding: 0 7px; background: var(--cream); color: var(--ink-soft); border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; margin-left: 4px; }

/* ── Filter pills ───────────────────────────────────────────────────── */
.runs-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
    padding: 6px 14px; border-radius: var(--radius-pill); font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 500;
    border: 1px solid var(--rule); background: var(--white); color: var(--ink-soft); cursor: pointer; transition: all .15s var(--ease);
}
.filter-pill:hover { border-color: var(--purple); color: var(--purple); }
.filter-pill.active { background: var(--purple); color: var(--paper); border-color: var(--purple); }
.runs-search { margin-left: auto; }

/* ── Trend chart ────────────────────────────────────────────────────── */
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.trend-chart { display: flex; align-items: flex-end; gap: 4px; }
.trend-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.trend-bars { width: 100%; height: 122px; display: flex; flex-direction: column; justify-content: flex-end; }
.trend-fail { background: var(--danger); border-radius: 3px 3px 0 0; }
.trend-ok { background: var(--success); }
.trend-label { font-size: .62rem; color: var(--muted); margin-top: 4px; white-space: nowrap; text-align: center; }
.trend-label.dense { writing-mode: vertical-rl; text-orientation: mixed; height: 42px; font-size: .58rem; }

/* ── Cause bars ─────────────────────────────────────────────────────── */
.bar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.bar-row-label { flex: 0 0 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.bar-track { flex: 1 1 auto; height: 14px; background: var(--cream); border-radius: var(--radius-pill); overflow: hidden; }
.bar-fill { height: 14px; background: var(--danger); border-radius: var(--radius-pill); }
.bar-row-value { flex: 0 0 64px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }

/* ── Run detail / timeline ──────────────────────────────────────────── */
.run-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; margin-bottom: 14px; }
.run-meta-label { color: var(--muted); margin-right: 6px; }
.run-meta-counts { display: flex; gap: 6px; }
.timeline { border-left: 2px solid var(--tan); padding-left: 16px; margin-left: 4px; }
.timeline-row { margin-bottom: 10px; }
.timeline-head { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.timeline-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-icon { width: 16px; text-align: center; font-size: 11px; }
.timeline-icon.err { color: var(--danger); }
.timeline-icon.start, .timeline-icon.end { color: var(--muted); }
.timeline-icon.dot { color: var(--success); }
.timeline-name { color: var(--ink-soft); }
.timeline-name.err { color: var(--danger); font-weight: 600; }
.subtask-badge { font-weight: 400; }
.timeline-metrics { color: var(--muted); font-size: 12px; }
.timeline-chevron { margin-left: auto; color: var(--muted); }
.timeline-error { margin: 8px 0 0; }
.timeline-corr { font-size: 12px; margin-top: 6px; }
.event-detail { margin: 8px 0 0 24px; padding: 12px; background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-md); }
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 20px; }
@media (max-width:700px) { .kv-grid { grid-template-columns: 1fr; } }
.kv-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--rule-soft); padding: 5px 0; font-size: 13px; }
.kv-key { color: var(--muted); }
.kv-val { color: var(--ink-soft); text-align: right; }
.details-block { margin-top: 8px; }
.details-block summary { cursor: pointer; font-size: 13px; color: var(--purple); }
.stacktrace {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .72rem; white-space: pre-wrap;
    max-height: 240px; overflow: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 10px; margin-top: 6px;
}

/* ── Alerts ─────────────────────────────────────────────────────────── */
.alert { display: block; padding: 12px 14px; border-radius: var(--radius-md); border-left: 4px solid; font-size: 13.5px; line-height: 1.5; }
.alert-danger { background: var(--danger-soft); border-color: var(--danger); color: #7F1D1D; }

/* ── Loading / empty ────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--tan); border-top-color: var(--purple); animation: spin .7s linear infinite; vertical-align: middle; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--cream) 25%, var(--tan) 50%, var(--cream) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
.skeleton-text { height: 14px; } .skeleton-title { height: 22px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 48px 24px; text-align: center; }
.empty-state-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--cream); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 24px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.empty-state-body { font-size: 14px; color: var(--muted); max-width: 40ch; }
.load-sentinel { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; }

/* ── Splash / login / access denied ─────────────────────────────────── */
.app-splash { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; height: 100vh; color: var(--muted); }
.login-shell { display: grid; place-items: center; min-height: 100vh; background: var(--purple-deep); padding: 24px; }
.login-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px; width: min(420px, 100%); text-align: center; }
.login-logo { height: 40px; margin-bottom: 24px; }
.access-denied { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100vh; text-align: center; padding: 24px; }
.access-denied-icon { font-size: 40px; }

/* ── Blazor error UI ────────────────────────────────────────────────── */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: var(--danger-soft); color: #7F1D1D; padding: 12px 20px; box-shadow: var(--shadow-md); font-size: 14px;
}
#blazor-error-ui .reload { color: #7F1D1D; font-weight: 600; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── Responsive shell ───────────────────────────────────────────────── */
@media (max-width:768px) {
    .app-shell { grid-template-columns: 1fr; grid-template-rows: 60px auto 1fr; }
    .app-sidebar { grid-column: 1 / -1; max-height: 220px; border-right: none; border-bottom: 1px solid var(--rule); }
    .topnav-user { display: none; }
}
