:root {
    --font-sans: system-ui, "Segoe UI", Arial, sans-serif;
    --font-headings: "Segoe UI", Arial, sans-serif;
    --page-bg: #f3efe7;
    --page-bg-accent: radial-gradient(circle at top left, rgba(24, 94, 87, 0.14), transparent 28%),
        radial-gradient(circle at bottom right, rgba(173, 94, 43, 0.12), transparent 26%),
        linear-gradient(180deg, #f8f5ef 0%, #f0ebe1 100%);
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --surface-muted: #f6f2ea;
    --text: #222a35;
    --muted: #5f6979;
    --line: rgba(34, 42, 53, 0.12);
    --line-soft: rgba(34, 42, 53, 0.08);
    --shadow: 0 18px 40px rgba(29, 35, 42, 0.08);
    --primary: #0f6257;
    --primary-dark: #0a4c44;
    --secondary: #ffffff;
    --danger: #9a3d2f;
    --danger-dark: #7d2c21;
    --success: #216b4c;
    --warning: #9a6a1f;
    --info: #2b6488;
    --open: #216b4c;
    --closed: #9a6a1f;
    --archived: #687286;
    --flagged: #8f2a4d;
    --header-surface: rgba(255, 255, 255, 0.34);
    --footer-surface: transparent;
    --nav-item-surface: rgba(255, 255, 255, 0.38);
    --nav-item-hover-surface: rgba(15, 98, 87, 0.08);
    --nav-item-hover-border: rgba(15, 98, 87, 0.14);
    --toggle-surface: rgba(255, 255, 255, 0.58);
    --toggle-hover-surface: rgba(15, 98, 87, 0.1);
    --toggle-border: rgba(34, 42, 53, 0.12);
    --notice-surface: rgba(255, 255, 255, 0.72);
    --notice-line: rgba(34, 42, 53, 0.08);
    --input-border: rgba(34, 42, 53, 0.16);
    --focus-border: rgba(15, 98, 87, 0.48);
    --focus-ring: rgba(15, 98, 87, 0.12);
    --flash-success-bg: rgba(33, 107, 76, 0.12);
    --flash-success-line: rgba(33, 107, 76, 0.16);
    --flash-error-bg: rgba(154, 61, 47, 0.12);
    --flash-error-line: rgba(154, 61, 47, 0.16);
    --alert-bg: rgba(154, 106, 31, 0.1);
    --alert-line: rgba(154, 106, 31, 0.16);
    --privacy-bg: rgba(15, 98, 87, 0.08);
    --privacy-line: rgba(15, 98, 87, 0.12);
    --privacy-text: #0a4c44;
    --status-open-bg: rgba(33, 107, 76, 0.12);
    --status-closed-bg: rgba(154, 106, 31, 0.12);
    --status-archived-bg: rgba(104, 114, 134, 0.12);
    --status-flagged-bg: rgba(143, 42, 77, 0.14);
    --thread-surface: rgba(250, 248, 243, 0.92);
    --thread-line: rgba(34, 42, 53, 0.08);
    --bubble-line: rgba(34, 42, 53, 0.08);
    --incoming-bubble-surface: #ffffff;
    --outgoing-bubble-surface: rgba(15, 98, 87, 0.92);
    --outgoing-bubble-text: #ffffff;
    --system-bubble-surface: rgba(104, 114, 134, 0.1);
    --emoji-surface: rgba(255, 255, 255, 0.9);
    --emoji-line: rgba(34, 42, 53, 0.12);
    --emoji-hover-surface: rgba(15, 98, 87, 0.08);
    --sidebar-surface: rgba(255, 255, 255, 0.7);
    --filter-surface: rgba(255, 255, 255, 0.58);
    --card-hover-border: rgba(15, 98, 87, 0.28);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

[data-theme="dark"] {
    --page-bg: #0d141a;
    --page-bg-accent: radial-gradient(circle at top left, rgba(47, 147, 135, 0.28), transparent 28%),
        radial-gradient(circle at bottom right, rgba(181, 102, 70, 0.24), transparent 26%),
        linear-gradient(180deg, #0d141a 0%, #121c24 100%);
    --surface: rgba(17, 24, 33, 0.88);
    --surface-strong: #18222c;
    --surface-muted: #111922;
    --text: #edf3f8;
    --muted: #a5b3c1;
    --line: rgba(226, 236, 245, 0.12);
    --line-soft: rgba(226, 236, 245, 0.08);
    --shadow: 0 22px 56px rgba(0, 0, 0, 0.34);
    --primary: #49b4a7;
    --primary-dark: #2f9387;
    --secondary: #1b2732;
    --danger: #cf796a;
    --danger-dark: #b65d51;
    --success: #7ad4a8;
    --warning: #e0b56b;
    --info: #86c3ec;
    --open: #7ad4a8;
    --closed: #e0b56b;
    --archived: #bac3cf;
    --flagged: #f096b8;
    --header-surface: rgba(13, 19, 26, 0.76);
    --footer-surface: transparent;
    --nav-item-surface: rgba(255, 255, 255, 0.04);
    --nav-item-hover-surface: rgba(73, 180, 167, 0.12);
    --nav-item-hover-border: rgba(73, 180, 167, 0.2);
    --toggle-surface: rgba(255, 255, 255, 0.04);
    --toggle-hover-surface: rgba(73, 180, 167, 0.12);
    --toggle-border: rgba(226, 236, 245, 0.12);
    --notice-surface: rgba(18, 26, 34, 0.78);
    --notice-line: rgba(226, 236, 245, 0.08);
    --input-border: rgba(226, 236, 245, 0.14);
    --focus-border: rgba(73, 180, 167, 0.52);
    --focus-ring: rgba(73, 180, 167, 0.18);
    --flash-success-bg: rgba(122, 212, 168, 0.14);
    --flash-success-line: rgba(122, 212, 168, 0.22);
    --flash-error-bg: rgba(207, 121, 106, 0.16);
    --flash-error-line: rgba(207, 121, 106, 0.24);
    --alert-bg: rgba(224, 181, 107, 0.14);
    --alert-line: rgba(224, 181, 107, 0.22);
    --privacy-bg: rgba(73, 180, 167, 0.12);
    --privacy-line: rgba(73, 180, 167, 0.2);
    --privacy-text: #d6f5f0;
    --status-open-bg: rgba(122, 212, 168, 0.16);
    --status-closed-bg: rgba(224, 181, 107, 0.16);
    --status-archived-bg: rgba(186, 195, 207, 0.16);
    --status-flagged-bg: rgba(240, 150, 184, 0.18);
    --thread-surface: rgba(10, 15, 21, 0.72);
    --thread-line: rgba(226, 236, 245, 0.08);
    --bubble-line: rgba(226, 236, 245, 0.08);
    --incoming-bubble-surface: #1a2430;
    --outgoing-bubble-surface: linear-gradient(135deg, #2b857a 0%, #225f57 100%);
    --outgoing-bubble-text: #f4fbfc;
    --system-bubble-surface: #16202b;
    --emoji-surface: #1b2632;
    --emoji-line: rgba(226, 236, 245, 0.1);
    --emoji-hover-surface: rgba(73, 180, 167, 0.14);
    --sidebar-surface: rgba(13, 19, 26, 0.74);
    --filter-surface: rgba(16, 23, 31, 0.7);
    --card-hover-border: rgba(73, 180, 167, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background-color: var(--page-bg);
    background-image: var(--page-bg-accent);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

textarea {
    resize: vertical;
}

.site-header,
.site-footer {
    padding: 1rem 1.5rem;
}

.site-header {
    background: var(--header-surface);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.site-footer {
    background: var(--footer-surface);
}

.site-header-inner,
.site-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-brand,
.admin-brand {
    font-family: var(--font-headings);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.site-header-actions,
.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    min-width: 0;
}

.site-header-actions {
    margin-left: auto;
    justify-content: flex-end;
}

.admin-topbar-actions {
    justify-content: flex-end;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
}

.site-nav a,
.admin-nav a {
    color: var(--muted);
    min-width: 0;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.site-nav a {
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.admin-nav a {
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--nav-item-surface);
}

.site-nav a:hover,
.admin-nav a:hover {
    color: var(--text);
}

.site-nav a:hover {
    background: var(--nav-item-hover-surface);
    border-color: var(--nav-item-hover-border);
}

.admin-nav a:hover {
    background: var(--nav-item-hover-surface);
    border-color: var(--nav-item-hover-border);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--toggle-border);
    background: var(--toggle-surface);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: var(--toggle-hover-surface);
    border-color: var(--nav-item-hover-border);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.site-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    min-width: 0;
}

.site-footer {
    color: var(--muted);
}

.site-footer-inner {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
    font-size: 0.95rem;
}

.hero-shell,
.content-shell,
.chat-page {
    padding: 2.5rem 0;
}

.hero-card,
.content-card,
.auth-card,
.chat-card,
.detail-panel,
.summary-card,
.conversation-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero-card,
.content-card,
.auth-card {
    border-radius: var(--radius-lg);
}

.hero-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem;
}

.hero-card h1,
.content-card h1,
.auth-card h1,
.chat-card h1,
.chat-card h2,
.admin-topbar h1 {
    margin: 0;
    font-family: var(--font-headings);
    line-height: 1.1;
}

.hero-card h1 {
    font-size: clamp(2.2rem, 4vw, 3.5rem);
    max-width: 12ch;
}

.hero-copy,
.muted-text,
.admin-brand-copy,
.small-text {
    color: var(--muted);
}

.hero-copy {
    max-width: 60ch;
    font-size: 1.05rem;
    line-height: 1.7;
}

.eyebrow,
.small-label {
    display: inline-block;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-actions,
.notice-grid,
.chat-composer-actions,
.chat-secondary-actions,
.summary-grid,
.stacked-actions,
.conversation-card-meta {
    display: flex;
    gap: 1rem;
}

.hero-actions,
.summary-grid {
    flex-wrap: wrap;
}

.hero-actions form {
    display: flex;
}

.access-gate-form {
    display: grid;
    gap: 0.75rem;
    max-width: 620px;
    margin: 1.5rem 0 0;
}

.access-gate-form label {
    font-weight: 700;
}

.access-gate-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: stretch;
}

.notice-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.notice-card {
    padding: 1.35rem;
    border-radius: var(--radius-md);
    background: var(--notice-surface);
    border: 1px solid var(--notice-line);
}

.notice-card h2 {
    margin-top: 0;
    font-size: 1.05rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.75rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: 160ms ease;
    font-weight: 600;
    max-width: 100%;
    text-align: center;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.button-block {
    width: 100%;
}

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

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    background: var(--secondary);
    border-color: var(--line);
    color: var(--text);
}

.button-danger {
    background: var(--danger);
    color: #fff;
}

.button-danger:hover {
    background: var(--danger-dark);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--surface-strong);
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--focus-border);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.88;
}

.auth-shell .site-main,
.public-home .site-main,
.public-page .site-main,
.public-chat .site-main {
    display: flex;
    flex-direction: column;
}

.auth-card {
    width: min(480px, 100%);
    margin: 3rem auto;
    padding: 2rem;
}

.auth-form,
.note-form {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    color: var(--muted);
    min-width: 0;
}

.checkbox-field input {
    width: auto;
}

.checkbox-field.compact {
    white-space: normal;
}

.validation-summary,
.field-validation,
.form-error {
    color: var(--danger);
    font-size: 0.92rem;
}

.flash-message,
.alert,
.privacy-banner {
    border-radius: var(--radius-sm);
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
    overflow-wrap: anywhere;
}

.flash-message {
    margin-top: 1rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--flash-success-bg);
    color: var(--success);
    border-color: var(--flash-success-line);
}

.flash-error {
    background: var(--flash-error-bg);
    color: var(--danger);
    border-color: var(--flash-error-line);
}

.flash-info,
.alert {
    background: var(--alert-bg);
    color: var(--warning);
    border: 1px solid var(--alert-line);
}

.privacy-banner {
    background: var(--privacy-bg);
    color: var(--privacy-text);
    border: 1px solid var(--privacy-line);
}

.is-hidden {
    display: none !important;
}

.content-card {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem;
    line-height: 1.75;
}

.chat-card {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-width: 0;
}

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

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    min-width: 180px;
    max-width: 100%;
}

.connection-status {
    font-size: 0.88rem;
    color: var(--muted);
    max-width: 26ch;
    text-align: right;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

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

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

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

.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    height: clamp(320px, 58vh, 700px);
    min-height: 320px;
    overflow-y: auto;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--thread-surface);
    border: 1px solid var(--thread-line);
    min-width: 0;
    overscroll-behavior: contain;
}

.chat-message {
    display: flex;
    min-width: 0;
}

.chat-message-outgoing {
    justify-content: flex-end;
}

.chat-message-system {
    justify-content: center;
}

.chat-bubble {
    max-width: min(78%, 720px);
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: var(--incoming-bubble-surface);
    border: 1px solid var(--bubble-line);
    min-width: 0;
}

.chat-message-outgoing .chat-bubble {
    background: var(--outgoing-bubble-surface);
    color: var(--outgoing-bubble-text);
    border-color: transparent;
}

.chat-message-system .chat-bubble {
    background: var(--system-bubble-surface);
    color: var(--muted);
}

.chat-message-body {
    white-space: pre-wrap;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.chat-message-time {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.82rem;
    opacity: 0.75;
}

.chat-composer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    min-width: 0;
}

.chat-composer.is-disabled {
    opacity: 0.8;
}

.chat-composer-closed {
    display: grid;
    gap: 1rem;
}

.chat-composer textarea {
    min-height: 132px;
    max-width: 100%;
}

.emoji-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.emoji-toolbar-label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.emoji-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--emoji-line);
    background: var(--emoji-surface);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.emoji-button:hover {
    transform: translateY(-1px);
    border-color: var(--nav-item-hover-border);
    background: var(--emoji-hover-surface);
}

.emoji-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.chat-composer-actions {
    margin-top: 0.8rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.chat-composer-actions > * {
    min-width: 0;
}

.chat-secondary-actions {
    margin-top: 1rem;
    flex-wrap: wrap;
}

.chat-secondary-actions form,
.stacked-actions form {
    width: 100%;
}

.admin-shell {
    min-height: 100vh;
}

.admin-app {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    padding: 1.5rem;
    border-right: 1px solid var(--line);
    background: var(--sidebar-surface);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.admin-sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 1rem;
}

.admin-content-shell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    padding: 1.5rem 2rem 0;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.admin-topbar > * {
    min-width: 0;
}

.admin-main {
    padding: 0 2rem 2rem;
}

.admin-section,
.admin-detail-grid {
    display: grid;
    gap: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-card {
    padding: 1.2rem;
    border-radius: var(--radius-md);
    min-width: 0;
}

.summary-label {
    display: block;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.summary-card strong {
    font-size: 1.8rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    align-items: stretch;
    padding: 1.2rem;
    border-radius: var(--radius-md);
    background: var(--filter-surface);
    border: 1px solid var(--line);
}

.filter-bar > * {
    min-width: 0;
}

.filter-bar input {
    flex: 1 1 260px;
}

.filter-bar select {
    flex: 0 1 190px;
    width: auto;
    min-width: 170px;
}

.filter-bar .checkbox-field {
    flex: 0 1 auto;
    align-self: stretch;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--surface-strong);
}

.filter-bar .button {
    flex: 0 0 auto;
    width: auto;
}

.conversation-card-list {
    display: grid;
    gap: 1rem;
}

.conversation-card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    transition: transform 160ms ease, border-color 160ms ease;
    min-width: 0;
}

.conversation-card:hover {
    transform: translateY(-2px);
    border-color: var(--card-hover-border);
}

.conversation-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.conversation-card-header h2 {
    margin: 0.25rem 0 0;
    font-size: 1.2rem;
    overflow-wrap: anywhere;
}

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

.conversation-preview {
    color: var(--muted);
    margin: 0.85rem 0;
    overflow-wrap: anywhere;
}

.conversation-reference {
    margin: 0.35rem 0 0;
    overflow-wrap: anywhere;
}

.conversation-card-meta {
    justify-content: space-between;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.95rem;
}

.unread-badge {
    color: var(--info);
    font-weight: 700;
}

.empty-state {
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
}

.admin-detail-grid {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    align-items: start;
}

.detail-sidebar {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.detail-main {
    min-width: 0;
}

.detail-panel {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    min-width: 0;
}

.detail-panel h2,
.detail-panel h3 {
    margin-top: 0;
    overflow-wrap: anywhere;
}

.detail-meta-list {
    display: grid;
    gap: 0.85rem;
}

.detail-meta-list div {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line-soft);
}

.detail-meta-list div span,
.detail-meta-list div strong {
    overflow-wrap: anywhere;
}

.detail-meta-list div strong {
    max-width: 100%;
    text-align: right;
}

.detail-meta-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.stacked-actions {
    display: grid;
}

.admin-chat-card {
    min-width: 0;
}

.admin-thread {
    height: clamp(360px, 64vh, 760px);
}

.small-text,
.small-label {
    font-size: 0.85rem;
}

.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;
}

.flash-message.is-hidden {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

@media (max-width: 960px) {
    .admin-app {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .admin-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .site-header-inner,
    .site-footer-inner,
    .chat-card-header,
    .conversation-card-header,
    .chat-composer-actions,
    .conversation-card-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav {
        width: 100%;
        justify-content: flex-start;
    }

    .site-header-actions,
    .admin-topbar,
    .admin-topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .site-header-actions,
    .admin-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav a,
    .admin-nav a {
        width: 100%;
    }

    .theme-toggle {
        width: 100%;
    }

    .hero-card,
    .content-card,
    .auth-card,
    .chat-card,
    .detail-panel {
        padding: 1.25rem;
    }

    .site-main,
    .admin-main {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .filter-bar {
        align-items: stretch;
    }

    .access-gate-fields {
        grid-template-columns: 1fr;
    }

    .filter-bar > * {
        width: 100%;
        flex-basis: 100%;
    }

    .filter-bar select,
    .filter-bar .button {
        width: 100%;
    }

    .connection-status,
    .detail-meta-list div strong {
        text-align: left;
    }
}
