:root {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

body {
    margin: 0;
    background: #0b0f14;
    color: #e9eef5;
}

header {
    padding: 16px 20px;
    border-bottom: 1px solid #1e2a39;
    background: #0b0f14;
    position: sticky;
    top: 0;
    z-index: 10;
}

h1 {
    margin: 0;
    font-size: 18px;
}

main {
    padding: 20px;
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

@media (max-width: 800px) {
    main {
        grid-template-columns: 1fr;
    }
}

.cardgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    border: 1px solid #1e2a39;
    border-radius: 10px;
    padding: 14px;
    background: #0f1620;
}

.card h2 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.card p {
    margin: 0 0 12px 0;
    color: #b8c4d6;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #2a3a4f;
    color: #b8c4d6;
    font-size: 12px;
}

button {
    cursor: pointer;
    border: 1px solid #2a3a4f;
    background: #162231;
    color: #e9eef5;
    padding: 8px 10px;
    border-radius: 8px;
}

button:hover {
    background: #1b2a3d;
}

button.secondary {
    font-size: 12px;
    padding: 4px 8px;
    opacity: 0.8;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.panel {
    border: 1px solid #1e2a39;
    border-radius: 10px;
    padding: 14px;
    background: #0f1620;
}

textarea {
    width: 100%;
    min-height: 110px;
    background: #0b0f14;
    color: #e9eef5;
    border: 1px solid #1e2a39;
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
}

pre {
    white-space: pre-wrap;
    background: #0b0f14;
    border: 1px solid #1e2a39;
    padding: 10px;
    border-radius: 10px;
    overflow-x: auto;
}

small {
    color: #93a4bb;
}

/* New Styles for Evidence Pack Viewer */
.hidden {
    display: none !important;
}

.viewer {
    border: 1px solid #1e2a39;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
}

.tabs {
    display: flex;
    background: #162231;
    border-bottom: 1px solid #1e2a39;
    overflow-x: auto;
}

.tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-right: 1px solid #1e2a39;
    color: #93a4bb;
    border-radius: 0;
    white-space: nowrap;
}

.tab:hover {
    background: #1b2a3d;
    color: #fff;
}

.tab.active {
    background: #0f1620;
    color: #4db8ff;
    border-bottom: 2px solid #4db8ff;
}

.tabPanel {
    padding: 16px;
    background: #0f1620;
    min-height: 200px;
}

/* History Sidebar */
.history {
    background: #0f1620;
    border: 1px solid #1e2a39;
    border-radius: 10px;
    padding: 14px;
    height: fit-content;
}

.history h2 {
    font-size: 16px;
    margin-top: 0;
}

.historyList {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.historyItem {
    text-align: left;
    font-size: 13px;
    padding: 8px;
    background: #0b0f14;
    border: 1px solid #1e2a39;
    transition: background 0.2s;
}

.historyItem:hover {
    background: #162231;
    border-color: #4db8ff;
}

.historyItem.active {
    background: #162231;
    border-color: #4db8ff;
    box-shadow: 0 0 8px rgba(77, 184, 255, 0.2);
    border-left: 3px solid #4db8ff;
}

.historyItem .meta {
    font-size: 10px;
    color: #6e7f96;
    display: block;
    margin-top: 2px;
}

/* Citations */
.cite {
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid #1e2a39;
    border-radius: 4px;
    background: #0b0f14;
}

.citeTitle {
    font-weight: bold;
    color: #4db8ff;
    font-size: 14px;
    margin-bottom: 4px;
}

.citeMeta {
    font-size: 11px;
    color: #93a4bb;
    font-family: monospace;
}

.citeContent {
    font-size: 13px;
    color: #b8c4d6;
    margin-top: 6px;
    line-height: 1.4;
}

/* Layout adjustments */
.main-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}

.stepper {
    display: flex;
    gap: 15px;
    background: #0f1620;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #1e2a39;
}

.step {
    font-size: 13px;
    color: #6e7f96;
    position: relative;
    padding-right: 15px;
}

.step:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: 0;
    color: #2a3a4f;
}

.step.active {
    color: #4db8ff;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(77, 184, 255, 0.4);
}

.step.done {
    color: #8bc34a;
}