:root {
    color-scheme: light;
    --bg: #f3efe6;
    --ink: #1d1a16;
    --muted: #6d645b;
    --line: #e2d8cb;
    --paper: #fffdf9;
    --green: #1f6b4a;
    --green-dark: #174e37;
    --danger: #8d2d2d;
    --shadow: 0 16px 40px rgba(60, 42, 20, 0.08);
    font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
}

a { color: var(--green-dark); }

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

button,
.button-quiet {
    border: 0;
    border-radius: 999px;
    background: var(--green);
    color: white;
    padding: 0.75rem 1.1rem;
    cursor: pointer;
}

.button-quiet {
    background: transparent;
    color: var(--green-dark);
}

button:hover { background: var(--green-dark); }
.button-quiet:hover { background: rgba(31, 107, 74, 0.08); }

label { display: grid; gap: 0.35rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    background: white;
}

textarea { resize: vertical; }

.card-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.panel {
    width: min(440px, 100%);
    background: var(--paper);
    border-radius: 24px;
    padding: 1.6rem;
    box-shadow: var(--shadow);
}

.panel h1,
.admin-page h1 { margin: 0 0 0.4rem; font-size: 1.7rem; }
.lead,
.hint,
.who { color: var(--muted); }
.lead { margin-top: 0; }
.switch { margin-bottom: 0; }
form { display: grid; gap: 0.9rem; }
.stack { max-width: 520px; }

.alert {
    width: min(960px, calc(100% - 2rem));
    margin: 1rem auto 0;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: #fff4d8;
}

.card-page .alert { width: min(440px, 100%); margin: 0 0 1rem; }
.alert.is-error { background: #fde8e4; color: var(--danger); }
.alert.is-ok { background: #e5f4ec; color: var(--green-dark); }
.hint.is-good { color: var(--green-dark); }
.hint.is-bad { color: var(--danger); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.topnav { display: flex; gap: 0.9rem; margin-left: auto; }
.topnav a { text-decoration: none; }
.who { margin: 0; }

.directory,
.thread {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 1rem;
}

.people { display: grid; gap: 0.6rem; }
.person { margin: 0; }
.person-button,
.thread-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-align: left;
    background: var(--paper);
    color: var(--ink);
    border-radius: 18px;
    padding: 0.8rem;
}

.person-button:hover { background: #f7f3ec; }
.person-text { display: grid; min-width: 0; }
.person-name { font-weight: 700; }
.person-preview {
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    display: grid;
    place-items: center;
    background: #e7f3ec;
    color: var(--green-dark);
    font-weight: 700;
    flex: 0 0 auto;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.presence {
    width: 10px;
    height: 10px;
    margin-left: auto;
    border-radius: 50%;
    background: #c8c0b6;
}

.presence.is-online { background: #2f9e63; }

.thread { display: grid; grid-template-rows: auto 1fr auto; min-height: calc(100vh - 74px); }
.thread-head { margin-bottom: 0.8rem; }
.thread-head h1 { margin: 0; font-size: 1.15rem; }
.thread-head .hint { margin: 0; }
.back { text-decoration: none; }

.messages {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding-bottom: 1rem;
}

.message {
    max-width: min(80%, 460px);
    background: var(--paper);
    border-radius: 16px;
    padding: 0.7rem 0.85rem;
}

.message.is-mine { margin-left: auto; background: #e7f3ec; }
.message-sender,
.message-meta { margin: 0; color: var(--muted); font-size: 0.82rem; }
.message-body { margin: 0.2rem 0; white-space: pre-wrap; }
.message-image,
.message-video,
.thumb { max-width: 100%; border-radius: 12px; }
.thumb { width: 72px; height: 72px; object-fit: cover; display: block; }
.edit-box { margin-top: 0.4rem; }
.composer { grid-template-columns: auto 1fr auto; align-items: end; }
.file-button { position: relative; font-weight: 500; }
.file-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.file-button span {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--line);
}

.admin-page { width: min(1100px, calc(100% - 2rem)); margin: 1rem auto 2rem; }
.filters { display: flex; gap: 0.8rem; align-items: end; margin: 1rem 0; }
.filters label { min-width: 180px; }
.grid { width: 100%; border-collapse: collapse; background: var(--paper); }
.grid th,
.grid td { padding: 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.actions { display: grid; gap: 0.4rem; }
.actions form,
.people-inline { display: flex; gap: 0.4rem; align-items: center; }
.pill {
    display: inline-block;
    margin: 0 0.3rem 0.3rem 0;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #e7f3ec;
}
.notice,
.empty { color: var(--muted); }
.moderation { margin-top: 1rem; }
.stack-form { display: grid; gap: 0.8rem; max-width: 640px; }
.inline-role { display: flex; gap: 0.4rem; align-items: center; }
.inline-role select { width: auto; }
.entrance-preview {
    width: min(100%, 360px);
    border-radius: 16px;
    display: block;
}

@media (max-width: 720px) {
    .topbar { align-items: flex-start; flex-wrap: wrap; }
    .composer { grid-template-columns: 1fr; }
    .filters { flex-direction: column; align-items: stretch; }
    .grid { display: block; overflow-x: auto; }
}

.chat-app {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f5f2eb;
    color: #1e293b;
    font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

.chat-app button {
    background: transparent;
    color: inherit;
    border-radius: 12px;
    padding: 0;
}

.chat-app button:hover { background: transparent; }
.chat-app form { display: block; margin: 0; }
.chat-app label { display: block; font-weight: 500; }
.chat-app input,
.chat-app textarea {
    width: 100%;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.appbar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(231, 224, 213, 0.9);
    backdrop-filter: blur(10px);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #0f172a;
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #0d4e2d;
    color: white;
    box-shadow: 0 4px 10px rgba(9, 58, 33, 0.18);
}

.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; }
.brand-dot { width: 3px; height: 3px; border-radius: 50%; background: #94a3b8; }
.brand-user {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appbar-actions { display: flex; align-items: center; gap: 0.55rem; }
.quiet-link {
    text-decoration: none;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-radius: 10px;
}

.quiet-link:hover,
.quiet-link.is-current { background: #f3efe8; }
.leave {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    color: #e11d48;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    padding: 0.4rem 0.75rem;
}

.leave:hover { background: #ffe4e6; }

.shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-app .alert {
    width: auto;
    margin: 0.6rem 1rem 0;
}

.chat-app .alert[hidden] { display: none; }

.workspace {
    flex: 1;
    min-height: 0;
    display: flex;
}

.rail {
    width: 320px;
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    background: #fbf9f6;
    border-right: 1px solid #e7e0d5;
    min-height: 0;
}

.me {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid rgba(231, 224, 213, 0.8);
}

.me.is-current { background: #fff; }
.me strong,
.me small,
.me-edit { display: block; }
.me strong { font-size: 0.92rem; }
.me small { color: #059669; font-size: 0.75rem; font-weight: 600; }
.me-avatar { color: inherit; text-decoration: none; border-radius: 16px; }
.me-avatar:hover .avatar,
.me-avatar:focus-visible .avatar { outline: 2px solid #13623b; outline-offset: 2px; }
.me-edit {
    margin-top: 0.15rem;
    color: #13623b;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
}
.me-edit:hover { text-decoration: underline; }

.avatar-wrap { position: relative; flex: 0 0 auto; }
.chat-app .avatar {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    background: #dbf2e4;
    color: #0d4e2d;
    border: 1px solid #c9ead6;
    font-size: 0.9rem;
}

.chat-app .presence {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    margin: 0;
    border: 2px solid #fbf9f6;
    background: #cbd5e1;
}

.chat-app .presence.is-online { background: #10b981; }

.search { padding: 0.85rem 0.85rem 0.35rem; }
.search input {
    width: 100%;
    border: 1px solid #e7e0d5;
    border-radius: 14px;
    background: white;
    padding: 0.55rem 0.8rem;
    font-size: 0.78rem;
    box-shadow: 0 1px 2px rgba(30, 27, 24, 0.04);
}

.search input:focus {
    outline: 2px solid rgba(19, 98, 59, 0.25);
    border-color: #13623b;
}

.chat-app .people {
    flex: 1;
    overflow: auto;
    align-content: start;
    padding: 0.45rem;
    gap: 0.2rem;
}

.chat-app .person { position: relative; }
.chat-app .person-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    background: transparent;
    color: inherit;
    border-radius: 16px;
    padding: 0.7rem;
}

.chat-app .person-button:hover { background: rgba(255, 255, 255, 0.8); }
.chat-app .person.is-active .person-button {
    background: white;
    box-shadow: 0 1px 3px rgba(30, 27, 24, 0.06);
    outline: 1px solid rgba(19, 98, 59, 0.28);
}

.chat-app .person.is-active::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 99px;
    background: #13623b;
}

.person-line { display: flex; justify-content: space-between; gap: 0.5rem; }
.person-time { color: #13623b; font-size: 0.7rem; font-weight: 700; }
.chat-app .person-name { font-size: 0.9rem; }
.chat-app .person-preview { font-size: 0.75rem; }

.stage,
.chat-app .thread {
    width: auto;
    margin: 0;
    padding: 0;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f2eb;
}

.stage-empty {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.stage-empty h1 { margin: 0 0 0.4rem; font-size: 1.35rem; }
.stage-empty p { margin: 0; color: #64748b; }

.thread-head {
    height: 64px;
    margin: 0;
    padding: 0 1.1rem;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid #e7e0d5;
    box-shadow: none;
}

.thread-head h1 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.98rem;
}

.thread-head .hint { margin: 0.1rem 0 0; font-size: 0.75rem; color: #059669; }
.back {
    display: none;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.65rem;
    font-weight: 700;
}

.chat-app .messages {
    flex: 1;
    gap: 0.85rem;
    padding: 1.25rem 1.4rem;
}

.day-chip {
    align-self: center;
    margin: 0;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(231, 224, 213, 0.85);
    color: #57534e;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.chat-app .message {
    max-width: min(78%, 520px);
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.chat-app .message.is-mine { margin-left: auto; flex-direction: row-reverse; }
.bubble-column { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.chat-app .message.is-mine .bubble-column { align-items: flex-end; }

.bubble-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    object-fit: cover;
    background: #dbf2e4;
    color: #0d4e2d;
    border: 1px solid #c9ead6;
    font-size: 0.72rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.bubble {
    background: white;
    border: 1px solid rgba(231, 224, 213, 0.9);
    border-radius: 18px;
    border-top-left-radius: 6px;
    padding: 0.65rem 0.9rem;
    box-shadow: 0 1px 2px rgba(30, 27, 24, 0.04);
}

.chat-app .message.is-mine .bubble {
    background: #0d4e2d;
    color: white;
    border-color: #0d4e2d;
    border-top-left-radius: 18px;
    border-top-right-radius: 6px;
}

.chat-app .message-sender,
.chat-app .message-meta { font-size: 0.72rem; }
.chat-app .message.is-mine .message-meta { color: #c7ead8; text-align: right; }
.chat-app .read-state { margin-left: 0.35rem; }
.chat-app .message.is-mine .read-state.is-read { color: #ecfdf5; font-weight: 700; }
.chat-app .message.is-theirs .message-sender { color: #334155; font-weight: 700; }
.chat-app .message.is-theirs .message-sender time { color: #94a3b8; font-weight: 500; margin-left: 0.3rem; }
.chat-app .message-body { font-size: 0.92rem; line-height: 1.45; }
.chat-app .message.is-deleted .message-body { font-style: italic; opacity: 0.75; }

.tools {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.3rem;
}

.chat-app .message.is-mine .tools { opacity: 1; }

.tools summary,
.tools button {
    border: 0;
    background: white;
    color: #334155;
    border-radius: 8px;
    padding: 0.2rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(30, 27, 24, 0.08);
}

.tools form[data-live="delete"] button { color: #e11d48; }
.tools summary { list-style: none; }
.tools summary::-webkit-details-marker { display: none; }
.edit-box { position: relative; }
.edit-box form {
    position: absolute;
    right: 0;
    z-index: 3;
    width: 240px;
    display: grid;
    gap: 0.4rem;
    padding: 0.55rem;
    background: white;
    border: 1px solid #e7e0d5;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(30, 27, 24, 0.12);
}

.edit-box textarea {
    border: 1px solid #e7e0d5;
    border-radius: 8px;
    padding: 0.45rem;
    background: white;
    color: #1e293b;
}

.edit-box button {
    background: #0d4e2d;
    color: white;
}

.composer-bar {
    padding: 0.85rem 1rem 0.7rem;
    background: rgba(255, 255, 255, 0.86);
    border-top: 1px solid rgba(231, 224, 213, 0.95);
}

.chat-app .composer {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    padding: 0.4rem;
    background: white;
    border: 1px solid #e7e0d5;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(30, 27, 24, 0.04);
}

.chat-app .composer:focus-within {
    border-color: #13623b;
    box-shadow: 0 0 0 3px rgba(19, 98, 59, 0.12);
}

.chat-app .file-button span {
    display: inline-flex;
    align-items: center;
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    background: #f3efe8;
    border: 1px solid #e7e0d5;
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
}

.chat-app .composer textarea {
    min-height: 38px;
    max-height: 128px;
    padding: 0.55rem 0.2rem;
    resize: none;
    font-size: 0.92rem;
}

.chat-app .composer button[type="submit"] {
    background: #0d4e2d;
    color: white;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.chat-app .composer button[type="submit"]:hover { background: #093a21; }
.composer-note { text-align: center; font-size: 0.7rem; margin: 0.45rem 0 0; }

.tool-link,
.chat-app .tool-link {
    display: inline-flex;
    align-items: center;
    background: white;
    color: #334155;
    border-radius: 8px;
    padding: 0.2rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(30, 27, 24, 0.08);
}

.reply-quote {
    display: grid;
    gap: 0.05rem;
    width: 100%;
    margin: 0 0 0.45rem;
    padding: 0.35rem 0.55rem;
    border-left: 3px solid #0d4e2d;
    border-radius: 8px;
    background: #f3faf6;
    color: #14532d;
    text-align: left;
    text-decoration: none;
}

.reply-quote strong { font-size: 0.72rem; }
.reply-quote span {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.chat-app .message.is-mine .reply-quote {
    border-left-color: #b7e4c7;
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

.chat-app .message.is-target .bubble {
    outline: 2px solid #86efac;
    outline-offset: 2px;
}

.reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.28rem;
}

.reactions form { margin: 0; }

.chat-app .reactions button,
.reaction-pill {
    border: 1px solid #e7e0d5;
    background: white;
    color: #1e293b;
    border-radius: 999px;
    padding: 0.08rem 0.45rem;
    font-size: 0.78rem;
    line-height: 1.4;
    cursor: pointer;
}

.chat-app .reactions button.is-mine,
.reaction-pill.is-mine {
    border-color: #0d4e2d;
    background: #e7f6ee;
}

.react-box { position: relative; }

.react-box .react-picker {
    position: absolute;
    z-index: 4;
    left: 0;
    top: calc(100% + 0.25rem);
}

.chat-app .message.is-mine .react-box .react-picker { left: auto; right: 0; }

.react-picker {
    display: flex;
    gap: 0.1rem;
    padding: 0.25rem;
    background: white;
    border: 1px solid #e7e0d5;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(30, 27, 24, 0.12);
}

.chat-app .react-picker button {
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 0.15rem 0.28rem;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

.chat-app .react-picker button:hover { background: #f3faf6; }

.reply-draft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.45rem;
    padding: 0.45rem 0.7rem;
    border-left: 3px solid #0d4e2d;
    border-radius: 12px;
    background: white;
}

.reply-draft[hidden] { display: none; }
.reply-draft strong { display: block; color: #0d4e2d; font-size: 0.75rem; }
.reply-draft span { display: block; color: #57534e; font-size: 0.78rem; }
.reply-draft a { color: #78716c; font-size: 0.75rem; font-weight: 700; text-decoration: none; }

.typing {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.45rem;
    color: #78716c;
    font-size: 0.78rem;
    font-weight: 600;
}

.typing[hidden] { display: none; }

.typing-dots {
    display: inline-flex;
    align-items: flex-end;
    gap: 0.18rem;
    height: 0.7rem;
}

.typing-dots span {
    width: 0.32rem;
    height: 0.32rem;
    border-radius: 50%;
    background: #0d4e2d;
    animation: typing-bounce 1.05s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
    0%, 70%, 100% { transform: translateY(0); opacity: 0.35; }
    35% { transform: translateY(-0.28rem); opacity: 1; }
}

.dossier {
    width: 280px;
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: white;
    border-left: 1px solid #e7e0d5;
    padding: 1.2rem 1rem;
    overflow: auto;
}

.dossier-id { text-align: center; padding-bottom: 1rem; border-bottom: 1px solid #f3efe8; }
.dossier-id h2 { margin: 0.7rem 0 0.15rem; font-size: 1rem; }
.dossier-id p { margin: 0; color: #64748b; font-size: 0.75rem; word-break: break-word; }
.avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    margin: 0 auto;
    font-size: 1.3rem;
}

.dossier h3 {
    margin: 0.9rem 0 0.55rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #334155;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
}

.file-row:hover { background: #faf8f5; }
.file-row > span:first-child {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.62rem;
    font-weight: 800;
}

.file-row strong,
.file-row small { display: block; }
.file-row strong {
    font-size: 0.75rem;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-row small { color: #94a3b8; font-size: 0.68rem; }
.dossier-rules p { margin: 0 0 0.45rem; color: #64748b; font-size: 0.75rem; }

.identity {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background:
        radial-gradient(900px 280px at 10% -10%, rgba(27, 77, 62, 0.08), transparent 60%),
        #f4f1ea;
}

.identity [hidden] { display: none !important; }

.identity-wrap {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.25rem 0 2.5rem;
}

.identity-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.identity-crumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.35rem;
    color: #78716c;
    font-size: 0.72rem;
    font-weight: 600;
}

.identity-crumb a { color: inherit; text-decoration: none; }
.identity-crumb a:hover { color: #1b4d3e; }
.identity-crumb svg { width: 12px; height: 12px; }
.identity-crumb span:last-child { color: #1b4d3e; }

.identity-head h1 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
    color: #1c1917;
}

.identity-head .lead {
    max-width: 62ch;
    margin: 0.35rem 0 0;
    color: #57534e;
    font-size: 0.88rem;
}

.identity-actions { display: flex; gap: 0.5rem; flex: 0 0 auto; }

.identity-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 1.25rem;
    align-items: start;
}

.identity-card {
    background: white;
    border: 1px solid #e3dfd5;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 20px rgba(22, 62, 50, 0.04);
    padding: 1.25rem;
}

.identity-card + .identity-card { margin-top: 1rem; }

.identity-card h2 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.identity-kicker {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.identity-kicker p,
.identity-note,
.identity-help {
    margin: 0.2rem 0 0;
    color: #78716c;
    font-size: 0.75rem;
    line-height: 1.45;
}

.identity-pill {
    flex: 0 0 auto;
    border-radius: 999px;
    background: #f0f6f4;
    color: #1b4d3e;
    border: 1px solid #ddece7;
    padding: 0.15rem 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
}

.identity-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.85rem 0 0.2rem;
}

.identity-portrait {
    position: relative;
    width: 176px;
    height: 176px;
}

.identity-frame,
.identity-fallback {
    width: 176px;
    height: 176px;
    border-radius: 50%;
    object-fit: cover;
}

.identity-frame {
    display: block;
    box-shadow: 0 12px 28px -4px rgba(22, 62, 50, 0.18);
    outline: 4px solid rgba(27, 77, 62, 0.1);
    background: #e7f3ec;
}

.identity-fallback {
    display: grid;
    place-items: center;
    background: #dbf2e4;
    color: #0d4e2d;
    border: 1px solid #c9ead6;
    font-size: 3.4rem;
    font-weight: 700;
}

.identity-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(14, 40, 32, 0.62);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0;
    cursor: pointer;
}

.identity-portrait:hover .identity-overlay,
.identity-portrait:focus-within .identity-overlay { opacity: 1; }
.chat-app .identity-overlay:hover { background: rgba(14, 40, 32, 0.72); }
.identity-overlay svg { width: 28px; height: 28px; }

.identity-presence {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    background: #10b981;
}

.identity-choices,
.identity-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.chat-app .identity-choice,
.chat-app .identity-quiet,
.chat-app .identity-primary,
.chat-app .identity-danger,
.chat-app .identity-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.chat-app .identity-choice,
.chat-app .identity-quiet,
.chat-app .identity-tool {
    border: 1px solid #e7e0d5;
    background: #faf9f6;
    color: #44403c;
    padding: 0.65rem 0.75rem;
    font-size: 0.75rem;
}

.chat-app .identity-choice:hover,
.chat-app .identity-quiet:hover,
.chat-app .identity-tool:hover { background: #f3efe8; }

.chat-app .identity-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.chat-app .identity-primary {
    width: 100%;
    margin-top: 0.55rem;
    border: 0;
    background: #1b4d3e;
    color: white;
    padding: 0.72rem 1rem;
    font-size: 0.85rem;
}

.chat-app .identity-primary:hover { background: #163e32; }

.chat-app .identity-primary-inline {
    width: auto;
    margin-top: 0;
    padding: 0.55rem 0.9rem;
    font-size: 0.75rem;
}

.chat-app .identity-danger {
    width: 100%;
    margin-top: 0.35rem;
    border: 0;
    background: transparent;
    color: #be123c;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
}

.chat-app .identity-danger:hover { background: #fff1f2; }

.identity-choice svg,
.identity-quiet svg,
.identity-primary svg,
.identity-danger svg,
.identity-tool svg { width: 15px; height: 15px; flex: 0 0 auto; }

.identity-adjust {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e7e0d5;
}

.identity-adjust p {
    margin: 0 0 0.7rem;
    color: #78716c;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.identity-zoom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #57534e;
    font-size: 0.75rem;
    font-weight: 600;
}

.identity-zoom span:last-child {
    font-variant-numeric: tabular-nums;
    color: #78716c;
    font-size: 0.72rem;
}

.chat-app .identity-slider {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.35rem;
    color: #a8a29e;
    font-weight: 700;
}

.chat-app .identity-slider input {
    width: 100%;
    accent-color: #1b4d3e;
    cursor: pointer;
}

.identity-angle { margin-top: 0.15rem; }

.identity-callout {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.9rem;
    padding: 0.7rem 0.75rem;
    border-radius: 12px;
    background: #f0f6f4;
    border: 1px solid #ddece7;
    color: #1c1917;
    font-size: 0.72rem;
    line-height: 1.45;
}

.identity-callout svg { width: 16px; height: 16px; color: #1b4d3e; flex: 0 0 auto; margin-top: 0.1rem; }

.identity-status {
    min-height: 1.1rem;
    margin: 0.55rem 0 0;
    color: #9f1239;
    font-size: 0.75rem;
    font-weight: 600;
}

.identity-camera {
    margin-top: 0.85rem;
    padding: 0.7rem;
    border-radius: 16px;
    background: #111b21;
}

.identity-camera video {
    display: block;
    width: 100%;
    max-height: 240px;
    border-radius: 12px;
    background: black;
    transform: scaleX(-1);
    object-fit: cover;
}

.identity-camera-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.chat-app .identity-camera .identity-primary,
.chat-app .identity-camera .identity-quiet {
    width: auto;
    margin: 0;
}

.chat-app .identity-camera .identity-quiet {
    background: transparent;
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

.identity-facts { display: grid; gap: 0.75rem; margin: 0.9rem 0 0; }
.identity-facts div {
    display: grid;
    gap: 0.15rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #f3efe8;
}
.identity-facts dt {
    color: #78716c;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.identity-facts dd { margin: 0; font-size: 0.92rem; font-weight: 700; }
.identity-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.4rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: 1px;
}

.identity-previews { display: grid; gap: 0.7rem; margin-top: 0.85rem; }
.identity-preview {
    padding: 0.7rem;
    border-radius: 14px;
    border: 1px solid #e7e0d5;
}
.identity-preview b {
    display: block;
    margin-bottom: 0.45rem;
    color: #78716c;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.identity-preview-list { background: #f7f5f0; }
.identity-preview-chat { background: #efeae2; }
.identity-preview-panel { background: #faf9f6; }

.identity-row,
.identity-bubble-row,
.identity-panel-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: white;
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
}

.identity-mini,
.identity-mini-fallback {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    object-fit: cover;
    flex: 0 0 auto;
    background: #dbf2e4;
    color: #0d4e2d;
    font-weight: 700;
}

img.identity-mini { display: block; }
.identity-mini-fallback { display: grid; place-items: center; }

.identity-preview-chat .identity-mini,
.identity-preview-panel .identity-mini,
.identity-preview-chat .identity-mini-fallback,
.identity-preview-panel .identity-mini-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.75rem;
}

.identity-row strong,
.identity-panel-row strong { display: block; font-size: 0.85rem; }
.identity-row small,
.identity-panel-row small { color: #78716c; font-size: 0.72rem; }
.identity-bubble-row { align-items: flex-end; background: transparent; padding: 0; }
.identity-bubble {
    background: white;
    border-radius: 16px 16px 16px 5px;
    padding: 0.55rem 0.7rem;
    color: #1c1917;
    font-size: 0.78rem;
    line-height: 1.4;
}
.identity-bubble small {
    display: block;
    margin-top: 0.2rem;
    color: #78716c;
    font-size: 0.65rem;
    text-align: right;
}

.identity-password { display: grid; gap: 0.75rem; margin-top: 0.9rem; }
.chat-app .identity-password label {
    display: grid;
    gap: 0.3rem;
    color: #57534e;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.chat-app .identity-password input {
    width: 100%;
    border: 1px solid #e7e0d5;
    border-radius: 12px;
    background: #fff;
    padding: 0.7rem 0.8rem;
    font-size: 0.92rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}
.chat-app .identity-password input:focus {
    outline: none;
    border-color: #1b4d3e;
    box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.12);
}
.chat-app .identity-password .identity-primary { margin-top: 0.2rem; }

@media (max-width: 900px) {
    .identity-head,
    .identity-grid { display: block; }
    .identity-actions { margin-top: 0.9rem; }
    .identity-grid .identity-card { margin-top: 1rem; }
    .identity-choices,
    .identity-tools { grid-template-columns: 1fr; }
}

@media (hover: none) {
    .chat-app .message.is-mine .tools { opacity: 1; }
}

@media (max-width: 860px) {
    .dossier { display: none; }
}

@media (max-width: 800px) {
    .workspace:has(.thread) .rail { display: none; }
    .workspace:has(.thread) .back { display: inline-flex; }
    .rail { width: 100%; flex-basis: auto; }
    .brand-user,
    .brand-dot { display: none; }
}
