/* ============================================================
   Intent Boxes – Main Stylesheet
   Research & Innovation palette:
     Primary:   #3F51B5 (Indigo)
     Accent:    #00BCD4 (Cyan)
     Surface:   #FFFFFF
     Text:      #263238
     Muted:     #78909C
     Border:    #ECEFF1
     Danger:    #E53935
   ============================================================ */

:root {
    --primary: #3F51B5;
    --primary-light: #7986CB;
    --primary-dark: #283593;
    --accent: #00BCD4;
    --accent-light: #4DD0E1;
    --surface: #FFFFFF;
    --background: #F5F7FA;
    --text: #263238;
    --text-secondary: #546E7A;
    --muted: #78909C;
    --border: #ECEFF1;
    --border-strong: #CFD8DC;
    --danger: #E53935;
    --danger-light: #FFEBEE;
    --success: #43A047;
    --success-light: #E8F5E9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* ── Header ────────────────────────────────────────────────── */

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-login-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.header-login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* User pill (logged in state) */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 4px 12px 4px 4px;
}

.user-pill img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-info-text {
    line-height: 1.2;
    text-align: left;
}

.user-info-text .user-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
}

.user-info-text .user-email {
    font-size: 0.75rem;
    color: var(--muted);
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
}

.logout-btn:hover {
    background: var(--border);
}

/* ── Hero ──────────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 64px 0 24px;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ── Auth Section ──────────────────────────────────────────── */

.auth-section {
    max-width: 600px;
    margin: 0 auto 3rem;
    text-align: center;
}

.public-info {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.public-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
}

.public-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.info-list {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.info-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 1.2rem;
    position: relative;
}

.info-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.auth-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-md);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.verify-msg {
    text-align: center;
    background: #FFF3E0;
    color: #EF6C00;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    font-weight: 600;
}

/* ── Panel Content ─────────────────────────────────────────── */

.panel-content {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.panel-content.visible {
    display: block;
    opacity: 1;
}

/* ── Content Access ───────────────────────────────────────── */

.content-access-section {
    margin-bottom: 1rem;
}

.content-access-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.content-access-banner-ready {
    border-color: rgba(67, 160, 71, 0.28);
    background: linear-gradient(180deg, #ffffff 0%, #f4fbf5 100%);
}

.content-access-banner-available {
    border-color: rgba(63, 81, 181, 0.24);
    background: linear-gradient(180deg, #ffffff 0%, #f5f7ff 100%);
}

.content-access-banner-warning {
    border-color: rgba(229, 57, 53, 0.24);
    background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
}

.content-access-banner-subtle {
    border-style: dashed;
    background: #fbfcfd;
}

.content-access-copy {
    min-width: 0;
}

.content-access-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.content-access-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.content-access-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.content-access-modal-box {
    max-width: 520px;
}

.content-access-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0.75rem;
}

.content-access-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.content-access-modal-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.content-access-inline-error {
    background: var(--danger-light);
    border: 1px solid rgba(229, 57, 53, 0.16);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.84rem;
    margin-bottom: 1rem;
}

.content-access-methods {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}

.content-access-method {
    border: 1px solid var(--border-strong);
    background: #f8fafc;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.content-access-method.is-active {
    border-color: rgba(63, 81, 181, 0.28);
    background: rgba(63, 81, 181, 0.08);
    color: var(--primary-dark);
}

.content-access-pane {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.content-access-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.content-access-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
}

.content-access-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.08);
}

.content-access-pane-note {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--muted);
}

/* ── Key Setup ─────────────────────────────────────────────── */

.key-setup-section {
    margin-bottom: 2rem;
}

.key-setup-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

.key-setup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.key-setup-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.key-progress {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 6px;
    display: inline-block;
}

.key-status-ready {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Sections ──────────────────────────────────────────────── */

.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.content-section {
    margin-bottom: 3rem;
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 2.5rem;
}

/* ── Chatrooms ─────────────────────────────────────────────── */

.chatrooms-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(68vh, 860px);
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,249,251,0.98) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chatrooms-list {
    display: grid;
    gap: 10px;
    overflow: auto;
    min-height: 0;
    padding: 14px;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scrollbar-gutter: stable both-edges;
}

.posts-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(68vh, 860px);
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,249,251,0.98) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.posts-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    overflow: auto;
    min-height: 0;
    padding: 14px;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scrollbar-gutter: stable both-edges;
}

.chatrooms-section .section-header,
.posts-section .section-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(250,252,253,0.95) 100%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.posts-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.posts-import-hint {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.posts-import-btn {
    white-space: nowrap;
}

.posts-import-status {
    margin: 0 18px 4px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    line-height: 1.45;
    border: 1px solid transparent;
}

.posts-import-status.is-loading {
    color: var(--primary-dark);
    background: rgba(63, 81, 181, 0.08);
    border-color: rgba(63, 81, 181, 0.18);
}

.posts-import-status.is-success {
    color: var(--success);
    background: var(--success-light);
    border-color: rgba(67, 160, 71, 0.18);
}

.posts-import-status.is-error {
    color: var(--danger);
    background: var(--danger-light);
    border-color: rgba(229, 57, 53, 0.18);
}

.posts-section.is-drop-active {
    border-color: rgba(63, 81, 181, 0.45);
    box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.1), var(--shadow-md);
}

.posts-section.is-drop-active .posts-list {
    background: linear-gradient(180deg, rgba(63, 81, 181, 0.05) 0%, rgba(0, 188, 212, 0.03) 100%);
}

.posts-section.is-importing .posts-list {
    opacity: 0.82;
}

.chatrooms-list,
.posts-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(63, 81, 181, 0.22) transparent;
}

.chatrooms-list::-webkit-scrollbar,
.posts-list::-webkit-scrollbar {
    width: 10px;
}

.chatrooms-list::-webkit-scrollbar-thumb,
.posts-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(63, 81, 181, 0.36) 0%, rgba(0, 188, 212, 0.28) 100%);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.chatrooms-list::-webkit-scrollbar-track,
.posts-list::-webkit-scrollbar-track {
    background: transparent;
}

.post-card {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    align-items: stretch;
    width: 100%;
    min-height: 132px;
    padding: 0;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
}

.post-card:focus-visible {
    outline: 3px solid rgba(63, 81, 181, 0.22);
    outline-offset: 2px;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(63, 81, 181, 0.28);
}

.post-card-image-wrap {
    width: 100%;
    height: 100%;
    min-height: 132px;
    background: linear-gradient(135deg, rgba(63, 81, 181, 0.12) 0%, rgba(0, 188, 212, 0.12) 100%);
    overflow: hidden;
}

.post-card-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-card-body {
    min-width: 0;
    padding: 14px 16px 16px;
}

.post-card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.post-card-audience,
.post-card-time {
    font-size: 0.75rem;
    color: var(--muted);
}

.post-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 8px;
}

.post-card-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-pill-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.post-card-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.post-card-pill-encrypted {
    background: rgba(12, 50, 81, 0.1);
    color: #0c3251;
}

.post-card-pill-draft {
    background: rgba(255, 140, 0, 0.12);
    color: #c76d00;
}

.post-card-pill-variant {
    background: rgba(0, 188, 212, 0.12);
    color: #007c8b;
}

@media (max-width: 860px) {
    .posts-header-actions {
        justify-content: flex-start;
    }

    .posts-import-hint {
        width: 100%;
        order: 2;
    }

    .post-card {
        grid-template-columns: 1fr;
    }

    .post-card-image-wrap {
        min-height: 180px;
    }
}

.chatroom-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: default;
}

.chatroom-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.chatroom-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 700;
}

.chatroom-info {
    flex: 1;
    min-width: 0;
}

.chatroom-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatroom-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ── Graphs List ───────────────────────────────────────────── */

.graphs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.graph-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.graph-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.graph-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 6px;
}

.graph-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.graph-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--muted);
}

.graph-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--border);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Empty state ───────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* ── Buttons ───────────────────────────────────────────────── */

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover {
    background: #C62828;
}

/* ── Icon Placeholder ──────────────────────────────────────── */

.icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    background: rgba(63, 81, 181, 0.08);
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Modal ─────────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(38, 50, 56, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-box-wide {
    max-width: 600px;
}

.post-viewer-modal-box {
    max-width: 1120px;
    width: min(94vw, 1120px);
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-viewer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.post-viewer-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.post-viewer-subtitle {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--muted);
}

.post-viewer-pill-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.post-viewer-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #f0f4f7;
}

.post-viewer-pill-encrypted {
    background: rgba(63, 81, 181, 0.12);
    color: var(--primary-dark);
}

.post-viewer-info {
    background: rgba(67, 160, 71, 0.1);
    border: 1px solid rgba(67, 160, 71, 0.18);
    color: var(--success);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.84rem;
    margin-bottom: 10px;
}

.post-viewer-inline-action {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 6px;
    text-decoration: underline;
}

.post-viewer-inline-action-danger {
    color: #c0392b;
}

.post-viewer-btn-danger {
    background: transparent;
    color: #c0392b;
    border-color: #c0392b;
}
.post-viewer-btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

.post-viewer-loading {
    padding: 26px 0;
    font-size: 0.92rem;
    color: var(--muted);
}

.post-viewer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 18px;
    min-height: 0;
    flex: 1;
}

.post-viewer-gallery,
.post-viewer-content-column {
    min-height: 0;
}

.post-viewer-gallery {
    background: linear-gradient(180deg, #fafbfc 0%, #f2f6f8 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.post-viewer-gallery-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-viewer-main-image-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #eef3f6;
    min-height: 360px;
}

.post-viewer-main-image {
    width: 100%;
    max-height: 58vh;
    display: block;
    object-fit: contain;
    background: #eef3f6;
}

.post-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(38, 50, 56, 0.62);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.post-viewer-nav-prev {
    left: 12px;
}

.post-viewer-nav-next {
    right: 12px;
}

.post-viewer-caption {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.post-viewer-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-top: 12px;
}

.post-viewer-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    border: 2px solid transparent;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.post-viewer-thumb.is-active {
    border-color: var(--primary);
}

.post-viewer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-viewer-gallery-placeholder {
    width: 100%;
    min-height: 360px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

.post-viewer-content-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-viewer-content {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    background: var(--surface);
}

.post-viewer-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.post-viewer-content figure {
    margin: 18px 0;
}

.post-viewer-content figcaption {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--muted);
}

.post-viewer-content blockquote {
    border-left: 3px solid rgba(63, 81, 181, 0.18);
    padding-left: 14px;
    color: var(--text-secondary);
}

.post-viewer-free-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: #fbfcfd;
}

.post-viewer-section-label {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.post-viewer-free-content-body,
.post-viewer-empty-copy {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.modal-btns {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
}

/* ── Form ──────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.08);
}

.form-group input[type="color"] {
    width: 48px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

/* ── Footer ────────────────────────────────────────────────── */

footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 700px) {
    .hero h1 { font-size: 1.8rem; }
    .header-content { height: 48px; }
    .container { padding: 0 16px; }
    .graphs-list { grid-template-columns: 1fr; }
    .overview-grid {
        grid-template-columns: 1fr;
    }
    .content-access-banner {
        align-items: stretch;
        flex-direction: column;
    }
    .content-access-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .content-access-methods {
        flex-wrap: wrap;
    }
    .post-viewer-modal-box {
        width: 96vw;
        max-height: 92vh;
        padding: 1rem;
    }
    .post-viewer-layout {
        grid-template-columns: 1fr;
    }
    .post-viewer-main-image-wrap,
    .post-viewer-gallery-placeholder {
        min-height: 220px;
    }
}
