body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
}

.header {
    padding: 24px 32px;
    border-bottom: 1px solid #1e293b;
    background: #111827;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header h1 {
    margin: 0 0 6px 0;
    font-size: 28px;
}

.header p {
    margin: 0;
    color: #94a3b8;
}

.wrap {
    max-width: 1480px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

/* --- primary page layout --- */

.top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: start;
}

.main-column {
    min-width: 0;
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
}

.sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 20px;
    align-self: start;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-btn {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-btn.active,
.filter-btn:hover {
    border-color: #38bdf8;
    color: #38bdf8;
}

/* --- timeline --- */

.timeline {
    position: relative;
    margin-top: 8px;
    padding: 12px 0;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    transform: translateX(-50%);
    background: #334155;
    border-radius: 999px;
}

.item {
    position: relative;
    width: 50%;
    padding: 18px 24px;
    box-sizing: border-box;
    transition: transform 0.15s ease;
}

.item.left {
    left: 0;
    padding-right: 44px;
}

.item.right {
    left: 50%;
    padding-left: 44px;
}

.item:hover {
    z-index: 2;
}

.dot {
    position: absolute;
    top: 28px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #38bdf8;
    border: 3px solid #0f172a;
    z-index: 2;
}

.item.left .dot {
    right: -8px;
}

.item.right .dot {
    left: -8px;
}

.item .dot.active {
    background: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

.card {
    background: #0f172a;
    border: 2px solid #3b82f6;
    border-radius: 16px;
    padding: 14px 16px;
    max-width: 520px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.card.selected {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.meta {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.title {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #f8fafc;
}

.card.selected .title {
    color: #e5f0ff;
}

.desc {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chips {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: inline-block;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #0f172a;
    border: 1px solid #475569;
    color: #93c5fd;
}

/* --- semantic timeline coloring --- */

.card.prosecution {
    border-color: #ef4444;
    background: linear-gradient(180deg, rgba(69, 16, 16, 0.92), rgba(31, 17, 17, 0.96));
}

.card.prosecution:hover {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.55);
}

.card.prosecution.selected {
    border-color: #f87171;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(248, 113, 113, 0.35);
}

.card.defense {
    border-color: #3b82f6;
    background: linear-gradient(180deg, rgba(15, 35, 67, 0.92), rgba(15, 23, 42, 0.96));
}

.card.defense:hover {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.card.defense.selected {
    border-color: #60a5fa;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.card.neutral {
    border-color: #facc15;
    background: linear-gradient(180deg, rgba(64, 52, 12, 0.9), rgba(33, 28, 12, 0.95));
}

.card.neutral:hover {
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
}

.card.neutral.selected {
    border-color: #fde047;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(253, 224, 71, 0.35);
}

.item .dot.prosecution {
    background: #ef4444;
}

.item .dot.defense {
    background: #3b82f6;
}

.item .dot.neutral {
    background: #facc15;
}

.side-chip.prosecution {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.side-chip.defense {
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.side-chip.neutral {
    background: rgba(250, 204, 21, 0.18);
    color: #fde68a;
    border: 1px solid rgba(250, 204, 21, 0.4);
}

/* --- panels --- */

.panel,
.editor-panel {
    background: #111827;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 20px;
}

.panel {
    margin-top: 28px;
}

.editor-panel {
    margin-top: 28px;
}

.panel h2,
.editor-panel h2 {
    margin-top: 0;
    font-size: 22px;
}

.empty {
    color: #94a3b8;
    text-align: center;
    padding: 40px 20px;
}

.loading {
    color: #94a3b8;
    padding: 20px 0;
}

/* --- detail drawer / inspector --- */

.detail-drawer {
    min-height: 420px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(11, 18, 32, 0.98));
    border: 1px solid #334155;
    border-radius: 18px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}

.detail-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid #26354a;
    background: rgba(15, 23, 42, 0.72);
}

.detail-drawer-header h2 {
    margin: 2px 0 0 0;
    font-size: 22px;
}

.detail-kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8ea3bf;
}

.detail-close {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    color: #cbd5e1;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.detail-close:hover {
    border-color: #60a5fa;
    color: #ffffff;
}

#detailContent {
    padding: 16px 18px 18px;
    overflow-y: auto;
    min-height: 240px;
}

.detail-grid p {
    margin: 8px 0;
}

.detail-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #334155;
}

.detail-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-hero {
    padding: 16px;
    border: 1px solid #2a3a52;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.92));
}

.detail-hero-meta {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #93a4ba;
    margin-bottom: 6px;
}

.detail-hero-title {
    margin: 0 0 12px 0;
    font-size: 24px;
    line-height: 1.2;
    color: #f8fbff;
}

.detail-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-fact {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #26354a;
    background: rgba(15, 23, 42, 0.7);
}

.detail-section {
    border-radius: 14px;
    border: 1px solid #26354a;
    background: rgba(15, 23, 42, 0.56);
}

.detail-section-header {
    padding: 12px 14px;
    border-bottom: 1px solid #26354a;
}

.detail-section-body {
    padding: 14px;
    max-width: 100%;
}

.detail-media-frame {
    overflow: hidden;
}

.detail-media-image,
.detail-media-video {
    max-height: 340px;
    object-fit: contain;
    background: #000;
}

a.media-link {
    color: #38bdf8;
    text-decoration: none;
}

a.media-link:hover {
    text-decoration: underline;
}

/* --- forms --- */

label {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 6px;
}

input,
textarea {
    width: 100%;
    box-sizing: border-box;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    background: #38bdf8;
    color: #082f49;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: bold;
    cursor: pointer;
}

.btn.secondary {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
}

.btn:hover {
    filter: brightness(1.05);
}

.subtle {
    color: #94a3b8;
    font-size: 12px;
    margin-top: -6px;
    margin-bottom: 12px;
}

.editor-status {
    margin-top: 12px;
    color: #93c5fd;
    min-height: 20px;
}

/* --- logs / transcript --- */

pre.log-box {
    white-space: pre-wrap;
    background: #0b1220;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px;
    max-height: 320px;
    overflow: auto;
    color: #cbd5e1;
}

#transcriptText pre {
    max-height: 300px;
}

#transcriptMarkdown {
    background: #0b1220;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px;
}

#transcriptMarkdown h1,
#transcriptMarkdown h2,
#transcriptMarkdown h3 {
    color: #f8fafc;
    margin-top: 0.8em;
}

#transcriptMarkdown p,
#transcriptMarkdown li {
    color: #cbd5e1;
    line-height: 1.6;
}

#transcriptMarkdown code {
    background: #0f172a;
    padding: 2px 6px;
    border-radius: 6px;
}

#transcriptMarkdown pre {
    background: #0f172a;
    padding: 12px;
    border-radius: 10px;
    overflow-x: auto;
}

#transcriptMarkdown blockquote {
    border-left: 4px solid #38bdf8;
    margin-left: 0;
    padding-left: 12px;
    color: #94a3b8;
}

#transcriptMarkdown ul,
#transcriptMarkdown ol {
    padding-left: 20px;
}

#transcriptMarkdown a {
    color: #38bdf8;
    text-decoration: none;
}

#transcriptMarkdown a:hover {
    text-decoration: underline;
}

/* --- helper layouts --- */

.auth-wrap {
    max-width: 500px;
}

.profile-wrap {
    max-width: 700px;
}

.btn-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

/* --- admin users table --- */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #273449;
    vertical-align: middle;
}

.admin-table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9fb0c7;
}

.admin-table tbody tr:hover {
    background: rgba(148, 163, 184, 0.06);
}

/* --- inline admin controls --- */

.inline-form {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-label {
    display: inline;
    margin: 0;
    font-size: 12px;
    color: #9fb0c7;
}

.inline-select {
    width: auto;
    min-width: 92px;
    display: inline-block;
    margin: 0;
}

/* --- responsive --- */

@media (min-width: 981px) {
    body.detail-open::before {
        display: none;
    }
}

@media (max-width: 980px) {
    .top-grid {
        grid-template-columns: 1fr;
    }

    .main-column {
        max-width: 100%;
    }

    .sidebar-stack {
        position: static;
    }

    .detail-drawer {
        position: fixed;
        right: 18px;
        top: 88px;
        width: min(560px, calc(100vw - 36px));
        max-height: calc(100vh - 106px);
        z-index: 30;
        transform: translateX(110%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.22s ease;
    }

    body.detail-open .detail-drawer {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .detail-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    body.detail-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.55);
        z-index: 20;
        backdrop-filter: blur(2px);
    }

    .detail-facts {
        grid-template-columns: 1fr;
    }

    .detail-hero-title {
        font-size: 20px;
    }

    .inline-form {
        align-items: stretch;
    }

    .inline-select {
        width: 100%;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 800px) {
    .timeline::before {
        left: 16px;
        transform: none;
    }

    .item,
    .item.left,
    .item.right {
        width: 100%;
        left: 0;
        padding-left: 44px;
        padding-right: 0;
    }

    .item.left .dot,
    .item.right .dot {
        left: 8px;
        right: auto;
    }

    .detail-drawer {
        right: 10px;
        left: 10px;
        top: auto;
        bottom: 10px;
        width: auto;
        max-height: 78vh;
        transform: translateY(110%);
    }

    body.detail-open .detail-drawer {
        transform: translateY(0);
    }
}