:root {
    --bg: #110f0d;
    --bg-elevated: #161310;
    --surface: #1a1714;
    --surface-2: #211d19;
    --surface-3: #29231e;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #f0ebe5;
    --text-muted: rgba(240, 235, 229, 0.58);
    --text-dim: rgba(240, 235, 229, 0.28);
    --accent: oklch(62% 0.14 44);
    --accent-soft: oklch(62% 0.14 44 / 0.15);
    --accent-strong: oklch(66% 0.14 44);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.14);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.14);
    --warning: #f59e0b;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 240px;
    --topbar-height: 56px;
}

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

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: "Inter", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(196, 117, 24, 0.14), transparent 28%),
        radial-gradient(circle at bottom left, rgba(196, 117, 24, 0.08), transparent 24%),
        linear-gradient(180deg, #120f0c 0%, #0f0d0b 100%);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

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

button {
    border: 0;
    background: none;
    color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

::selection {
    background: rgba(212, 125, 36, 0.28);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.hidden {
    display: none !important;
}

.mono {
    font-family: "DM Mono", monospace;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    height: 100dvh;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(32px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
}

.auth-card {
    width: min(100%, 396px);
    background: linear-gradient(180deg, rgba(32, 28, 24, 0.92), rgba(22, 19, 16, 0.96));
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.brand-lockup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 125, 36, 0.18), rgba(212, 125, 36, 0.04));
    color: var(--accent);
}

.brand-title {
    font-family: "DM Mono", monospace;
    font-size: 24px;
    letter-spacing: 0.06em;
}

.brand-subtitle {
    font-size: 13px;
    color: var(--text-dim);
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.auth-tab {
    border-radius: 6px;
    padding: 10px 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.18s ease;
}

.auth-tab.active {
    background: var(--surface);
    color: var(--text);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.input,
.select,
.textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(9, 8, 7, 0.45);
    color: var(--text);
    padding: 11px 12px;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.textarea {
    resize: vertical;
    min-height: 94px;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-dim);
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--accent);
    background: rgba(9, 8, 7, 0.68);
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: 0.16s ease;
    font-size: 13px;
    font-weight: 500;
}

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

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

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

.btn-outline:hover {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface-2);
}

.btn-ghost {
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
}

.btn-danger {
    background: var(--danger-soft);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-small {
    padding: 8px 11px;
    font-size: 12px;
    border-radius: 7px;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.auth-note,
.inline-note {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-dim);
}

.error-text {
    color: #f87171;
    font-size: 12px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    background: rgba(22, 19, 16, 0.92);
    border-right: 1px solid var(--border);
    min-width: 0;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar-top {
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-top .brand-title {
    font-size: 16px;
}

.sidebar-nav {
    padding: 10px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-item:hover:not(.active) {
    color: var(--text);
    background: var(--surface-2);
}

.sidebar-section-title {
    padding: 12px 18px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.topic-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 10px;
}

.topic-row {
    width: 100%;
    display: flex;
    align-items: center;
    border-left: 2px solid transparent;
    color: var(--text-muted);
}

.topic-row:hover:not(.active) {
    background: var(--surface-2);
}

.topic-row.active {
    background: var(--accent-soft);
    color: var(--text);
    border-left-color: var(--accent);
}

.topic-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px 10px 10px;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.topic-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.topic-unsubscribe {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-right: 4px;
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
}

.topic-unsubscribe:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.topic-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.topic-quick-actions {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
}

.main-shell {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    background: rgba(22, 19, 16, 0.88);
}

.topbar-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.topbar-title strong {
    font-size: 15px;
    font-weight: 600;
}

.topbar-title span {
    font-size: 12px;
    color: var(--text-dim);
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mobile-topbar-controls {
    display: none;
}

.mobile-nav-toggle {
    display: none;
    align-self: flex-start;
    gap: 8px;
}

.mobile-nav-row,
.mobile-topic-strip {
    display: flex;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
}

.mobile-nav-row .btn.active,
.mobile-topic-pill.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.mobile-topic-pill {
    flex: 0 0 auto;
    max-width: 190px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text-muted);
    background: rgba(9, 8, 7, 0.28);
    font-size: 12px;
}

.mobile-topic-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-empty-text {
    color: var(--text-dim);
    font-size: 12px;
    padding: 8px 0;
}

.topbar-lookup-form {
    width: min(100%, 320px);
}

.topbar-lookup-form .input {
    min-width: 0;
}

.topbar-user {
    font-size: 12px;
    color: var(--text-muted);
}

.content-shell {
    min-height: 0;
    flex: 1;
    padding: 22px;
    overflow: hidden;
}

.workspace-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    min-height: 0;
}

.workspace-stack > .topics-layout {
    flex: 1;
    min-height: 0;
}

.notice-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    color: var(--text);
}

.notice-banner .notice-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.notice-banner .notice-body strong {
    font-size: 13px;
    font-weight: 600;
}

.notice-banner .notice-body span {
    font-size: 12px;
    color: var(--text-muted);
}

.topics-layout {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 18px;
    min-height: 0;
}

.topics-layout > * {
    min-height: 0;
}

.topics-layout-single {
    grid-template-columns: 1fr;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
}

.panel {
    background: rgba(26, 23, 20, 0.88);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    min-height: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.panel-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.panel-title {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.panel-title h2,
.panel-title h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-title p {
    font-size: 12px;
    color: var(--text-dim);
}

.panel-body {
    padding: 18px;
}

.panel-note {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.panel-scroll {
    overflow-y: auto;
    min-height: 0;
}

.rail-tabbar,
.mobile-view-switch {
    display: none;
    gap: 6px;
    padding: 6px;
    background: rgba(26, 23, 20, 0.88);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.rail-tab,
.mobile-view-tab {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.rail-tab.is-active,
.mobile-view-tab.is-active {
    background: var(--bg-elevated, rgba(255, 255, 255, 0.06));
    color: var(--text);
}

.message-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.composer {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.composer[data-composer-open="false"] {
    display: none;
}

.composer-title-input {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 38px;
    box-sizing: border-box;
}

.composer-body-input {
    min-height: 52px;
    padding: 8px 12px;
    font-size: 13px;
}

.composer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 140px 90px;
    gap: 6px;
    align-items: stretch;
}

.composer-row .input,
.composer-row .select {
    padding: 8px 12px;
    font-size: 13px;
    box-sizing: border-box;
    height: 100%;
    min-height: 38px;
}

.composer-row .select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    width: 100%;
}

.composer-row .select-wrap {
    position: relative;
    display: flex;
}

.composer-row .select-wrap svg {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

.composer-row .btn {
    padding: 8px 14px;
    font-size: 13px;
    box-sizing: border-box;
    height: 100%;
    min-height: 38px;
}

.message-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.message-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

.message-item:last-child {
    border-bottom: 0;
}

.message-priority {
    width: 3px;
    border-radius: 999px;
    flex-shrink: 0;
}

.priority-low {
    background: rgba(255, 255, 255, 0.12);
}

.priority-default {
    background: var(--accent);
}

.priority-urgent {
    background: var(--danger);
}

.message-copy {
    flex: 1;
    min-width: 0;
}

.message-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.message-body {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
    word-break: break-word;
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-dim);
}

.message-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    white-space: nowrap;
}

.badge-open {
    background: var(--success-soft);
    color: #4ade80;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.badge-danger {
    background: var(--danger-soft);
    color: #f87171;
}

.badge-off {
    background: var(--surface-2);
    color: var(--text-dim);
}

.badge-muted {
    background: var(--surface-3);
    color: var(--text-muted);
    padding: 4px 6px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

.stat-card strong {
    display: block;
    font-size: 20px;
    margin-bottom: 4px;
}

.stat-card span {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    font-size: 12px;
}

.detail-row dt {
    color: var(--text-dim);
}

.detail-row dd {
    text-align: right;
    color: var(--text-muted);
}

.empty-panel {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-dim);
    text-align: center;
    padding: 28px;
}

.empty-panel p {
    max-width: 300px;
    font-size: 13px;
    line-height: 1.6;
}

.account-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: 100%;
    min-height: 0;
    max-width: 680px;
    overflow-y: auto;
}

.token-list {
    display: flex;
    flex-direction: column;
}

.token-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.token-row > div:first-child {
    min-width: 0;
}

.webhook-row {
    align-items: stretch;
}

.token-row:last-child {
    border-bottom: 0;
}

.row-actions {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.token-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-word;
}

.token-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.token-copy {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-word;
}

.token-created-value {
    display: flex;
    gap: 8px;
    align-items: center;
}

.token-created-value input {
    flex: 1;
    font-size: 12px;
}

.token-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    color: var(--text-dim);
    font-size: 11px;
}

.token-session-label {
    display: inline-flex;
    align-items: center;
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    padding: 8px 0;
}

.token-callout {
    margin-top: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 14px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}

.webhook-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form .input {
    flex: 1;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 100;
}

dialog.app-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 24px;
    border: 0;
    background: transparent;
    color: inherit;
    overflow: visible;
}

dialog.app-modal[open] {
    display: grid;
    place-items: center;
}

dialog.app-modal::backdrop {
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
}

.modal {
    width: min(100%, 420px);
    background: linear-gradient(180deg, rgba(32, 28, 24, 0.96), rgba(18, 16, 13, 0.98));
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-header,
.modal-footer {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    border-bottom: 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.modal-header p {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.55;
}

.modal-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 120;
    border-radius: 999px;
    padding: 10px 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    font-size: 13px;
}

.toast-default {
    background: var(--surface);
    color: var(--text);
}

.toast-success {
    background: #14532d;
    color: #86efac;
}

.toast-error {
    background: #7f1d1d;
    color: #fca5a5;
}

@media (max-width: 1080px) {
    .topics-layout {
        grid-template-columns: 1fr;
    }

    .content-shell {
        overflow-y: auto;
    }

    .panel {
        min-height: auto;
    }

    .mobile-view-switch,
    .rail-tabbar {
        display: flex;
    }

    .topics-layout[data-mobile-view="messages"] .topic-rail,
    .topics-layout[data-mobile-view="manage"] .message-layout {
        display: none;
    }

    .topic-rail[data-active-tab="stats"] > .rail-panel:not([data-rail-panel="stats"]),
    .topic-rail[data-active-tab="shares"] > .rail-panel:not([data-rail-panel="shares"]),
    .topic-rail[data-active-tab="webhooks"] > .rail-panel:not([data-rail-panel="webhooks"]) {
        display: none;
    }
}

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

    .sidebar {
        display: none;
    }

    .composer-row {
        grid-template-columns: 1fr;
    }

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

    .row-actions,
    .token-created-value,
    .webhook-form-grid {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .topbar {
        height: auto;
        padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
        gap: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        display: none;
    }

    .mobile-topbar-controls {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
        min-width: 0;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .mobile-topbar-controls[data-nav-open="false"] .mobile-nav-row {
        display: none;
    }

    .message-layout > .panel-header .panel-title {
        display: none;
    }

    .content-shell {
        padding: 14px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        overflow-y: auto;
    }

    .topics-layout {
        height: auto;
        min-height: 100%;
    }

    .message-layout {
        min-height: 520px;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-header .topbar-actions {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
    }

    .topbar-lookup-form {
        width: 100%;
    }

    .modal-overlay,
    dialog.app-modal[open] {
        align-items: end;
        place-items: end stretch;
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .modal {
        width: 100%;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }
}
