/* Reset and Base Styles */
[x-cloak] {
    display: none !important;
}

/* Theme variables */
:root {
    --bg: #F8F9FA;
    --text: #212529;
    --muted: #6C757D;
    --card: #FFFFFF;
    --border: #DEE2E6;
    --primary: #007BFF;
    --primary-hover: #0056b3;
    --sans-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono-font: "SF Mono", "Consolas", "Menlo", monospace;
    --border-radius: 4px;
  }
  [data-theme="dark"] {
    --bg: #121212;
    --text: #E9ECEF;
    --muted: #ADB5BD;
    --card: #1E1E1E;
    --border: #343A40;
    --primary: #007BFF;
    --primary-hover: #3395ff;
  }

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

body {
    font-family: var(--sans-font);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    font-weight: 400;
}

/* Prevent accidental horizontal overflow */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.025em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Content area headers should be larger */
.main-column h2 {
    font-size: 1.75rem;
}

.main-column h3 {
    font-size: 1.35rem;
}

p {
    margin-bottom: 1rem;
    color: var(--muted);
}

/* Compact Header */
.header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
}

/* Ultra Compact Header */
.compact-header {
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.compact-header .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.compact-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.compact-header .header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex: 2;
}

.compact-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: flex-end;
}

.compact-header .wall-title {
    text-align: center;
    margin: 0;
    font-size: 1.25rem;
}

.compact-header .back-link {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.compact-header .back-link:hover {
    color: var(--text);
}

.wall-id-clickable {
    background: var(--bg);
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--mono-font);
}

.wall-id-clickable:hover {
    background: var(--border);
    border-color: var(--muted);
    color: var(--text);
}

.admin-email {
    background: var(--bg);
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text);
    font-family: var(--mono-font);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
}

.tagline {
    font-size: 1rem;
    color: var(--muted);
    font-weight: 400;
    margin: 0;
}

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

.main-header .header-left,
.main-header .header-right {
    flex: 1;
}

.main-header .header-right {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.main-header .header-center {
    text-align: center;
}

.main-header .page-title {
    font-size: 1.25rem;
    margin: 0;
}

.back-link {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text);
}

.wall-title {
    color: var(--text);
    margin-bottom: 0.5rem;
}

.wall-description {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.wall-meta {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--muted);
}

.wall-id, .wall-date {
    background: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

/* Main Content */
.main-content {
    margin-bottom: 3rem;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Sidebar cards - lighter and more subtle */
.sidebar-column .card {
    padding: 1rem;
    border-color: var(--border);
    opacity: 0.9;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text);
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--bg);
    color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Form hints */
.form-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

/* Checkbox labels */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

/* Form details (collapsible sections) */
.form-details {
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.form-details summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.875rem;
    user-select: none;
}

.form-details summary:hover {
    color: var(--primary);
}

.form-details[open] summary {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.form-details .form-group {
    padding-bottom: 0.5rem;
}

.form-details .form-group:last-child {
    padding-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

.btn-secondary {
    background: var(--muted);
    color: #fff;
    border-color: var(--muted);
}

.btn-secondary:hover {
    opacity: 0.85;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--border-radius);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Search Form Page */
.search-form-page {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-input-page {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.search-input-page:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Search Results Info */
.search-results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.search-results-info p {
    margin-bottom: 0;
    color: var(--text);
}

.clear-search {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.clear-search:hover {
    text-decoration: underline;
}

/* Walls Grid */
.walls-section {
    margin-top: 0;
}

.walls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.wall-card {
    background: var(--card);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.wall-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.wall-card .wall-header h3 {
    font-size: 1.1rem;
}

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

.wall-header h3 {
    color: var(--text);
    margin-bottom: 0;
}

.wall-id {
    background: var(--bg);
    color: var(--muted);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-family: var(--mono-font);
    font-weight: 500;
    letter-spacing: 0.025em;
    border: 1px solid var(--border);
}

.wall-description {
    color: var(--muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.wall-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.stat svg {
    color: var(--muted);
    opacity: 0.7;
}

.wall-actions {
    display: flex;
    gap: 0.75rem;
}

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

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    opacity: 0.85;
}

/* Posts */
.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.posts-header h2 {
    margin-bottom: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-card {
    background: var(--card);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Make post content more prominent */
.post-card .post-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* Small flag icons in the top-right corner of posts/comments */
.post-card, .comment-card {
    position: relative;
}

.post-flags {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    gap: 0.5rem;
    z-index: 2;
}

.post-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 50%;
    font-size: 0.8rem;
    line-height: 1;
}

.post-flag svg {
    display: block;
}

/* Color accents by type - simplified */
.flag-pinned { border-color: var(--primary); color: var(--primary); }
.flag-urgent { border-color: #dc3545; color: #dc3545; }
.flag-qa { border-color: #ffc107; color: #ffc107; }
.flag-expiring { border-color: #17a2b8; color: #17a2b8; }

.post-title {
    color: var(--text);
    margin-bottom: 0;
    font-size: 1.25rem;
}

.post-date {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.post-content {
    color: var(--text);
    line-height: 1.75;
    margin: 1rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
}

/* Ensure long words/URLs don't cause horizontal overflow */
.post-content,
.wall-card,
.post-card,
.comment-card,
.card {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Cleaner, content-first wall view: merged into .posts-list above */

.post-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.8rem;
    width: 100%;
    margin-bottom: 0.25rem;
}

.post-meta .sep {
    color: var(--border);
}

.post-meta .post-date {
    margin-left: auto;
    text-align: right;
}

.post-content ul,
.post-content ol {
    padding-left: 1.5rem;
    margin-left: 0;
}

.post-footer {
    border-top: none;
    padding-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

.post-author {
    color: var(--muted);
}

/* Threaded comments */
.comment-card {
    position: relative;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--bg);
}

.comment-card:hover {
    background: var(--card);
    border-color: var(--primary);
}

.comment-thread {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border); /* subtle thread guide */
}

/* Subtle depth cues for deeper nesting */
.comment-thread .comment-thread { border-left-color: var(--primary); opacity: 0.8; }
.comment-thread .comment-thread .comment-thread { border-left-color: var(--primary); opacity: 0.6; }
.comment-thread .comment-thread .comment-thread .comment-thread { border-left-color: var(--primary); opacity: 0.4; }

/* Remove decorative arrow to keep things clean and text-first */
.comment-card::before { content: none; }

/* Comment header/body/footer refinements */
.comment-card .post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.comment-card .post-meta .post-date {
    margin-left: auto;
}

.comment-card .post-content {
    margin-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.comment-card .post-footer {
    border-top: none;
    padding-top: 0.5rem;
}

.comment-card .post-author {
    color: var(--muted);
    font-size: 0.8rem;
}

/* Inline wall badge for feed context inside comments */
.comment-card .post-wall a {
    color: var(--primary);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.125rem 0.375rem;
    text-decoration: none;
    border-radius: var(--border-radius);
}

/* Subscribe Section */
.subscribe-section {
    margin-bottom: 2.5rem;
}

.subscribe-section .card {
    text-align: center;
}

.subscribe-section h2 {
    margin-bottom: 0.5rem;
}

.subscribe-section p {
    margin-bottom: 1.25rem;
    color: var(--muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
    background: var(--card);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--card);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.large-modal {
    max-width: 800px;
}

.modal h3 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* Create Post editor/preview layout */
.create-post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .create-post-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.markdown-editor .markdown-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.markdown-editor textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 0.75rem 0.9rem;
    background: var(--bg);
    color: var(--text);
    min-height: 250px;
}

.markdown-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    min-height: 250px;
}

.markdown-preview h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 600;
}

.wysiwyg-editor {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    min-height: 250px;
}

.ql-toolbar.ql-snow {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-color: var(--border);
    background: var(--bg);
}

.ql-container.ql-snow {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    border-color: var(--border);
    color: var(--text);
}

.ql-editor {
    min-height: 250px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Checkbox grid for weekly recurrence selection */
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.checkbox-grid label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: var(--border-radius);
}

/* Form row for compact time inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

/* Messages */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    color: #ffffff;
    font-weight: 500;
    z-index: 1001;
    max-width: calc(100vw - 40px);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.message.success {
    background: #28a745;
}

.message.error {
    background: #dc3545;
}

.message-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    opacity: 0.8;
}

/* QR Code Icon Button */
.qr-icon-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text);
    transition: all 0.2s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-icon-btn:hover {
    color: var(--primary);
    background: var(--card);
    border-color: var(--primary);
}

.qr-icon-btn svg {
    width: 20px;
    height: 20px;
}

/* QR Code Styles */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.qr-container canvas,
.qr-container img {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    display: block;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Accordion Styles */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.accordion-header:hover {
    opacity: 0.8;
}

.accordion-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
}

.accordion-icon {
    transition: transform 0.3s ease;
    color: var(--muted);
    flex-shrink: 0;
}

.accordion-header.active .accordion-icon {
    color: var(--primary);
}

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

details[open] .accordion-icon {
    transform: rotate(180deg);
}

.accordion-header {
    list-style: none; /* remove default marker */
}

.accordion-header::-webkit-details-marker {
    display: none; /* remove default marker for Safari */
}

/* Create Wall Section */
.create-wall-section {
    margin-bottom: 3rem;
    border: 1px solid var(--border);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 1rem 0;
        margin-bottom: 1.5rem;
    }
    
    .compact-header {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }
    
    .compact-header .header-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .compact-header .header-left,
    .compact-header .header-right {
        justify-content: center;
        flex: none;
    }
    
    .compact-header .wall-title {
        font-size: 1.25rem;
        order: -1;
    }
    
    .logo {
        font-size: 1.75rem;
    }
    
    .card {
        padding: 1.25rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .search-input {
        min-width: auto;
        flex: 1;
    }
    
    .walls-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .wall-actions {
        flex-direction: column;
    }

    /* Stack pagination controls to avoid cramped horizontal layout */
    .pagination {
        flex-direction: column !important;
        align-items: stretch;
    }
    .pagination .btn {
        width: 100%;
    }
    .pagination .pagination-status {
        align-self: center;
        margin: 0.25rem 0;
    }
    
    .posts-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .modal {
        margin: 20px;
        padding: 1.25rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .wall-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-results-info {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        text-align: center;
    }
    
    .accordion-header h3 {
        font-size: 1.1rem;
    }
    
    .accordion-content {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .main-header .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .main-header .header-logo {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        text-align: center;
    }

    .compact-header .wall-title {
        font-size: 1.25rem;
        order: -1;
    }

    .main-header .header-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .main-header .header-actions .btn {
        width: 100%;
    }

    /* Sidebar becomes non-sticky and full-width stack */
    .sidebar-column { position: static; }
    /* Hide TOC on mobile */
    .toc-card { display: none; }
    /* Move Included walls below feed on mobile */
    .included-walls-desktop { display: none; }
    .included-walls-mobile { display: block; }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.875rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .btn {
        width: 100%;
    }

     /* Tighter pagination spacing on very small screens */
     .pagination {
         gap: 0.4rem !important;
     }
    
    .wall-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .accordion-header h3 {
        font-size: 1rem;
    }
    
    .accordion-icon {
        width: 16px;
        height: 16px;
    }
    
    .compact-header .wall-title {
        font-size: 1.125rem;
    }
    
    .main-header .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-header .tagline {
        text-align: center;
    }
    
    .wall-id-clickable,
    .admin-email {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: 240px 1fr; /* Narrower sidebar, more content space */
    }

    #main-grid-front {
        grid-template-columns: 1fr 240px; /* Content first, then narrower sidebar */
    }
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-column {
    position: sticky;
    top: 2rem;
    align-self: start;
}

#sidebar-front {
    margin-top: 0;
}

/* About box list */
.about-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 0.75rem;
    font-size: 0.8rem;
}
.about-list dt {
    color: var(--muted);
    font-weight: 500;
    opacity: 0.75;
}
.about-list dd {
    margin: 0;
    color: var(--muted);
    word-break: break-all;
    font-size: 0.8rem;
}

/* About details (collapsible on mobile) */
.about-details summary {
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--muted);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    opacity: 0.85;
}
.about-details summary::-webkit-details-marker { display: none; }
.about-details[open] summary { margin-bottom: 0.75rem; }

/* TOC */
.toc-card {
    position: sticky;
    top: 8rem; /* Adjust based on header height if header is sticky */
    opacity: 0.85;
}
.toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    font-size: 0.75rem;
}
.toc a {
    color: var(--muted);
    text-decoration: none;
    display: block;
    padding: 0.2rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    opacity: 0.75;
}
.toc a:hover {
    color: var(--text);
    background: var(--bg);
    opacity: 1;
}
.toc-item.level-h1 { margin-left: 0; }
.toc-item.level-h2 { margin-left: 0.75rem; }
.toc-item.level-h3 { margin-left: 1.5rem; }

/* Included walls placement helpers */
.included-walls-card { 
    margin-top: 0; 
    opacity: 0.9;
}
.included-walls-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    opacity: 0.85;
}
.included-walls-desktop { display: block; }
.included-walls-mobile { display: none; }

/* Form Control */
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    background-color: var(--bg);
    color: var(--text);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* New App Header */
.app-header {
    background: transparent;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: none;
}

.app-header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
}

.app-header .header-left,
.app-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 150px;
}

.app-header .header-center {
    flex-grow: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header .page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.app-header .header-icons {
    display: flex;
    align-items: center;
    margin-left: 0.75rem;
}

.app-header .back-link {
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0.75;
}

.app-header .back-link:hover {
    color: var(--text);
    opacity: 1;
}

.app-header .icon-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text);
    transition: all 0.2s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header .icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Feed Styles */
.feed-header {
    margin-bottom: 1.5rem;
}

.feed-details {
    margin-bottom: 1.5rem;
}

/* Removed duplicate .feed-meta; unified later with margin reset */

/* Feed Promo Section */
.feeds-promo-section {
    margin-bottom: 2rem;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--card);
}

.feed-promo-content {
    text-align: center;
}

.feed-promo-content h2 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

.feed-promo-content p {
    margin-bottom: 1.25rem;
    color: var(--muted);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.feed-promo-actions {
    margin-top: 1rem;
}

.subscribed-walls {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.wall-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.wall-tag {
    background: var(--bg);
    color: var(--muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.7rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    opacity: 0.8;
}

.wall-tag:hover {
    background: var(--border);
    color: var(--text);
    opacity: 1;
}

/* Removed duplicate .post-meta; using earlier unified definition above */

.post-wall a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-wall a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.walls-list {
    margin-top: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.search-container {
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    background: var(--bg);
    color: var(--muted);
}

/* Smaller form elements in sidebar */
.sidebar-column .form-group {
    padding-bottom: 0.5rem;
}

.sidebar-column .form-group label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}

.sidebar-column .form-control {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-color: var(--border);
    background: var(--bg);
}

.sidebar-column .btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Removed duplicate .walls-grid; using earlier definition at top and media query overrides */

.wall-item {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    background: var(--card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.wall-item.subscribed {
    border-color: var(--primary);
    background-color: var(--bg);
}

.wall-item-content {
    margin-bottom: 1rem;
}

.wall-item-content h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.wall-card .wall-description {
    font-size: 0.9rem;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wall-item-actions {
    text-align: right;
}

/* Feed cards */
.feed-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feed-card {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--card);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.feed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.feed-card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-card-title {
    font-size: 1.1rem;
    margin: 0;
}

.feed-date {
    font-size: 0.8rem;
    color: var(--muted);
}

.feed-card-body {
    padding: 1rem;
}

.feed-meta {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.feed-card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    text-align: right;
}

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

.loading-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
}

/* Removed duplicate .btn-sm override; using base .btn-sm earlier */

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.mt-3 {
    margin-top: 1.5rem;
}

.app-header .icon-btn:hover {
    color: var(--primary);
    background: var(--card);
    border-color: var(--primary);
}

/* Accessibility helpers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.print-qr {
    display: none;
}

/* Print styles */
@media print {
    /* Reset colors for better print contrast */
    body {
        background: #fff !important;
        color: #000 !important;
    }

    /* Hide interactive and nav elements */
    .btn,
    .icon-btn,
    .message,
    .modal-overlay,
    .app-header,
    .header,
    .qr-icon-btn,
    .form-actions,
    .toc-card,
    .sidebar-column form,
    .posts-header .button-row { display: none !important; }

    /* Single column layout for print */
    .container { max-width: none; padding: 0; }
    .main-grid { display: block; }
    .sidebar-column { position: static; top: auto; page-break-after: always; }

    /* Ensure posts use full width */
    .posts-list { max-width: none; margin: 0; }
    .post-card { page-break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }

    /* Show QR in upper-right */
    .print-qr {
        display: block;
        position: fixed;
        top: 1cm;
        right: 1cm;
        text-align: center;
        z-index: 9999;
    }
    .print-qr img { width: 2.5cm; height: 2.5cm; border: 1px solid #ccc; }
    .print-qr .print-url { font-size: 8pt; margin-top: 4px; color: #555; word-break: break-all; }

    /* Remove unnecessary backgrounds/borders */
    .card, .wall-card { box-shadow: none; border: 1px solid #ccc; }
}

/* Theme and layout overrides (appended to leverage cascade) */
/* Option A: set container width to 1280px */
.container { max-width: 1280px; }

/* Base colors */
body { background-color: var(--bg); color: var(--text); }
h1, h2, h3, h4, h5, h6 { color: var(--text); }
p, .wall-description, .stat, .post-date, .post-author, .feed-date, .feed-meta { color: var(--muted); }

/* Media elements scale down on small screens */
img, svg, canvas, video { max-width: 100%; height: auto; }

/* Header */
.header, .app-header { background: transparent; border-bottom-color: var(--border); }
.app-header { padding: 1.5rem 0; }
.app-header .page-title, .wall-header h3, .post-title { color: var(--text); }
.app-header .back-link, .back-link { color: var(--muted); }
.app-header .back-link:hover, .back-link:hover { color: var(--text); }
.app-header .icon-btn:hover, .qr-icon-btn:hover { color: var(--primary); background: var(--bg); }

/* Cards and surfaces */
.card, .wall-card, .post-card, .modal, .empty-state, .feed-card { background: var(--card); border-color: var(--border); }
.feed-card-header, .feed-card-footer, .accordion-content { border-color: var(--border); }
.comment-card .post-footer { border: none; }

/* Text accents */
.tagline, .search-results-info p { color: var(--muted); }

/* Inputs */
.form-group label { color: var(--text); }
.form-group input, .form-group textarea, .form-control { background-color: var(--bg); border-color: var(--border); color: var(--text); }
.form-group input:focus, .form-group textarea:focus, .search-input-page:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,123,255,0.25); }

/* Buttons */
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline { color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

/* Badges and subtle surfaces */
.wall-id, .wall-id-clickable, .qr-container { background: var(--bg); border-color: var(--border); }
.comment-card .post-wall a { background: var(--card); border-color: var(--border); }

/* Links */
.toc a { color: var(--muted); }
.toc a:hover { color: var(--text); }

/* Threads */
.comment-thread { border-left-color: var(--border); }