/* ── 24U Software palette ─────────────────────────────────────────────────── */
:root {
    --color-primary:      #004B87;
    --color-primary-dark: #003660;
    --color-primary-light:#E8F0F9;
    --color-accent:       #F7941D;
    --color-bg:           #F5F6F8;
    --color-surface:      #FFFFFF;
    --color-border:       #DDE1E8;
    --color-text:         #1A1D23;
    --color-muted:        #6B7280;
    --color-danger:       #DC2626;
    --color-success:      #16A34A;
    --color-warning:      #CA8A04;

    --radius:  6px;
    --shadow:  0 1px 3px rgba(0,0,0,.10);
    --sidebar: 220px;
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
    padding: 20px 16px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.logo-mark {
    width: 32px; height: 32px;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
}
.logo-text { font-weight: 600; font-size: 16px; }

.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: rgba(255,255,255,.75);
    font-size: 14px;
    border-left: 2px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.nav-link svg { flex-shrink: 0; opacity: .8; }
.nav-link:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    text-decoration: none;
}
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-left-color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}
.nav-link.active svg { opacity: 1; }

/* Secondary nav (system tools) */
.nav-secondary {
    padding: 8px 0 12px;
    border-top: 1px solid rgba(255,255,255,.1);
}

/* Collapsible settings group */
.nav-group { border: none; }
.nav-group summary { list-style: none; user-select: none; cursor: pointer; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group-toggle { justify-content: flex-start; }
.nav-group-toggle span:first-of-type { flex: 1; }
.nav-group-chevron { opacity: .5; transition: transform .2s; margin-left: auto; }
.nav-group[open] .nav-group-chevron { transform: rotate(180deg); }
.nav-group-links { list-style: none; }
.nav-link-sub {
    padding-left: 40px;
    font-size: 13px;
    color: rgba(255,255,255,.65);
}
.nav-sync-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.nav-sync-dot.ok      { background: var(--color-success); }
.nav-sync-dot.fail    { background: var(--color-danger); }
.nav-sync-dot.slow    { background: var(--color-warning); }
.nav-sync-dot.running { background: #fff; animation: dot-pulse 1.2s ease-in-out infinite; }

/* Sidebar footer */
.sidebar-footer {
    padding: 0;
    border-top: 1px solid rgba(255,255,255,.12);
    display: flex;
    flex-direction: column;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}
.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; color: rgba(255,255,255,.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .5px; }
.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 16px;
    background: none;
    border: none;
    border-top: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.55);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background .15s, color .15s;
}
.btn-logout:hover {
    background: rgba(220,38,38,.2);
    color: #fca5a5;
}

.main-content {
    margin-left: var(--sidebar);
    flex: 1;
    padding: 28px 32px;
    max-width: 1200px;
}

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.breadcrumb {
    font-size: 13px;
    color: var(--color-muted);
    display: block;
    margin-bottom: 4px;
}
.breadcrumb:hover { color: var(--color-primary); text-decoration: none; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.card-collapsible-header { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; user-select: none; }
.card-collapsible-header h2 { margin-bottom: 0; }
.card-collapsible-header::before { content: '▶'; font-size: 9px; color: var(--color-muted); transition: transform .15s; flex-shrink: 0; }
details[open] > .card-collapsible-header::before { transform: rotate(90deg); }
.card h3 { font-size: 13px; font-weight: 600; margin: 12px 0 8px; color: var(--color-muted); text-transform: uppercase; letter-spacing: .5px; }
.mt { margin-top: 16px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Info list ───────────────────────────────────────────────────────────────── */
.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
    font-size: 14px;
}
.info-list dt { color: var(--color-muted); }
.info-list dd { font-weight: 500; }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid var(--color-border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--color-muted);
    font-weight: 600;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}
.table tbody tr:last-child td,
.table tfoot tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--color-bg); }
.table-compact td, .table-compact th { padding: 6px 10px; }
.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-sm td, .table-sm th { padding: 5px 10px; font-size: 12px; }
.table-log { font-size: 12px; }
.table-log td, .table-log th { padding: 3px 8px; }
.table-log th { font-size: 11px; padding: 4px 8px; }
.log-info { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--color-muted); color: var(--color-muted); font-size: 10px; font-weight: 700; cursor: default; line-height: 1; flex-shrink: 0; }
.log-info::after { content: attr(data-tip); position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); background: #1e293b; color: #fff; font-size: 11px; font-weight: 400; padding: 4px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 20; }
.log-info:hover::after { opacity: 1; }
.actions { white-space: nowrap; }
.muted { color: var(--color-muted); font-size: 13px; }
.text-danger { color: var(--color-danger); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    text-decoration: none;
}
.btn:hover { background: var(--color-bg); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 16px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.01em;
    min-width: 120px;
    white-space: nowrap;
}
.badge-active   { background: #DCFCE7; color: #166534; }
.badge-locked   { background: #FEE2E2; color: #991B1B; }
.badge-positive { background: #DCFCE7; color: #166534; }
.badge-negative { background: #FEE2E2; color: #991B1B; }
.badge-neutral  { background: #F3F4F6; color: #374151; }
.badge-deadline_shift { background: #FEF3C7; color: #92400E; }
.badge-manual   { background: #E0E7FF; color: #3730A3; }
.badge-category-external { background: #DBEAFE; color: #1E40AF; }
.badge-category-internal { background: #F3F4F6; color: #374151; }
.badge-category-product  { background: #DCFCE7; color: #166534; }
.badge-category-service  { background: #FEF3C7; color: #92400E; }

/* ── Event row colors ────────────────────────────────────────────────────────── */
.event-positive td:first-child { border-left: 3px solid var(--color-success); }
.event-negative td:first-child { border-left: 3px solid var(--color-danger); }
.event-deadline_shift td:first-child { border-left: 3px solid var(--color-warning); }
.event-manual td:first-child { border-left: 3px solid var(--color-primary); }

/* ── Flash messages ──────────────────────────────────────────────────────────── */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.flash-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.flash-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.flash-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
input[type="text"], input[type="url"], input[type="password"], input[type="number"], input[type="email"], input[type="search"], textarea, select {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea { resize: vertical; font-family: monospace; font-size: 13px; }
.page-tabs { display: flex; border-bottom: 2px solid var(--color-border); margin-bottom: 24px; gap: 0; }
.page-tab { padding: 8px 18px; font-size: 14px; font-weight: 500; color: var(--color-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s; }
.page-tab:hover { color: var(--color-text); }
.page-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-form h2 { font-size: 14px; font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: .5px; border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 4px; }
.settings-form h2:first-child { border-top: none; padding-top: 0; }
.form-actions { padding-top: 8px; }
.input-weight { width: 70px; padding: 4px 6px; }
small { font-size: 12px; font-weight: 400; color: var(--color-muted); }
code { background: var(--color-bg); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ── Login ───────────────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 32px;
    min-height: 100vh;
    background: #EDE5D2;
}
.login-logo-img {
    width: 100%;
    max-width: 680px;
    border-radius: 12px;
    display: block;
    margin-bottom: -80px;
    position: relative;
    z-index: 0;
}
.login-card {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 24px rgba(0,0,0,.2);
    position: relative;
    z-index: 1;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--color-muted); text-align: center; }

/* ── Phase grid (evaluation) ─────────────────────────────────────────────────── */
.balance-row { display: flex; gap: 32px; }
.balance-stat { display: flex; flex-direction: column; gap: 2px; }
.balance-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--color-muted); font-weight: 600; }
.balance-value { font-size: 22px; font-weight: 700; }

.phase-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.phase-card h2 { font-size: 16px; }
.phase-budget { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.budget-label { font-size: 13px; color: var(--color-muted); }
.budget-value { font-size: 20px; font-weight: 700; }
.progress-bar { height: 8px; background: var(--color-border); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.bar-good { background: var(--color-success); }
.bar-mid  { background: var(--color-accent); }
.bar-bad  { background: var(--color-danger); }
.phase-counts { display: flex; gap: 12px; font-size: 13px; }
.count-positive { color: var(--color-success); }
.count-negative { color: var(--color-danger); }

/* ── Mini bar (team points) ──────────────────────────────────────────────────── */
.mini-bar { display: inline-block; width: 60px; height: 6px; background: var(--color-border); border-radius: 3px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.mini-fill { height: 100%; background: var(--color-primary); border-radius: 3px; }

/* ── Timeline legend ─────────────────────────────────────────────────────────── */
.timeline-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 4px;
}
.event-positive    { background: #DCFCE7; color: #166534; }
.event-negative    { background: #FEE2E2; color: #991B1B; }
.event-neutral     { background: #F3F4F6; color: #374151; }
.event-deadline_shift { background: #FEF3C7; color: #92400E; }
.event-manual      { background: #E0E7FF; color: #3730A3; }

/* vis-timeline event colors */
.vis-item.event-positive   { background: #DCFCE7; border-color: #16A34A; }
.vis-item.event-negative   { background: #FEE2E2; border-color: #DC2626; }
.vis-item.event-neutral    { background: #F3F4F6; border-color: #9CA3AF; }
.vis-item.event-deadline_shift { background: #FEF3C7; border-color: #CA8A04; }
.vis-item.event-manual     { background: #E0E7FF; border-color: #4F46E5; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal[hidden] { display: none; }
.modal-box {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.modal-box h2 { font-size: 16px; margin-bottom: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.import-list { margin: 10px 0; padding-left: 18px; font-size: 14px; max-height: 200px; overflow-y: auto; }
.import-list li { margin-bottom: 4px; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-muted);
}

/* ── Dates bar ───────────────────────────────────────────────────────────────── */
.dates-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    background: var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}
.dates-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--color-surface);
}
.dates-bar-item:first-child { border-radius: 12px 0 0 12px; }
.dates-bar-item:last-child  { border-radius: 0 12px 12px 0; }
.dates-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}
.dates-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}
.dates-actual {
    font-size: 13px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 6px;
    display: inline-block;
    width: fit-content;
}
.dates-late { background: #FEE2E2; color: #991B1B; }

.dates-bar-past    { background: var(--color-primary-light); }
.dates-bar-past .dates-label { color: var(--color-primary); }
.dates-bar-past .dates-value { color: var(--color-primary); }
.dates-bar-current { background: var(--color-primary); }
.dates-bar-current .dates-label { color: rgba(255,255,255,.65); }
.dates-bar-current .dates-value { color: #fff; font-weight: 600; }
.dates-bar-future .dates-label { opacity: .5; }
.dates-bar-future .dates-value { color: var(--color-muted); }
.dates-ok                    { background: var(--color-primary); color: #fff; }
.dates-bar-current .dates-ok { background: rgba(255,255,255,.25); color: #fff; }

/* ── Clickable table rows ────────────────────────────────────────────────────── */
.table-clickable tbody tr:hover { background: var(--color-primary-light); }

/* ── Error pages ─────────────────────────────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 80px 20px;
}
.error-page h1 { font-size: 72px; color: var(--color-border); }
.error-page p  { color: var(--color-muted); margin: 16px 0; }

/* ── Issues & journals ───────────────────────────────────────────────────────── */
.issue-list { display: flex; flex-direction: column; gap: 2px; }
.issue-item { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.issue-summary {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; cursor: pointer; list-style: none;
    background: var(--color-surface);
}
.issue-summary:hover { background: var(--color-primary-light); }
.issue-summary::-webkit-details-marker { display: none; }
.issue-summary::before { content: '▶'; font-size: 10px; color: var(--color-muted); transition: transform .15s; flex-shrink: 0; }
.issue-item[open] > .issue-summary::before { transform: rotate(90deg); }
.issue-id   { font-size: 12px; flex-shrink: 0; width: 52px; }
.issue-subject { flex: 1; font-size: 13px; }
.issue-meta { display: flex; gap: 12px; font-size: 12px; color: var(--color-muted); flex-shrink: 0; }
.issue-journals { padding: 12px 16px 12px 52px; background: var(--color-bg); border-top: 1px solid var(--color-border); }
.journal-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.journal-item { font-size: 13px; }
.journal-meta { font-size: 11px; color: var(--color-muted); font-weight: 600; display: block; margin-bottom: 3px; }
.journal-note { white-space: pre-wrap; }
.journal-item ul { margin: 4px 0 0 12px; font-size: 12px; }

/* ── Issues without journals ─────────────────────────────────────────────────── */
.issue-no-journals > .issue-summary { cursor: default; }
.issue-no-journals > .issue-summary::before { visibility: hidden; }

/* ── Journal table (compact) ─────────────────────────────────────────────────── */
.table-journals td, .table-journals th { padding: 4px 8px; font-size: 11px; vertical-align: top; }
.table-journals th { font-size: 11px; }
.table-journals td:first-child, .table-journals td:nth-child(2) { white-space: nowrap; color: var(--color-muted); }
.journal-note { white-space: pre-wrap; line-height: 1.4; }

/* ── Journal analysis log ────────────────────────────────────────────────────── */
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-header-row h2 { margin-bottom: 0; }
.mt-sm { margin-top: 10px; }
.analysis-log { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.analysis-entry { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius); background: var(--color-bg); }
.analysis-entry-new { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }
.sentiment-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; }
.dot-positive   { background: var(--color-success); }
.dot-negative   { background: var(--color-danger); }
.dot-warn       { background: var(--color-warning); }
.dot-neutral    { background: var(--color-muted); }
.dot-unanalyzed { background: var(--color-border); border: 1px solid var(--color-muted); }
.dot-empty      { background: #fff; border: 1px solid var(--color-border); }
.dot-running    { background: var(--color-primary); animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes dot-pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.row-running td { background: var(--color-primary-light); }
.sync-status-dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.sync-ok   { background: var(--color-success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-success) 20%, transparent); }
.sync-fail { background: var(--color-danger);  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-danger)  20%, transparent); }
.analysis-body { flex: 1; min-width: 0; }
.analysis-meta { display: flex; gap: 10px; font-size: 11px; color: var(--color-muted); margin-bottom: 2px; flex-wrap: wrap; }
.analysis-summary { font-size: 13px; font-weight: 500; }
.analysis-reason { font-size: 12px; margin-top: 2px; }
.analysis-value { font-size: 12px; margin-top: 2px; color: var(--color-text); font-style: italic; }

/* ── Admin / forms ───────────────────────────────────────────────────────────── */
.checkbox-label { display: flex; align-items: center; justify-content: center; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.label-inline { display: flex; align-items: center; gap: 8px; }

/* ── Analysis issue groups ───────────────────────────────────────────────────── */
.analysis-issue-group { margin-bottom: 16px; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.analysis-issue-header { padding: 7px 12px; background: var(--color-primary-light); border-bottom: 1px solid #c5d4e8; font-size: 12px; font-weight: 600; color: var(--color-text); }
.analysis-issue-group .journal-card { border-top: 1px solid var(--color-border); }
.analysis-issue-group .journal-card:first-of-type { border-top: none; }

/* ── Issue header with meta ──────────────────────────────────────────────────── */
.analysis-issue-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.issue-header-link { display: flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--color-primary-dark); font-weight: 600; flex: 1; min-width: 0; }
.issue-header-link:hover { text-decoration: underline; }
.issue-header-title { display: flex; align-items: baseline; gap: 6px; font-weight: 600; }
.issue-tracker { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 3px; background: var(--color-primary); color: #fff; white-space: nowrap; }
.issue-id { font-size: 12px; color: var(--color-muted); font-weight: 400; white-space: nowrap; flex-shrink: 0; }
.issue-header-meta { display: flex; gap: 10px; font-size: 11px; font-weight: 400; color: var(--color-muted); }
.issue-header-badges { display: flex; gap: 5px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.issue-status-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.issue-assignee-badge { font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 3px; background: #F3F4F6; color: #374151; white-space: nowrap; }
.analysis-byline { font-size: 11px; margin-top: 3px; }
.analysis-empty { font-size: 12px; padding: 8px 12px; }
.analysis-type-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.analysis-type { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--color-muted); }
.journal-card { border-left: 3px solid transparent; margin: 3px 0; border-radius: 0 3px 3px 0; }
.journal-card + .journal-card { border-top: 1px solid var(--color-border); margin-top: 0; }
.journal-card.phase-dev      { border-left-color: #3B82F6; }
.journal-card.phase-testing  { border-left-color: #F59E0B; }
.journal-card.phase-handover { border-left-color: #EC4899; }
.journal-card details { }
.journal-card summary.journal-header { display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer; list-style: none; user-select: none; }
.journal-card summary.journal-header::-webkit-details-marker { display: none; }
.journal-card summary.journal-header::before { content: '▶'; font-size: 9px; color: var(--color-muted); flex-shrink: 0; transition: transform .15s; }
.journal-card details[open] summary.journal-header::before { transform: rotate(90deg); }
.journal-header-author { font-size: 12px; font-weight: 600; }
.journal-header-meta { font-size: 11px; margin-left: auto; color: var(--color-muted); }
.journal-card .analysis-content { padding: 2px 10px 6px 28px; font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.journal-card .analysis-ai { padding: 4px 10px 5px 28px; border-top: 1px solid var(--color-border); font-size: 11px; }
.analysis-ai-pending { font-style: italic; }
.badge-cp { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: #2563EB; color: #fff; letter-spacing: .03em; }
.dir-badge { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.dir-out { background: #DBEAFE; color: #1D4ED8; }
.dir-in  { background: #DCFCE7; color: #15803D; }
.analysis-content { font-size: 13px; white-space: pre-wrap; word-break: break-word; margin-bottom: 3px; }
.analysis-changes { font-size: 12px; margin-bottom: 3px; }
.analysis-ai { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--color-border); }
.history-line { padding: 3px 10px; font-size: 12px; color: var(--color-muted); border-left: 3px solid transparent; }
.history-line.phase-dev      { border-left-color: #3B82F6; }
.history-line.phase-testing  { border-left-color: #F59E0B; }
.history-line.phase-handover { border-left-color: #EC4899; }

/* ── Journal raw data panel ──────────────────────────────────────────────────── */
.journal-raw { margin-top: 6px; padding: 8px 10px; background: #f8f8f8; border: 1px solid var(--color-border); border-radius: 3px; font-size: 11px; font-family: monospace; white-space: pre-wrap; word-break: break-all; overflow-x: auto; }

/* ── FM Event list ───────────────────────────────────────────────────────────── */
.event-list { display: flex; flex-direction: column; }
.event-block { padding: 5px 0; border-bottom: 1px solid var(--color-border); }
.event-block:last-child { border-bottom: none; }
.event-row { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.event-date { flex-shrink: 0; color: var(--color-muted); font-size: 12px; width: 70px; }
.event-name { flex: 1; min-width: 0; font-weight: 500; }
.event-byline { font-size: 11px; }
.event-log-line { display: flex; gap: 10px; padding: 1px 0; padding-left: 80px; font-size: 11px; }
.event-log-date { flex-shrink: 0; width: 130px; color: var(--color-muted); }
.event-log-desc { flex: 1; }

/* ── Project timeline ────────────────────────────────────────────────────────── */
.tl-wrap { position: relative; height: 65px; margin: 24px 8px 8px; }
.tl-segment { position: absolute; top: 8px; height: 5px; border-radius: 2px; opacity: .2; }
.tl-heat { position: absolute; top: 8px; height: 5px; pointer-events: none; border-radius: 2px; }
.tl-dot { position: absolute; top: 10px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; border: 2px solid #64748B; cursor: default; transition: border-color .15s; }
.tl-dot-change { width: 10px; height: 10px; top: 12px; margin-left: -5px; border-color: #94a3b8; border-style: dashed; }
.tl-dot:hover { border-color: #1e293b; z-index: 10; }
.tl-dot[title]:hover::after { content: attr(title); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: #1e293b; color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 4px; pointer-events: none; z-index: 20; }
.tl-month { position: absolute; top: 0; height: 100%; width: 1px; background: #e2e8f0; pointer-events: none; z-index: 0; }
.tl-month-label { position: absolute; bottom: 2px; font-size: 10px; color: var(--color-muted); transform: translateX(-50%); white-space: nowrap; pointer-events: none; }
.tl-dot-phase { border-width: 3px; }
.tl-dot-actual { border-width: 3px; }
.tl-label { position: absolute; top: 28px; font-size: 10px; color: var(--color-muted); writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg); white-space: nowrap; }
.tl-tooltip { position: absolute; top: -22px; font-size: 10px; background: #1e293b; color: #fff; padding: 2px 6px; border-radius: 3px; pointer-events: none; white-space: nowrap; transform: translateX(-50%); display: none; z-index: 10; }
.tl-label-start { left: 0 !important; transform: rotate(180deg); }

/* ── Time entries table ──────────────────────────────────────────────────────── */
.te-details { margin-top: 14px; }
.te-summary { font-size: 11px; color: var(--color-muted); cursor: pointer; user-select: none; list-style: none; padding: 2px 0; }
.te-summary::-webkit-details-marker { display: none; }
.te-summary::before { content: '▶'; font-size: 8px; margin-right: 5px; transition: transform .15s; }
details[open] > .te-summary::before { transform: rotate(90deg); }
.te-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 8px; }
.te-table th { text-align: left; padding: 3px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--color-muted); border-bottom: 1px solid var(--color-border); font-weight: 600; }
.te-table td { padding: 2px 8px; border-bottom: 1px solid #f0f2f5; vertical-align: top; color: var(--color-text); white-space: nowrap; }
.te-table td:last-child { white-space: normal; color: var(--color-muted); }
.te-row { border-left: 3px solid transparent; }
.te-table tbody tr:hover { background: var(--color-bg); }

/* ── Phase color bar on journal entries ──────────────────────────────────────── */
.analysis-entry { border-left: 3px solid transparent; }
.analysis-entry.phase-dev      { border-left-color: #3B82F6; }
.analysis-entry.phase-testing  { border-left-color: #F59E0B; }
.analysis-entry.phase-handover { border-left-color: #EC4899; }

/* ── Overview card ───────────────────────────────────────────────────────────── */
.overview-body    { display: grid; grid-template-columns: 175px auto 1fr; row-gap: 10px; column-gap: 12px; align-items: center; font-size: 13px; }
.overview-row     { display: contents; }
.ov-label         { color: var(--color-muted); }
.ov-phase-dev     { background: #DBEAFE; color: #1D4ED8; }
.ov-phase-testing { background: #FEF3C7; color: #92400E; }
.ov-phase-handover{ background: #FCE7F3; color: #9D174D; }
.ov-phase-done    { background: #DCFCE7; color: #166534; }
.ov-phase-unknown { background: #F3F4F6; color: #6B7280; }
.ov-phase-text-dev     { color: #1D4ED8; }
.ov-phase-text-testing { color: #92400E; }
.ov-phase-text-handover{ color: #9D174D; }
.ov-phase-text-done    { color: #166534; }
.ov-phase-text-unknown { color: var(--color-muted); }
.ov-deadline      { font-size: 12px; font-weight: 500; }
.deadline-ok      { color: var(--color-success); }
.deadline-warn    { color: var(--color-warning); }
.deadline-soon    { color: #EA580C; }
.deadline-late    { color: var(--color-danger); font-weight: 600; }
.ov-count         { font-size: 13px; font-weight: 500; }
.ov-sentiment     { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.ov-num           { display: inline-block; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
