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

.page-wrapper {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 12px 20px 0px 20px;
}

.header-top {
    display: flex;
    align-items: center;       
    justify-content: flex-start;
    border-bottom: 1px solid #eee;
    gap: 40px;
    border-bottom: none;         
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-size: 18px;
    line-height: 1.5;
    background-color: #F1F3F6;
    color: #34495E;
    overflow-y: scroll;
}

main {
    margin-top: 10px;
    margin-bottom: 54px;
    min-height: calc(100vh - 345px);
    overflow: auto;
}

h1 {
    margin: 0;
    line-height: 1;
}

h1 a {
    display: flex;
    align-items: center;
    padding-left: 40px;
    background-size: contain;
}

h1 a:hover {
    text-decoration: none;
    color: #34495E;
}

h2 {
    font-size: 22px;
    margin-bottom: 36px;
    position: relative;
    top: -9px;
}

a {
    text-decoration: none;
}

header a {
    color: #34495E;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 30px;
}

nav div {
    display: flex;
    align-items: center;
    gap: 15px;
}

nav a {
    white-space: nowrap;
}

nav a:hover {
    color: #007bff;
}

a.button, input[type="submit"] {
    background-color: #3b82f6;
    border-radius: 3px;
    color: #FFFFFF;
    padding: 18px 27px;
    border: none;
    display: inline-block;
    margin-top: 18px;
    font-weight: 700;
}

a.button:hover, input[type="submit"]:hover {
    background-color: #2666cd;
    color: #FFFFFF;
    cursor: pointer;
    text-decoration: none;
}

form div {
    margin-bottom: 18px;
}

form div:last-child {
    border-top: none;
}

form input[type="radio"] {
    margin-left: 18px;
}

form input[type="text"], form input[type="password"], form input[type="email"] {
    padding: 0.75em 18px;
    width: 100%;
}

form input[type=text], form input[type="password"], form input[type="email"], textarea {
    color: #6A6C6F;
    background: #FFFFFF;
    border: 1px solid #E4E5E7;
    border-radius: 3px;
}

form label {
    display: inline-block;
    margin-bottom: 9px;
}

.form-container {
    max-width: 640px;
    margin: 40px auto;
    padding: 40px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.form-container input[type="submit"] {
    padding: 10px 28px;
    font-size: 1rem;
    margin-top: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.form-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 24px;
    top: 0;
}

.form-container textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 14px;
    font-size: 0.95rem;
    color: #1e293b;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-container textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-container label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.checkbox-group {
    display: flex;
    gap: 20px;
    margin-top: 6px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #334155;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
}

.account-row:first-child {
    border-top: 1px solid #e2e8f0;
}

.account-row:last-child {
    border-bottom: 1px solid #e2e8f0;
}

.account-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
    letter-spacing: 0.05em;
}

.account-value {
    font-size: 0.95rem;
    color: #1e293b;
}

.error {
    color: #C0392B;
    font-weight: bold;
    display: block;
}

.error + textarea, .error + input {
    border-color: #C0392B !important;
    border-width: 2px !important;
}

label.error {
    color: #ef4444;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 4px;
    display: block;
}

div.error {
    color: #991b1b;
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 24px;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

textarea {
    padding: 18px;
    width: 100%;
    height: 266px;
}

button {
    background: none;
    padding: 0;
    border: none;
    color: #3b82f6;
    text-decoration: none;
}

button:hover {
    color: #2666cd;
    text-decoration: underline;
    cursor: pointer;
}

#flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.flash {
    pointer-events: auto;
    min-width: 250px;
    padding: 12px 20px;
    background-color: #1e293b;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: inherit;
    font-size: 0.9rem;
    border-left: 4px solid #3b82f6;
    transition: opacity 0.5s ease, transform 0.5s ease;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

.flash.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

table {
    background: white;
    border: 1px solid #E4E5E7;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    text-align: left;
    padding: 9px 18px;
}

th:last-child, td:last-child {
    text-align: right;
    color: #6A6C6F;
}

tr {
    border-bottom: 1px solid #E4E5E7;
}

tr:nth-child(2n) {
    background-color: #F7F9FA;
}

footer {
    border-top: 1px solid #E4E5E7;
    padding-top: 17px;
    padding-bottom: 15px;
    background: #F7F9FA;
    height: 60px;
    color: #6A6C6F;
    text-align: center;
}

.media-scroller {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 16%;
    width: 100%;
    margin-top: 10px;
    padding-bottom: 0px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.card {
    border: 2px solid #000000;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    grid-template-rows: min-content;
    padding: 4px;
    margin: 3px;
    text-decoration: none;
    color: black;
    height: 100px;
    background-color: #ffffff;
}

.card:hover { transform: translateY(-2px); }

.card-text {
    font-size: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

#close-details:hover {
    color: #ef4444;
}

#content {
    max-width: 100%;
    height: auto;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    border-radius: 8px;
}

.home-grid {
    display: flex;
    gap: 5px;
    margin-top: 0px;
    height: 90vh;
    min-height: 600px;
}

#search-panel {
    width: 280px;
    flex-shrink: 1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-header {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 18px;
}

#search-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

#vis-container {
    position: relative;
    flex: 1;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

#visualization {
    width: 100%;
    height: 100%;
    flex: 1;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

#side-panel {
    width: 300px;
    flex-shrink: 1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: -2px 0 5px rgba(0,0,0,0.02);
}

.panel-placeholder {
    color: #94a3b8;
    text-align: center;
    margin-top: 100px;
}

.detail-label {
    font-weight: bold;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
}

.detail-value {
    margin-bottom: 15px;
    font-size: 15px;
    color: #0f172a;
    word-wrap: break-word;
}

@keyframes spin { 100% { transform: translate(-50%, -50%) rotate(360deg); } }

.loader {
    display: none;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.loader.htmx-request {
    display: block !important;
}

.htmx-request ~ .panel-placeholder {
    opacity: 0.3;
}

.btn-reply {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
}

.btn-reply:hover {
    background: #2563eb;
    color: white;
    text-decoration: none;
}

.btn-submit {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.btn-submit:hover {
    background: #059669;
    color: white;
    text-decoration: none;
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.btn-cancel:hover {
    background: #e2e8f0;
    color: #334155;
    text-decoration: none;
}

.vertical-feed {
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.feed-card {
    width: 100%;
    height: auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    text-decoration: none;
    transition: all 0.2s ease;
}

.feed-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.feed-card .card-text {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;
    line-height: 1.45;
    font-size: 1rem;
    color: #1e2937;
    padding: 10px;
}

.card-author {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 10px 0px 10px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    padding: 4px 10px 0px 10px;
}

.feed-card.active {
    background-color: #eff6ff !important;
    border-left-color: #3b82f6 !important;
    box-shadow: inset 1px 0 3px rgba(59, 130, 246, 0.05);
}

.feed-card.active .card-author {
    color: #2563eb;
}

.feed-card.active .card-text {
    color: #0f172a;
}

.feed-tabs {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid #e2e8f0;
}

.feed-tab {
    flex: 1;
    padding: 9px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.feed-tab:hover {
    color: #475569;
}

.feed-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

.feed-empty {
    padding: 24px 16px;
    color: #94a3b8;
    font-size: 0.9rem;
    text-align: center;
}

.graph-legend {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: sans-serif;
    pointer-events: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-evenly;
    gap: 8px 16px;
    width: 90%;
}

.graph-legend h3 {
    margin: 0;
    font-size: 13px;
    font-weight: bold;
    color: #64748b;
    border-right: 1px solid #cbd5e1;
    padding-right: 15px;
    margin-right: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-size: 12px;
}

.line {
    width: 20px;
    height: 3px;
    margin-right: 10px;
    display: inline-block;
}

.support  { background-color: #22c55e; }
.oppose   { background-color: #ef4444; }
.neutral  { background-color: #cbd5e1; }

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
}

.idea       { background-color: #3b82f6; }
.prediction { background-color: #eab308; }
.evidence   { background-color: #1e293b; }
.assumption { background-color: #f472b6; }

.divider {
    width: 3px;
    background: #e2e8f0;
    cursor: col-resize;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background 0.2s;
}

.divider:hover, .divider.dragging {
    background: #3b82f6;
}

.mobile-back-btn {
    display: none;
}

@media (max-width: 768px) {
    main {
        margin-bottom: 0;
        min-height: unset;
    }

    h1 {
        font-size: 1.4rem;
    }

    h1 a {
        padding-left: 0;
    }

    .home-grid {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .divider {
        display: none;
    }

    .header-top {
        flex-wrap: wrap;
        gap: 16px;
    }

    nav {
        flex-wrap: wrap;
        gap: 16px;
    }

    /* Drill-down: only one of search/graph/details panel is shown at a time,
       controlled by [data-mobile-view] on .home-grid. */
    #search-panel,
    #vis-container,
    #side-panel {
        display: none;
        width: 100% !important;
        flex: none;
        height: calc(100svh - 55px);
    }

    .home-grid[data-mobile-view="search"] #search-panel {
        display: flex;
    }

    .home-grid[data-mobile-view="graph"] #vis-container {
        display: block;
    }

    .home-grid[data-mobile-view="details"] #side-panel {
        display: block;
    }

    .mobile-back-btn {
        display: block;
        width: 100%;
        text-align: left;
        padding: 10px 14px;
        background: #f8fafc;
        border: none;
        border-bottom: 1px solid #e2e8f0;
        color: #3b82f6;
        font-weight: 600;
        font-size: 16px;
        cursor: pointer;
    }

    .graph-legend {
        font-size: 10px;
        gap: 4px 10px;
        padding: 6px 10px;
        width: 96%;
    }

    .graph-legend .dot {
        width: 8px;
        height: 8px;
    }

    .graph-legend .line {
        width: 14px;
        height: 2px;
    }
}

/* ── graph node labels ───────────────────────────────────────── */
.node-label {
    font-weight: 500;
}

.node-group {
    cursor: pointer;
}

.node-body {
    transition: filter 0.15s ease;
}

.node-group:hover .node-body {
    filter: brightness(1.25);
}

/* ── hover tooltip ───────────────────────────────────────────── */
.graph-tooltip {
    position: absolute;
    background: #1e293b;
    border-radius: 8px;
    padding: 10px 13px;
    max-width: 220px;
    z-index: 100;
    transition: opacity 0.1s ease;
    pointer-events: none;
}

.tt-title {
    font-size: 12px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 5px;
    line-height: 1.3;
}

.tt-preview {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 5px;
}

.tt-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

/* ── panel overview (root summary) ──────────────────────────── */
.panel-root-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #534AB7;
    margin-bottom: 5px;
}

.panel-root-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    margin-bottom: 5px;
}

.panel-root-content {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 4px;
    white-space: pre-wrap;
}

.panel-root-author {
    font-size: 11px;
    color: #94a3b8;
}

.panel-summary-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 14px 0;
}

/* ── panel node detail (selected node) ───────────────────────── */
.panel-back-btn {
    display: inline-block;
    font-size: 12px;
    color: #3b82f6;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 14px;
    cursor: pointer;
    text-decoration: none;
}

.panel-back-btn:hover {
    color: #2563eb;
    text-decoration: underline;
}

.panel-node-type {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    margin-bottom: 5px;
}

.panel-content {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 4px;
    white-space: pre-wrap;
}

.panel-author {
    font-size: 11px;
    color: #94a3b8;
}

/* ── section labels ──────────────────────────────────────────── */
.panel-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94a3b8;
    margin: 12px 0 5px;
}

/* ── arg cards ───────────────────────────────────────────────── */
.arg-card {
    background: #f8fafc;
    border-left: 2px solid #888780;
    border-radius: 0 6px 6px 0;
    padding: 9px 12px;
    margin-bottom: 7px;
}

.arg-card-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.arg-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 3px;
    line-height: 1.35;
}

.arg-card-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #475569;
    white-space: pre-wrap;
}

.arg-card-author {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ── empty state ─────────────────────────────────────────────── */
.panel-empty {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    padding: 20px 0;
}

/* ── reply form ──────────────────────────────────────────────── */
.reply-textarea {
    width: 100%;
    height: 90px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    color: #1e293b;
}

.reply-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.reply-field-group {
    margin-bottom: 10px;
}

.reply-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    display: block;
    margin-bottom: 6px;
}

.reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* ── pill selectors ──────────────────────────────────────────── */
.pill-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill-group input[type="radio"] {
    display: none;
}

.pill-group label {
    padding: 5px 13px;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.15s ease;
    user-select: none;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
    display: inline-block;
}

.pill-group label:hover {
    border-color: #94a3b8;
    color: #334155;
    background: #f1f5f9;
}

/* relation pills */
.pill-group input[value="IS_NEUTRAL_TO"]:checked   + label { background: #94a3b8; color: #fff; border-color: #94a3b8; }
.pill-group input[value="IS_SUPPORTED_BY"]:checked + label { background: #22c55e; color: #fff; border-color: #22c55e; }
.pill-group input[value="IS_OPPOSED_BY"]:checked  + label { background: #ef4444; color: #fff; border-color: #ef4444; }

/* type pills */
.pill-group input[value="idea"]:checked       + label { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.pill-group input[value="evidence"]:checked   + label { background: #1e293b; color: #fff; border-color: #1e293b; }
.pill-group input[value="prediction"]:checked + label { background: #eab308; color: #1e293b; border-color: #eab308; }
.pill-group input[value="assumption"]:checked + label { background: #f472b6; color: #fff; border-color: #f472b6; }

.auth-notice {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: #334155;
}
 