/* Amity */

/* === Theme Variables === */
:root {
    /* Backgrounds */
    --color-bg-body: #f5f5f5;
    --color-bg-card: #ffffff;
    --color-bg-header: #2c3e50;
    --color-bg-input: #ffffff;
    --color-bg-muted: #f8f9fa;
    --color-accent-bg: rgba(52, 152, 219, 0.08);
    --color-success-accent-bg: rgba(34, 197, 94, 0.08);

    /* Text */
    --color-text-primary: #333333;
    --color-text-secondary: #7f8c8d;
    --color-text-heading: #2c3e50;
    --color-text-muted: #95a5a6;
    --color-text-header: #ffffff;
    --color-text-nav: #ecf0f1;
    --color-text-nav-muted: #bdc3c7;

    /* Links */
    --color-link: #0066cc;
    --color-accent: #3498db;
    --color-accent-hover: #2980b9;

    /* Borders */
    --color-border: #ecf0f1;
    --color-border-input: #bdc3c7;

    /* Buttons */
    --color-btn-bg: #ecf0f1;
    --color-btn-text: #2c3e50;
    --color-btn-border: #bdc3c7;
    --color-btn-hover: #d5dbdb;

    /* Status colors */
    --color-success-bg: #d5f5e3;
    --color-success-text: #1e8449;
    --color-success-border: #82e0aa;
    --color-error-bg: #fadbd8;
    --color-error-text: #922b21;
    --color-error-border: #f1948a;
    --color-warning-bg: #fef9e7;
    --color-warning-text: #9a7d0a;
    --color-warning-border: #f7dc6f;
    --color-muted-bg: #eaecee;
    --color-muted-text: #566573;

    /* Icon buttons */
    --color-btn-icon-bg: #f8f9fa;
    --color-btn-icon-text: #666666;
    --color-btn-icon-hover: #ecf0f1;

    /* Hover states */
    --color-bg-hover: #f0f0f0;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-dropdown: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-modal: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Backgrounds */
    --color-bg-body: #1a1a2e;
    --color-bg-card: #16213e;
    --color-bg-header: #0f0f23;
    --color-bg-input: #1f2937;
    --color-bg-muted: #1f2937;
    --color-accent-bg: rgba(96, 165, 250, 0.1);
    --color-success-accent-bg: rgba(34, 197, 94, 0.1);

    /* Text */
    --color-text-primary: #e4e4e7;
    --color-text-secondary: #a1a1aa;
    --color-text-heading: #f4f4f5;
    --color-text-muted: #71717a;
    --color-text-header: #ffffff;
    --color-text-nav: #d4d4d8;
    --color-text-nav-muted: #a1a1aa;

    /* Links */
    --color-link: #93c5fd;
    --color-accent: #60a5fa;
    --color-accent-hover: #3b82f6;

    /* Borders */
    --color-border: #374151;
    --color-border-input: #4b5563;

    /* Buttons */
    --color-btn-bg: #374151;
    --color-btn-text: #e4e4e7;
    --color-btn-border: #4b5563;
    --color-btn-hover: #4b5563;

    /* Status colors (adjusted for dark bg) */
    --color-success-bg: #064e3b;
    --color-success-text: #6ee7b7;
    --color-success-border: #059669;
    --color-error-bg: #7f1d1d;
    --color-error-text: #fca5a5;
    --color-error-border: #b91c1c;
    --color-warning-bg: #78350f;
    --color-warning-text: #fcd34d;
    --color-warning-border: #b45309;
    --color-muted-bg: #374151;
    --color-muted-text: #9ca3af;

    /* Icon buttons */
    --color-btn-icon-bg: #1f2937;
    --color-btn-icon-text: #9ca3af;
    --color-btn-icon-hover: #374151;

    /* Hover states */
    --color-bg-hover: #2d3748;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-dropdown: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-modal: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg-body);
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Layout === */
.header {
    background: var(--color-bg-header);
    color: var(--color-text-header);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-header);
    text-decoration: none;
}

.header-brand:hover {
    text-decoration: none;
    color: var(--color-text-nav-muted);
}

.logo-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.footer {
    background: var(--color-bg-header);
    color: var(--color-text-muted);
    text-align: center;
    padding: 1rem;
    font-size: 0.875rem;
}

/* === Navigation === */
.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.nav-link {
    color: var(--color-text-nav);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255,255,255,0.15);
    color: var(--color-text-header);
    font-weight: 500;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.user-name {
    color: var(--color-text-nav-muted);
}

.user-name-link {
    color: var(--color-text-nav-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.user-name-link:hover {
    color: var(--color-text-nav);
    text-decoration: none;
    background: rgba(255,255,255,0.1);
}

.user-name-link.active {
    color: var(--color-text-header);
    font-weight: 500;
    background: rgba(255,255,255,0.15);
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--color-btn-bg);
    color: var(--color-btn-text);
    border: 1px solid var(--color-btn-border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    text-align: center;
}

.btn:hover {
    background: var(--color-btn-hover);
    text-decoration: none;
}

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

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

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

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

.btn-secondary {
    background: #95a5a6;
    color: white;
    border-color: #7f8c8d;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-warning {
    background: #f39c12;
    color: white;
    border-color: #d68910;
}

.btn-warning:hover {
    background: #d68910;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    border-radius: 4px;
    background: var(--color-btn-icon-bg);
    border: none;
    cursor: pointer;
    color: var(--color-btn-icon-text);
    text-decoration: none;
    transition: opacity 0.15s, background 0.15s;
}

.btn-icon:hover {
    opacity: 0.8;
    text-decoration: none;
    background: var(--color-btn-icon-hover);
}

.btn-icon-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.btn-icon-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.btn-icon-danger {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.btn-icon-danger:hover {
    background: var(--color-error-bg);
    opacity: 0.8;
}

/* === Forms === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

/* Base input styling - all text-like inputs */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="search"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="search"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* Textarea styling */
.form-group textarea,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* Select styling */
.form-group select,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    -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='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

[data-theme="dark"] .form-group select,
[data-theme="dark"] select {
    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='%23aaa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* File input styling */
.form-group input[type="file"],
input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button,
input[type="file"]::file-selector-button {
    padding: 0.375rem 0.75rem;
    margin-right: 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    background: var(--color-btn-bg);
    color: var(--color-btn-text);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s;
}

.form-group input[type="file"]::file-selector-button:hover,
input[type="file"]::file-selector-button:hover {
    background: var(--color-btn-hover);
}

/* Focus states for all form elements */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

/* Checkbox and radio styling */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--color-text-primary);
    font-weight: normal;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* Radio group container */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.radio-group .radio-label {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg-card);
    transition: border-color 0.15s, background-color 0.15s;
}

.radio-group .radio-label:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-bg);
}

/* Checked radio label styling handled by input accent-color */

.radio-help {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
    margin-left: 1.5rem;
}

/* Fieldset and legend styling */
fieldset {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem 0;
    background: var(--color-bg-card);
}

legend {
    padding: 0 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-heading);
}

.form-help {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.form-help.form-warning {
    color: var(--color-warning-text);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.inline-form {
    display: inline;
}

/* === Alerts === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.alert-info {
    background: var(--color-accent-bg);
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
}

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-bg-header) 0%, var(--color-accent) 100%);
}

.login-box {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin: 0 0 0.5rem;
    text-align: center;
    color: var(--color-text-heading);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-logo .logo-icon {
    font-size: 2.5rem;
}

.login-box .subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

/* OIDC login section */
.oidc-section {
    margin-top: 1.5rem;
}

.divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.divider span {
    padding: 0 0.75rem;
}

.oidc-providers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.oidc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* === Breadcrumbs === */
.breadcrumbs {
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

.breadcrumb-link {
    color: var(--color-text-secondary);
}

.breadcrumb-sep {
    margin: 0 0.5rem;
    color: var(--color-border-input);
}

.breadcrumb-current {
    color: var(--color-text-heading);
    font-weight: 500;
}

/* === Files === */
.files-page {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.files-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.upload-form {
    display: flex;
    gap: 0.5rem;
}

.mkdir-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.mkdir-form input {
    padding: 0.5rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
}

/* New document dropdown */
.new-document-dropdown {
    position: relative;
    display: inline-block;
}

.new-document-dropdown .dropdown-toggle {
    cursor: pointer;
}

.new-document-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 180px;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    box-shadow: var(--shadow-dropdown);
}

.new-document-dropdown.open .dropdown-menu {
    display: block;
}

.new-document-dropdown .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    font-size: 0.9rem;
}

.new-document-dropdown .dropdown-item:hover {
    background: var(--color-bg-hover);
}

.new-document-dropdown form {
    margin: 0;
}

.new-document-dropdown .dropdown-section {
    padding: 0.5rem 1rem;
}

.new-document-dropdown .dropdown-label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

.new-document-dropdown .dropdown-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    font-size: 0.9rem;
}

.new-document-dropdown .dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0.5rem 0;
}

/* Upload overlay and progress */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.upload-modal {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 2rem;
    min-width: 320px;
    max-width: 90%;
    box-shadow: var(--shadow-modal);
}

.upload-modal h3 {
    margin: 0 0 1rem 0;
    color: var(--color-text-heading);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background: var(--color-bg-muted);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 10px;
    transition: width 0.2s ease;
}

.progress-text {
    min-width: 3rem;
    text-align: right;
    font-weight: 600;
    color: var(--color-text-primary);
}

.progress-details {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Rename dialog */
.rename-input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    font-size: 1rem;
}

.dialog-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
}

.files-table th,
.files-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.files-table th {
    background: var(--color-bg-muted);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.files-table tr:hover {
    background: var(--color-bg-muted);
}

.col-name { width: 50%; }
.col-size { width: 15%; }
.col-modified { width: 20%; }
.col-actions { width: 15%; }

/* File icons (CSS-only) */
.icon-folder::before,
.icon-file::before,
.icon-image::before,
.icon-pdf::before,
.icon-document::before,
.icon-spreadsheet::before,
.icon-presentation::before,
.icon-text::before,
.icon-code::before,
.icon-archive::before,
.icon-audio::before,
.icon-video::before {
    display: inline-block;
    width: 1.25rem;
    text-align: center;
    margin-right: 0.5rem;
}

.icon-folder::before { content: "📁"; }
.icon-file::before { content: "📄"; }
.icon-image::before { content: "🖼️"; }
.icon-pdf::before { content: "📕"; }
.icon-document::before { content: "📝"; }
.icon-spreadsheet::before { content: "📊"; }
.icon-presentation::before { content: "📽️"; }
.icon-text::before { content: "📄"; }
.icon-code::before { content: "💻"; }
.icon-archive::before { content: "📦"; }
.icon-audio::before { content: "🎵"; }
.icon-video::before { content: "🎬"; }

/* === Tables (shared) === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-card);
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    background: var(--color-bg-muted);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.data-table tr:hover {
    background: var(--color-bg-muted);
}

.data-table code {
    font-size: 0.85rem;
    background: var(--color-bg-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    word-break: break-all;
}

/* Add block form styling */
.add-block-form {
    background: var(--color-bg-muted);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

/* === Status badges === */
.status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.status-accepted {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.status-declined {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.status-removed {
    background: var(--color-muted-bg);
    color: var(--color-muted-text);
}

/* Status helper classes for text/form help */
.status-success {
    color: var(--color-success-text);
}

.status-warning {
    color: var(--color-warning-text);
}

.status-error {
    color: var(--color-error-text);
}

/* Badge variants (for inline indicators) */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.badge-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.badge-info {
    background: var(--color-accent-bg);
    color: var(--color-accent);
}

.badge-muted {
    background: var(--color-muted-bg);
    color: var(--color-muted-text);
}

/* === Sections === */
.section {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}

.section h2 {
    margin: 0 0 0.5rem;
    color: var(--color-text-heading);
}

.page-desc {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.section-info {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* === Empty states === */
.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-secondary);
    background: var(--color-bg-muted);
    border-radius: 4px;
}

/* === Admin === */
.admin-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
}

.admin-nav a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
}

.admin-nav a:hover {
    color: var(--color-text-heading);
    text-decoration: none;
    border-bottom-color: var(--color-border-input);
}

.admin-nav a.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* Admin sub-navigation (for sections like Federation) */
.admin-subnav {
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.admin-subnav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
    background: var(--color-bg-muted);
    border-radius: 6px;
    padding: 0.25rem;
}

.admin-subnav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text-secondary);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: color 0.15s, background-color 0.15s;
}

.admin-subnav a:hover {
    color: var(--color-text-heading);
    text-decoration: none;
    background-color: var(--color-bg-card);
}

.admin-subnav a.active {
    color: var(--color-accent);
    background-color: var(--color-bg-card);
    font-weight: 500;
}

.admin-subnav .badge {
    display: inline-block;
    background: var(--color-error-bg);
    color: var(--color-error-text);
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.25rem;
    font-weight: 600;
}

.status-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.status-list dt {
    font-weight: 500;
    color: var(--color-text-secondary);
}

.status-list dd {
    margin: 0;
}

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

/* === Responsive === */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .nav {
        flex-direction: column;
        width: 100%;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .nav-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.2);
        width: 100%;
        justify-content: center;
    }

    .main {
        padding: 1rem;
    }

    .files-toolbar {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    /* Grids - single column on mobile */
    .friends-grid,
    .rooms-list {
        grid-template-columns: 1fr;
    }

    /* Tables - horizontal scroll on mobile */
    .files-table,
    .data-table,
    .ssh-keys-table {
        font-size: 0.875rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .col-modified,
    .col-size {
        display: none;
    }

    /* Admin navigation - scrollable on mobile */
    .admin-nav ul {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .admin-nav a {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Chat tabs - scrollable on mobile */
    .chat-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .chat-tab {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Sections - less padding on mobile */
    .section,
    .profile-section {
        padding: 1rem;
    }

    /* Touch targets for mobile */
    .btn-icon {
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .btn-small {
        padding: 0.5rem 0.875rem;
        min-height: 36px;
    }

    /* Touch targets for checkboxes and radios */
    .radio-label input[type="radio"],
    .checkbox-label input[type="checkbox"] {
        width: 1.5rem;
        height: 1.5rem;
    }

    .radio-label,
    .checkbox-label {
        padding: 0.5rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Action buttons - more spacing */
    .actions-cell {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .header-brand .logo-text {
        font-size: 1.25rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Action buttons - wrap on small screens */
    .post-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .post-actions .btn,
    .post-actions .btn-small {
        flex: 1 1 auto;
        min-width: 70px;
        text-align: center;
    }

    .col-actions {
        white-space: normal;
    }

    /* Form groups - prevent overflow */
    .form-row .form-group {
        min-width: min(200px, 100%);
    }
}

/* === Profile Page === */
.profile-page h1 {
    margin: 0 0 1.5rem;
    color: var(--color-text-heading);
}

.profile-section {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}

.profile-section h2 {
    margin: 0 0 1rem;
    color: var(--color-text-heading);
    font-size: 1.25rem;
}

.profile-section h3 {
    margin: 1.5rem 0 1rem;
    color: var(--color-text-heading);
    font-size: 1rem;
}

.profile-form {
    max-width: 500px;
}

.input-readonly {
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
}

.ssh-keys-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.ssh-keys-table th,
.ssh-keys-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.ssh-keys-table th {
    background: var(--color-bg-muted);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.ssh-keys-table code {
    font-size: 0.75rem;
    background: var(--color-bg-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.add-key-form {
    background: var(--color-bg-muted);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.add-key-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    resize: vertical;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
}

/* Profile page avatar section */
.avatar-section {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.avatar-preview {
    flex-shrink: 0;
}

.avatar-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--color-bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--color-text-muted);
}

.avatar-form {
    flex: 1;
}

.avatar-actions {
    display: flex;
    gap: 0.5rem;
}

/* Copy field styling (for URLs, addresses, etc.) */
.copy-field {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.copy-field input {
    flex: 1;
}

/* Chat disabled notice page */
.chat-disabled-page {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.notice-card {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-card);
}

.notice-card.warning {
    border-left: 4px solid var(--color-warning-border);
}

.notice-card h1 {
    margin-top: 0;
    color: var(--color-text-heading);
}

.notice-card p {
    color: var(--color-text-secondary);
    margin: 0.5rem 0;
}

.admin-notice {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--color-bg-muted);
    border-radius: 4px;
    text-align: left;
}

.admin-notice code {
    background: var(--color-bg-card);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: monospace;
}

/* === Invite Page === */
.invite-created-page h1 {
    margin: 0 0 1.5rem;
    color: var(--color-text-heading);
}

.invite-url-box {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
}

.invite-url-box label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.copy-input-group {
    display: flex;
    gap: 0.5rem;
}

.copy-input-group .invite-url-input {
    flex: 1;
}

.invite-url-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
}

.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    border-color: var(--color-primary);
}

.btn-copy.copied {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

/* === Files Page Sections === */
.files-section {
    margin-bottom: 2rem;
}

.files-section h2 {
    margin: 0 0 0.5rem;
    color: var(--color-text-heading);
}

.files-section.remote-shares {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

/* === Shares Page === */
.shares-page h1 {
    margin: 0 0 0.5rem;
    color: var(--color-text-heading);
}

.path-display {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

.path-display strong {
    color: var(--color-text-heading);
    font-family: monospace;
    background: var(--color-bg-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.shares-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* === Share Manage Dropdown === */
.share-manage-dropdown {
    display: inline-block;
    position: relative;
}

.share-manage-dropdown summary {
    list-style: none;
    cursor: pointer;
}

.share-manage-dropdown summary::-webkit-details-marker {
    display: none;
}

.share-manage-dropdown .dropdown-content {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 150px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    box-shadow: var(--shadow-dropdown);
    z-index: 100;
    margin-top: 4px;
}

.share-manage-dropdown .dropdown-form {
    display: block;
}

.share-manage-dropdown .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-heading);
}

.share-manage-dropdown .dropdown-item:hover {
    background: var(--color-bg-muted);
}

.share-manage-dropdown .dropdown-item.danger {
    color: var(--color-error-text);
}

.actions-cell {
    white-space: nowrap;
}

/* Right-align action buttons in tables */
td.col-actions,
.data-table td:last-child,
.ssh-keys-table td:last-child {
    text-align: right;
}

/* === Remote Files Page === */
.remote-files-page .share-info {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

.remote-files-page .error-message {
    background: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--color-error-text);
}

.remote-files-page .back-link {
    margin-top: 2rem;
}

/* === Theme Selector === */
.theme-options {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

/* === Error Pages === */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--color-bg-primary);
}

.error-container {
    text-align: center;
    max-width: 500px;
    padding: 3rem;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-title {
    font-size: 1.75rem;
    color: var(--color-text-primary);
    margin: 0 0 1rem 0;
}

.error-page .error-message {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.error-details {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
    overflow-x: auto;
}

.error-details code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Friends Page Enhanced === */
.add-friend-details {
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-muted);
}

.add-friend-details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text-heading);
}

.add-friend-details summary:hover {
    background: var(--color-bg-hover);
}

.add-friend-details[open] summary {
    border-bottom: 1px solid var(--color-border);
}

.add-friend-details .add-friend-form {
    padding: 1rem;
    background: var(--color-bg-card);
}

/* Friends Grid */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.friend-card {
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.friend-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
}

.friend-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.friend-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-avatar .avatar-placeholder {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.friend-identity {
    flex: 1;
    min-width: 0;
}

.friend-name {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    color: var(--color-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-address {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    word-break: break-all;
}

.friend-details {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.friend-detail {
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
    display: flex;
    gap: 0.5rem;
}

.friend-detail:last-child {
    margin-bottom: 0;
}

.friend-detail .detail-label {
    color: var(--color-text-secondary);
    min-width: 80px;
    flex-shrink: 0;
}

.friend-detail a {
    color: var(--color-link);
    text-decoration: none;
    word-break: break-all;
}

.friend-detail a:hover {
    text-decoration: underline;
}

.friend-notes {
    flex-direction: column;
    gap: 0.25rem;
}

.friend-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
}

.friend-added {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.friend-actions {
    display: flex;
    gap: 0.5rem;
}

/* === Chat Rooms === */
.chat-rooms-page {
    max-width: 900px;
    margin: 0 auto;
}

.chat-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
}

.chat-tab:hover {
    color: var(--color-text-heading);
    text-decoration: none;
    border-bottom-color: var(--color-border-input);
}

.chat-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.badge-e2ee {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--color-success, #22c55e);
    color: white;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unencrypted-warning {
    padding: 0.75rem 1rem;
    background: var(--color-warning-bg, #fef3c7);
    border: 1px solid var(--color-warning-border, #f59e0b);
    border-radius: 6px;
    margin-bottom: 1.5rem;
    color: var(--color-warning-text, #92400e);
    font-size: 0.9rem;
}

.new-posts-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-primary-bg, #dbeafe);
    border: 1px solid var(--color-primary, #3b82f6);
    border-radius: 6px;
    margin-bottom: 1rem;
    color: var(--color-primary-text, #1e40af);
    font-size: 0.9rem;
}

.new-posts-banner button {
    padding: 0.4rem 0.8rem;
    background: var(--color-primary, #3b82f6);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.new-posts-banner button:hover {
    background: var(--color-primary-hover, #2563eb);
}

.chat-toolbar {
    margin: 1.5rem 0;
}

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

.room-card {
    display: block;
    padding: 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.room-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.room-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 0.5rem;
}

.room-description {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.room-original-name {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0.25rem 0 0.5rem 0;
    font-style: italic;
}

.room-name-edit {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.room-name-edit input {
    flex: 1;
    min-width: 150px;
    max-width: 300px;
}

#room-name-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#room-name-display .btn-icon {
    font-size: 0.9rem;
    padding: 0.25rem 0.4rem;
    opacity: 0.6;
}

#room-name-display .btn-icon:hover {
    opacity: 1;
}

.room-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.new-room-page {
    max-width: 600px;
    margin: 0 auto;
}

.form-info {
    padding: 1rem;
    background: var(--color-muted-bg);
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.form-info p {
    margin: 0;
}

/* === Public Conversations === */
.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.conversation-card {
    display: block;
    padding: 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.conversation-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.conversation-card.unread {
    border-left: 3px solid var(--color-accent);
    background: var(--color-accent-bg);
}

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

.conversation-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.participant {
    font-weight: 500;
    color: var(--color-text);
}

.unread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    background: var(--color-accent);
    color: white;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.unread-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--color-accent);
    color: white;
    border-radius: 999px;
    font-size: 0.85rem;
    margin-left: 1rem;
}

.conversation-subject {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.conversation-preview {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.5rem;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* === Thread View === */
.thread-header {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    color: var(--color-accent);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

.thread-participants {
    padding: 0.75rem 1rem;
    background: var(--color-bg-muted);
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.thread-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ap-message {
    padding: 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.ap-message.read {
    opacity: 0.85;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.sender-name {
    font-weight: 600;
    color: var(--color-text);
}

.message-time {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.visibility-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
}

.visibility-direct {
    background: var(--color-warning-bg, #fef3c7);
    color: var(--color-warning-text, #92400e);
}

.visibility-followers {
    background: var(--color-info-bg, #dbeafe);
    color: var(--color-info-text, #1e40af);
}

.visibility-unlisted {
    background: var(--color-muted-bg);
    color: var(--color-text-muted);
}

.visibility-public {
    background: var(--color-success-bg, #dcfce7);
    color: var(--color-success-text, #166534);
}

.message-content {
    line-height: 1.6;
    word-break: break-word;
}

.message-content a {
    color: var(--color-accent);
}

.content-warning {
    cursor: pointer;
}

.content-warning summary {
    padding: 0.5rem;
    background: var(--color-warning-bg, #fef3c7);
    border-radius: 4px;
    color: var(--color-warning-text, #92400e);
    font-size: 0.9rem;
}

.content-warning .message-content {
    margin-top: 0.75rem;
}

.message-actions {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.thread-reply {
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* === Compose Form === */
.compose-header {
    margin-bottom: 1.5rem;
}

.compose-form {
    max-width: 600px;
}

.compose-form .form-group {
    margin-bottom: 1.25rem;
}

.compose-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.compose-form input[type="text"],
.compose-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    background-color: var(--color-bg-input);
    color: var(--color-text-primary);
    font-size: 1rem;
}

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

.compose-form input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* === Chat Room Page Variables === */
.chat-room-page {
    /* CSS variable aliases for backwards compat */
    --bg-secondary: var(--color-bg-muted);
    --border-color: var(--color-border);
    --text-muted: var(--color-text-muted);
    --success-bg: var(--color-success-bg);
    --success-text: var(--color-success-text);
    --danger-bg: var(--color-error-bg);
    --danger-text: var(--color-error-text);
    /* Layout */
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px); /* Dynamic viewport height for mobile */
}

.add-member-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.add-member-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}

.add-member-form {
    display: flex;
    gap: 0.25rem;
}

.add-member-form input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.add-member-form .btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.error-message {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Mobile toggle for members sidebar */
.members-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    /* Chat room mobile layout adjustments */
    .chat-room-page {
        height: calc(100vh - 120px);
        height: calc(100dvh - 120px);
    }

    .chat-header {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .chat-header h1 {
        font-size: 1.1rem;
        margin: 0;
    }

    .chat-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .chat-actions .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .members-toggle {
        display: block;
        margin: 0.5rem 1rem;
        flex-shrink: 0;
    }

    .compose-area {
        padding: 0.5rem;
    }

    .compose-area input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .members-sidebar {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        width: 280px;
        max-width: 80vw;
        z-index: 1000;
        background: var(--color-bg-card);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
    }

    .members-sidebar.open {
        display: block;
    }

    .members-sidebar .sidebar-close {
        display: block;
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--color-text-muted);
        padding: 0.25rem 0.5rem;
        line-height: 1;
    }

    .members-sidebar .sidebar-close:hover {
        color: var(--color-text);
    }

    /* Show remove button on mobile (hidden on desktop) */
    .members-sidebar .btn-remove-member {
        display: inline-block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.visible {
        display: block;
    }
}

/* === Public Feed Timeline === */
.messages-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-post {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.timeline-post:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-card);
}

.timeline-post.unread {
    border-left: 3px solid var(--color-accent);
    background: var(--color-accent-bg);
}

.timeline-post.own-message {
    border-left: 3px solid var(--color-success, #22c55e);
    background: var(--color-success-accent-bg);
}

.timeline-post.own-message:hover {
    border-color: var(--color-success, #22c55e);
}

.reply-post.own-message {
    border-left: 3px solid var(--color-success, #22c55e);
    background: var(--color-success-accent-bg);
}

.ap-message.own-message {
    border-left: 3px solid var(--color-success, #22c55e);
    background: var(--color-success-accent-bg);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.post-author {
    font-weight: 600;
    color: var(--color-text-heading);
    text-decoration: none;
}

.post-author:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.post-handle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.post-time {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

.post-edited {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.post-visibility {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.post-visibility.public {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.post-visibility.unlisted {
    background: var(--color-muted-bg);
    color: var(--color-muted-text);
}

.post-visibility.followers {
    background: var(--color-info-bg, #dbeafe);
    color: var(--color-info-text, #1e40af);
}

.post-visibility.direct {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.post-content {
    line-height: 1.6;
    color: var(--color-text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-content a {
    color: var(--color-accent);
}

.post-content a:hover {
    text-decoration: underline;
}

.post-content .hashtag,
.message-content .hashtag {
    color: var(--color-accent);
    text-decoration: none;
}

.post-content .hashtag:hover,
.message-content .hashtag:hover {
    text-decoration: underline;
}

.post-content p {
    margin: 0 0 0.5rem 0;
}

.post-content p:last-child {
    margin-bottom: 0;
}

.post-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.post-actions .btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Reply indicator for threaded posts */
.post-reply-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.post-reply-indicator::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border-left: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    border-radius: 0 0 0 4px;
    margin-right: 0.25rem;
}

/* Nested replies in thread */
.timeline-post .thread-replies {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.thread-replies .reply-post {
    padding: 0.75rem;
    margin-top: 0.75rem;
    background: var(--color-bg-muted);
    border-radius: 8px;
    border-left: 3px solid var(--color-border);
}

.thread-replies .reply-post:first-child {
    margin-top: 0;
}

.reply-post .post-header {
    margin-bottom: 0.5rem;
}

.reply-post .post-content {
    font-size: 0.95rem;
}

.reply-post .post-actions {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.thread-more-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    margin-top: 0.75rem;
    color: var(--color-accent);
    font-size: 0.85rem;
    text-decoration: none;
}

.thread-more-link:hover {
    text-decoration: underline;
}

/* Sensitive content in posts */
.post-content-warning {
    cursor: pointer;
}

.post-content-warning summary {
    padding: 0.5rem 0.75rem;
    background: var(--color-warning-bg);
    border-radius: 6px;
    color: var(--color-warning-text);
    font-size: 0.9rem;
}

.post-content-warning .post-content {
    margin-top: 0.75rem;
}

/* === @mention Autocomplete === */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: var(--shadow-dropdown);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 2px;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--color-bg-hover);
}

.autocomplete-name {
    font-weight: 500;
    color: var(--color-text);
}

.autocomplete-handle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Emoji autocomplete */
.emoji-item {
    gap: 0.5rem;
}

.emoji-preview {
    font-size: 1.5rem;
    line-height: 1;
    width: 1.5em;
    text-align: center;
}

.emoji-preview img {
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
}

.emoji-shortcode {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Custom emoji in post content */
.custom-emoji {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    margin: 0 0.1em;
}

/* === Chat Room Layout === */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.chat-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--color-accent-bg);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.message:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-card);
}

.message.own-message {
    border-left: 3px solid var(--color-success, #22c55e);
    background: var(--color-success-accent-bg);
}

.message.own-message:hover {
    border-color: var(--color-success, #22c55e);
}

.message-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-actions {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

/* Inline message edit form */
.edit-form {
    margin-top: 0.5rem;
}

.edit-textarea-container {
    position: relative;
}

.edit-textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.edit-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.edit-buttons .btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

.message-encrypted {
    font-style: italic;
    color: var(--color-text-muted);
}

.compose-area {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.compose-area input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.compose-area input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.compose-area .autocomplete-container {
    flex: 1;
}

.compose-area .autocomplete-container input {
    width: 100%;
}

.members-sidebar {
    width: 200px;
    border-left: 1px solid var(--color-border);
    padding: 1rem;
    overflow-y: auto;
}

.members-sidebar h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.member-item {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem;
}

.member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.member-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.btn-remove-member {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.25rem;
    font-size: 0.75rem;
    color: var(--color-error-text);
    flex-shrink: 0;
    opacity: 0.5;
}

.btn-remove-member:hover {
    opacity: 1;
}

.connection-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.connection-status.connected {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.connection-status.disconnected {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.friend-list {
    max-height: 200px;
    overflow-y: auto;
}

.friend-invite-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--color-bg-muted);
    border-radius: 4px;
}

.friend-invite-item .friend-name {
    font-weight: 500;
}

.friend-id {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.friend-invite-item .invite-btn {
    align-self: flex-start;
    margin-top: 0.25rem;
}

/* === Public Thread Page === */
.public-thread-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px); /* Dynamic viewport height for mobile */
}

.thread-header-area {
    flex-shrink: 0;
}

.public-thread-page .thread-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.public-thread-page .thread-reply {
    flex-shrink: 0;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
}

/* === Public Feed Page === */
.public-feed-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px); /* Dynamic viewport height for mobile */
}

.public-feed-header {
    flex-shrink: 0;
}

.public-feed-page .messages-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.public-feed-footer {
    flex-shrink: 0;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
}

/* === Utility classes for display === */
.hidden {
    display: none !important;
}

.inline {
    display: inline !important;
}

.cw-input {
    display: none;
}

.cw-input.visible {
    display: block;
}

/* Upload/rename overlay progress styles */
.rename-progress-mode .progress-bar {
    margin-bottom: 0.5rem;
}

.rename-progress-mode .progress-text {
    text-align: center;
    margin-bottom: 0.5rem;
}

.rename-progress-mode .progress-details {
    text-align: center;
    margin-bottom: 1rem;
}

/* === Public Profile Page === */
.public-profile {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
}

.public-profile .profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.public-profile .profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--color-bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
    color: var(--color-text-muted);
}

.public-profile .profile-avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.public-profile .profile-name {
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}

.public-profile .profile-username {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.public-profile .profile-info {
    background: var(--color-bg-muted);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.public-profile .profile-info dt {
    font-weight: 600;
    margin-top: 1rem;
}

.public-profile .profile-info dt:first-child {
    margin-top: 0;
}

.public-profile .profile-info dd {
    margin: 0.25rem 0 0 0;
    color: var(--color-text-muted);
    word-break: break-all;
}

.public-profile .profile-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.public-profile .profile-footer a {
    color: var(--color-accent);
}

.public-profile .profile-posts {
    margin-top: 2rem;
}

.public-profile .profile-posts h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.public-profile .profile-post {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.public-profile .profile-post .post-content {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.public-profile .profile-post .post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.public-profile .profile-post .post-link {
    color: var(--color-accent);
}

.public-profile .post-content-warning {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.public-profile .post-content-warning summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--color-warning-text);
}

/* === Hashtag Page === */
.hashtag-page {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
}

.hashtag-header {
    text-align: center;
    margin-bottom: 2rem;
}

.hashtag-title {
    font-size: 2rem;
    margin: 0 0 0.5rem;
    color: var(--color-accent);
}

.hashtag-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin: 0;
}

.hashtag-posts {
    margin-top: 1.5rem;
}

.hashtag-post-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.hashtag-post-card .post-author {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.hashtag-post-card .author-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-all;
}

.hashtag-post-card .author-link:hover {
    text-decoration: underline;
}

.hashtag-post-card .post-content {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.hashtag-post-card .post-content p {
    margin: 0 0 0.5rem;
}

.hashtag-post-card .post-content p:last-child {
    margin-bottom: 0;
}

.hashtag-post-card .post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.hashtag-post-card .post-link {
    color: var(--color-accent);
    text-decoration: none;
}

.hashtag-post-card .post-link:hover {
    text-decoration: underline;
}

.hashtag-post-card .post-content-warning {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.hashtag-post-card .post-content-warning summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--color-warning-text);
}

.hashtag-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.hashtag-footer a {
    color: var(--color-accent);
}

.hashtag-page .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

/* === Public Note Page === */
.public-note-page {
    max-width: 600px;
    margin: 2rem auto;
    padding: 1rem;
}

.public-note-page .note-author {
    margin-bottom: 1rem;
}

.public-note-page .author-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.public-note-page .author-link:hover {
    opacity: 0.9;
}

.public-note-page .author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.public-note-page .author-avatar-placeholder {
    background: var(--color-bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.public-note-page .author-info {
    display: flex;
    flex-direction: column;
}

.public-note-page .author-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

.public-note-page .author-handle {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.public-note-page .public-note {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.public-note-page .note-content {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.public-note-page .note-content a {
    color: var(--color-accent);
}

.public-note-page .note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.public-note-page .note-reply-indicator a {
    color: var(--color-accent);
}

.public-note-page .note-content-warning {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.public-note-page .note-content-warning summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--color-warning-text);
}

.public-note-page .note-footer {
    margin-top: 1.5rem;
    text-align: center;
}

/* ========================================
   Admin Page Styles
   ======================================== */

/* Text utilities */
.text-muted {
    color: var(--color-text-secondary);
}

.dynamic-indicator {
    color: var(--color-success-text);
    font-style: italic;
}

.warning {
    color: var(--color-warning-text);
}

.help-text {
    font-size: 0.9em;
    color: var(--color-text-muted);
}

/* Status badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    white-space: nowrap;
}

.status-completed { background: var(--color-success-bg); color: var(--color-success-text); }
.status-failed { background: var(--color-error-bg); color: var(--color-error-text); }
.status-running { background: #e3f2fd; color: #1565c0; }
.status-cancelled { background: var(--color-warning-bg); color: var(--color-warning-text); }
.status-pending { background: var(--color-bg-muted); color: var(--color-text-secondary); }
.status-primary { background: #e3f2fd; color: #1565c0; }
.status-secondary { background: var(--color-bg-muted); color: var(--color-text-secondary); }
.status-trusted { background-color: var(--color-success-bg); color: var(--color-success-text); }
.status-untrusted { background-color: var(--color-warning-bg); color: var(--color-warning-text); }
.status-revoked { background-color: var(--color-error-bg); color: var(--color-error-text); }

/* Dark mode adjustments for running/primary status */
[data-theme="dark"] .status-running,
[data-theme="dark"] .status-primary {
    background: #1e3a5f;
    color: #60a5fa;
}

.actions {
    white-space: nowrap;
}

.actions .btn-small,
.actions .inline-form {
    margin-right: 0.25rem;
}

/* Status row highlighting */
.status-warning {
    background-color: var(--color-warning-bg);
}

.status-danger {
    background-color: var(--color-error-bg);
}

/* SSH Host Keys table */
.host-keys-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

.host-keys-table th,
.host-keys-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.host-keys-table th {
    background: var(--color-bg-muted);
    font-weight: 600;
}

.host-keys-table th:nth-child(1) { width: 18%; }
.host-keys-table th:nth-child(2) { width: 6%; }
.host-keys-table th:nth-child(3) { width: 8%; }
.host-keys-table th:nth-child(4) { width: 18%; }
.host-keys-table th:nth-child(5) { width: 10%; }
.host-keys-table th:nth-child(6) { width: 12%; }
.host-keys-table th:nth-child(7) { width: 12%; }
.host-keys-table th:nth-child(8) { width: 16%; }

.host-keys-table tbody {
    font-size: 0.9em;
}

.host-keys-table td {
    padding: 0.4rem 0.5rem;
}

.fingerprint {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
    font-size: 0.85em;
    cursor: help;
}

.host-keys-table td:nth-child(3) {
    font-family: monospace;
    font-size: 0.85em;
}

.key-change-detail {
    background-color: var(--color-warning-bg);
}

.key-change-detail td {
    padding: 0.25rem 0.5rem;
    color: var(--color-text-secondary);
}

/* Admin Logs Page */
.log-info {
    color: var(--color-text-secondary);
    font-size: 0.9em;
    margin-bottom: 1rem;
}

.log-controls {
    margin-bottom: 1rem;
}

.log-viewer {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-family: monospace;
    font-size: 0.85em;
}

.log-table th,
.log-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.log-table th {
    background: var(--color-bg-muted);
    position: sticky;
    top: 0;
}

.log-instance {
    white-space: nowrap;
    font-family: monospace;
    color: #9c27b0;
    font-weight: bold;
}

[data-theme="dark"] .log-instance {
    color: #ce93d8;
}

.log-time {
    white-space: nowrap;
    color: var(--color-text-secondary);
}

.log-level {
    font-weight: bold;
    white-space: nowrap;
}

.log-target {
    color: var(--color-text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-message {
    word-break: break-word;
}

.log-error { background-color: var(--color-error-bg); }
.log-error .log-level { color: var(--color-error-text); }

.log-warn { background-color: var(--color-warning-bg); }
.log-warn .log-level { color: var(--color-warning-text); }

.log-info .log-level { color: var(--color-accent); }

.log-debug { color: var(--color-text-secondary); }
.log-debug .log-level { color: var(--color-text-secondary); }

.log-trace { color: var(--color-text-muted); }
.log-trace .log-level { color: var(--color-text-muted); }

.no-logs {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-secondary);
}

.log-level-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-actions-inline {
    padding-bottom: 0.25rem;
}

/* Admin Storage Page */
.storage-fields {
    border-left: 3px solid var(--color-border);
    padding-left: 1rem;
    margin-top: 1rem;
}

.cancel-form {
    margin-top: 1rem;
}

.migration-progress {
    background: var(--color-bg-muted);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 24px;
    background: var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    gap: 2rem;
    color: var(--color-text-secondary);
}

.current-file {
    margin-top: 0.5rem;
    color: var(--color-text-secondary);
    font-size: 0.9em;
}

.current-file code {
    background: var(--color-bg-card);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

/* Admin Emoji Page */
.bulk-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.bulk-actions h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.instance-delete-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.instance-delete-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-muted);
    border-radius: 6px;
}

.instance-name {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
}

.btn-danger {
    background-color: var(--color-error);
    border-color: var(--color-error);
    color: white;
}

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

/* Admin Reports Page */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-tabs a {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    transition: background-color 0.15s, border-color 0.15s;
}

.filter-tabs a:hover {
    background: var(--color-bg-card);
    border-color: var(--color-accent);
}

.filter-tabs a.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.actor-url-short {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.85em;
}

.report-reason {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-details {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.5rem 1rem;
    margin: 1rem 0;
}

.report-details dt {
    font-weight: 600;
    color: var(--color-text-muted);
}

.report-details dd {
    margin: 0;
    word-break: break-word;
}

.report-reason-full {
    white-space: pre-wrap;
    background: var(--color-bg-muted);
    padding: 0.5rem;
    border-radius: 4px;
}

.report-status {
    margin-bottom: 1rem;
}

.back-link {
    margin-top: 2rem;
}

code.small {
    font-size: 0.85em;
}

/* Responsive admin styles */
@media (max-width: 768px) {
    .report-details {
        grid-template-columns: 1fr;
    }

    .actor-url-short,
    .report-reason {
        max-width: 150px;
    }
}
