@font-face { font-family: "Ikra"; src: url("/fonts/ikra-slab.woff2") format("woff2"); font-display: swap; }

:root {
  --dark: #1e1a2e;
  --dark-2: #292339;
  --paper: #fffdfa;
  --cream: #f8f2e4;
  --warm: #f2e6c8;
  --gold: #c5a44d;
  --gold-dark: #8d681c;
  --ink: #312c2a;
  --muted: #756e69;
  --line: #e6ddcc;
  --green: #397f50;
  --danger: #b44d4b;
  --shadow: 0 22px 60px rgba(30, 26, 46, .13);
  --soft-shadow: 0 8px 24px rgba(45, 35, 25, .07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; overflow: hidden; background: var(--cream); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(197, 164, 77, .45); outline-offset: 2px; }
[hidden] { display: none !important; }

.chat-shell { height: 100svh; display: grid; grid-template-rows: 72px minmax(0, 1fr); }
.chat-topbar { z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: max(10px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 10px max(22px, env(safe-area-inset-left)); border-bottom: 1px solid rgba(213,184,94,.32); background: radial-gradient(circle at 14% -90%, rgba(213,184,94,.25), transparent 38%), linear-gradient(110deg, #171323, var(--dark) 58%, #292139); color: #fff; box-shadow: 0 7px 24px rgba(22,18,34,.14); }
.chat-brand { min-width: 0; display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.chat-brand img { width: 38px; height: 46px; object-fit: contain; }
.chat-brand span { min-width: 0; display: grid; }
.chat-brand strong { color: #d5b85e; font-family: Ikra, Georgia, serif; font-size: 1.25rem; font-weight: 500; letter-spacing: .045em; line-height: 1.05; }
.chat-brand small { overflow: hidden; color: #c9c1d6; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-topbar__actions { display: flex; align-items: center; gap: 8px; }
.top-action { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; background: rgba(255,255,255,.065); color: #f8f4ed; text-decoration: none; backdrop-filter: blur(12px); cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.top-action:hover { transform: translateY(-1px); border-color: rgba(213,184,94,.72); background: rgba(213,184,94,.13); }
.top-action svg { width: 20px; height: 20px; }
.user-button { min-width: 46px; padding-inline: 10px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(145deg, #e1c875, var(--gold)); color: var(--dark); box-shadow: inset 0 1px rgba(255,255,255,.45); font-size: .72rem; font-weight: 800; }

.chat-main { min-height: 0; display: grid; grid-template-columns: minmax(290px, 360px) minmax(0, 1fr); gap: 1px; background: var(--line); }
.conversation-panel, .chat-room { min-height: 0; background: var(--paper); }
.conversation-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: linear-gradient(180deg, #fffdfa, #faf6ed); }
.conversation-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 18px 14px; }
.conversation-panel__head div { min-width: 0; }
.conversation-panel__head span { color: var(--gold-dark); font-size: .66rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.conversation-panel__head h1 { display: flex; align-items: center; gap: 9px; margin: 4px 0 0; font-size: 1.45rem; letter-spacing: -.035em; }
.conversation-total { min-width: 26px; height: 26px; display: grid; place-items: center; padding: 0 7px; border-radius: 999px; background: #eee8f3; color: #554b65; font-size: .68rem; letter-spacing: 0; }
.round-button { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 48px; border: 1px solid #dfd3bd; border-radius: 15px; background: linear-gradient(145deg, #fff, var(--cream)); color: var(--ink); box-shadow: var(--soft-shadow); cursor: pointer; transition: transform .18s ease, border-color .18s ease; }
.round-button:hover { transform: translateY(-1px); }
.round-button:hover { border-color: var(--gold); background: var(--warm); }
.round-button svg { width: 21px; height: 21px; }
.conversation-search { position: relative; margin: 0 18px 12px; }
.conversation-search svg { position: absolute; top: 14px; left: 14px; width: 19px; height: 19px; color: var(--muted); pointer-events: none; }
.conversation-search input { width: 100%; min-height: 48px; padding: 0 14px 0 43px; border: 1px solid #e2d8c5; border-radius: 15px; background: rgba(255,255,255,.78); color: var(--ink); box-shadow: inset 0 1px rgba(255,255,255,.7), 0 4px 14px rgba(49,44,42,.035); }
.conversation-list { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 4px; padding: 0 10px 18px; overscroll-behavior: contain; }
.conversation-item { position: relative; width: 100%; min-height: 78px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px; border: 1px solid transparent; border-radius: 16px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.conversation-item:hover { transform: translateX(2px); border-color: #eadfc9; background: rgba(255,255,255,.8); box-shadow: 0 7px 20px rgba(49,44,42,.05); }
.conversation-item.active { border-color: #dec77e; background: linear-gradient(120deg, #f8eac3, #f5eddc); box-shadow: inset 3px 0 var(--gold), 0 8px 20px rgba(141,104,28,.09); }
.conversation-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg, #29233c, #171321); color: #dfc36c; box-shadow: 0 7px 18px rgba(30,26,46,.17); font-size: .78rem; font-weight: 800; }
.conversation-icon--task { background: #f0e2bd; color: var(--gold-dark); }
.conversation-icon--direct { border-radius: 50%; background: #e7e0ef; color: #4a3f5f; }
.conversation-copy { min-width: 0; display: grid; gap: 4px; }
.conversation-copy strong, .conversation-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong { font-size: .89rem; }
.conversation-copy span { color: var(--muted); font-size: .73rem; }
.conversation-meta { align-self: stretch; display: grid; align-content: center; justify-items: end; gap: 8px; }
.conversation-meta time { color: var(--muted); font-size: .64rem; }
.unread { min-width: 23px; height: 23px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--dark); font-size: .68rem; font-weight: 850; }

.chat-room { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.room-empty { min-height: 0; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 65% 20%, rgba(197,164,77,.11), transparent 32%), var(--paper); text-align: center; }
.room-empty__card { max-width: 430px; display: grid; justify-items: center; gap: 12px; padding: 34px; border: 1px solid rgba(230,221,204,.75); border-radius: 28px; background: rgba(255,255,255,.62); box-shadow: var(--soft-shadow); backdrop-filter: blur(8px); }
.room-empty__icon { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 24px; background: var(--dark); color: #d9bf6e; box-shadow: var(--shadow); }
.room-empty__icon svg { width: 32px; height: 32px; }
.room-empty__eyebrow { margin-top: 6px; color: var(--gold-dark); font-size: .65rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.room-empty h2 { margin: 8px 0 0; font-size: 1.55rem; }
.room-empty p { margin: 0; color: var(--muted); line-height: 1.55; }
.room-head { position: relative; z-index: 2; display: grid; gap: 10px; padding: 12px 18px; border-bottom: 1px solid rgba(230,221,204,.85); background: rgba(255,253,250,.9); box-shadow: 0 5px 22px rgba(49,44,42,.045); backdrop-filter: blur(14px); }
.room-head__identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.room-head__back { display: none; }
.room-head__copy { min-width: 0; display: grid; gap: 3px; }
.room-head__copy strong, .room-head__copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-head__copy strong { font-size: 1rem; }
.room-head__copy span { color: var(--muted); font-size: .73rem; }
.task-context { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid #e2cd91; border-radius: 13px; background: #fbf2d9; }
.task-context__copy { min-width: 0; display: grid; gap: 4px; }
.task-context__copy span { color: var(--gold-dark); font-size: .65rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.task-context__copy strong, .task-context__copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-context__copy strong { font-size: .85rem; }
.task-context__copy small { color: var(--muted); font-size: .7rem; }
.task-link { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 11px; background: var(--dark); color: #fff; font-size: .73rem; font-weight: 750; text-decoration: none; }
.task-link svg { width: 17px; height: 17px; }

.messages { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 22px clamp(14px, 3vw, 38px); background: radial-gradient(circle at 82% 10%, rgba(197,164,77,.12), transparent 26%), radial-gradient(circle at 14% 72%, rgba(109,91,139,.085), transparent 30%), linear-gradient(135deg, #fffdfa, #fbf8f2); overscroll-behavior: contain; }
.day-divider { align-self: center; margin: 7px 0; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.9); color: var(--muted); font-size: .65rem; font-weight: 700; }
.message { max-width: min(650px, 78%); align-self: flex-start; display: grid; gap: 5px; padding: 11px 14px 9px; border: 1px solid rgba(222,214,200,.9); border-radius: 7px 18px 18px 18px; background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(45,38,32,.065); animation: message-in .18s ease-out; }
.message--own { align-self: flex-end; border-color: #dbc373; border-radius: 18px 7px 18px 18px; background: linear-gradient(140deg, #fbf1d5, #f3e2b1); box-shadow: 0 9px 24px rgba(141,104,28,.11); }
.message--system { max-width: 86%; align-self: center; border: 0; border-radius: 12px; background: #eee9f3; color: #4b4259; text-align: center; box-shadow: none; }
.message__author { color: var(--gold-dark); font-size: .68rem; font-weight: 800; }
.message--system .message__author { display: none; }
.message__text { margin: 0; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.46; white-space: pre-wrap; }
.message__photo { min-width: 180px; min-height: 120px; display: block; padding: 0; overflow: hidden; border: 0; border-radius: 10px; background: var(--cream); cursor: zoom-in; }
.message__photo img { width: 100%; max-height: 320px; display: block; object-fit: cover; }
.message__photo-expired { min-width: 210px; padding: 18px; border-radius: 10px; background: #f2eee6; color: var(--muted); font-size: .75rem; }
.message time { justify-self: end; color: var(--muted); font-size: .61rem; }
.messages-empty { margin: auto; display: grid; justify-items: center; gap: 5px; color: var(--muted); text-align: center; }
.messages-empty > span { font-size: 2rem; }
.messages-empty > strong { color: var(--ink); font-size: .95rem; }
.messages-empty > small { font-size: .72rem; }

.composer { position: relative; z-index: 3; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 9px; padding: 12px max(18px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); border-top: 1px solid rgba(230,221,204,.88); background: rgba(255,253,250,.94); box-shadow: 0 -8px 28px rgba(49,44,42,.055); backdrop-filter: blur(16px); }
.composer__tools { display: flex; align-items: center; gap: 7px; }
.composer__tool { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #ded3c0; border-radius: 15px; background: linear-gradient(145deg, #fff, var(--cream)); color: var(--gold-dark); box-shadow: 0 4px 13px rgba(49,44,42,.045); cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.composer__tool:hover { transform: translateY(-1px); border-color: var(--gold); background: #f8edcf; }
.composer__emoji { font-size: 1.25rem; line-height: 1; }
.composer__emoji[aria-expanded="true"] { border-color: var(--gold); background: #f5e7bd; box-shadow: 0 0 0 3px rgba(197,164,77,.14); }
.composer__attach svg { width: 21px; height: 21px; }
.composer textarea { width: 100%; min-height: 48px; max-height: 132px; resize: none; padding: 13px 15px; border: 1px solid #ded3c0; border-radius: 16px; background: rgba(255,255,255,.88); color: var(--ink); box-shadow: inset 0 1px 2px rgba(49,44,42,.025); line-height: 1.35; }
.composer textarea:focus { border-color: var(--gold); }
.composer__send { min-width: 106px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 0; border-radius: 16px; background: linear-gradient(145deg, #d8bb60, var(--gold)); color: var(--dark); box-shadow: 0 8px 18px rgba(141,104,28,.2); font-weight: 800; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.composer__send:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(141,104,28,.25); }
.composer__send:disabled { opacity: .55; cursor: wait; }
.composer__send svg { width: 19px; height: 19px; }
.composer__preview { grid-column: 2 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 11px; border: 1px solid #e2cd91; border-radius: 11px; background: #fbf2d9; color: var(--gold-dark); font-size: .72rem; }
.composer__preview button { min-width: 40px; min-height: 40px; border: 0; background: transparent; color: var(--danger); cursor: pointer; }
.emoji-popover { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: calc(100% + 8px); width: min(390px, calc(100vw - 36px)); padding: 12px; border: 1px solid #ddcfb5; border-radius: 20px; background: rgba(255,253,250,.97); box-shadow: 0 24px 64px rgba(30,26,46,.2); backdrop-filter: blur(18px); animation: popover-in .16s ease-out; }
.emoji-popover header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 1px 2px 9px; }
.emoji-popover header strong { font-size: .78rem; }
.emoji-popover header button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 11px; background: var(--cream); color: var(--muted); cursor: pointer; }
.emoji-popover header svg { width: 17px; height: 17px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-grid button { aspect-ratio: 1; min-width: 40px; min-height: 40px; display: grid; place-items: center; border: 0; border-radius: 11px; background: transparent; font-size: 1.3rem; cursor: pointer; transition: transform .12s ease, background .12s ease; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { transform: scale(1.12); background: #f3e8ca; }

@keyframes message-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes popover-in { from { opacity: 0; transform: translateY(7px) scale(.98); } }

.login-screen { height: 100dvh; min-height: 100svh; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: minmax(320px, 520px) minmax(0, 1fr); grid-template-rows: max-content; background: var(--dark); }
.login-screen::-webkit-scrollbar { width: 0; height: 0; }
.login-card { height: max-content; min-height: 100svh; display: grid; align-content: center; gap: 22px; padding: clamp(26px, 6vw, 64px); background: var(--paper); }
.login-logo { display: flex; align-items: center; gap: 15px; }
.login-logo img { width: 52px; height: 66px; object-fit: contain; }
.login-logo div { display: grid; }
.login-logo strong { font-family: Ikra, Georgia, serif; color: var(--dark); font-size: 1.5rem; letter-spacing: .05em; }
.login-logo span { color: var(--gold-dark); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.login-card h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; letter-spacing: -.055em; }
.login-card > p { margin: -10px 0 0; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field span { font-size: .78rem; font-weight: 700; }
.field input { width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid #d5c394; border-radius: 13px; background: #faf7f0; color: var(--ink); }
.primary-button { min-height: 52px; border: 0; border-radius: 13px; background: var(--gold); color: var(--dark); font-weight: 800; cursor: pointer; }
.login-separator { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .69rem; }
.login-separator::before, .login-separator::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.demo-list { display: grid; gap: 8px; }
.demo-button { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--cream); color: var(--ink); text-align: left; cursor: pointer; }
.demo-button span { display: grid; gap: 2px; }
.demo-button strong { font-size: .8rem; }
.demo-button small { color: var(--muted); font-size: .67rem; }
.login-visual { position: sticky; top: 0; height: 100dvh; align-self: start; display: grid; place-items: center; padding: 60px; background: radial-gradient(circle at 68% 20%, rgba(213,184,94,.22), transparent 30%), radial-gradient(circle at 15% 80%, rgba(103,82,137,.3), transparent 34%), var(--dark); color: #eee8f7; }
.login-visual__content { max-width: 570px; }
.login-visual span { color: #d5b85e; font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.login-visual h2 { margin: 18px 0; font-family: Ikra, Georgia, serif; font-size: clamp(2.3rem, 5vw, 4.8rem); font-weight: 500; line-height: .98; }
.login-visual p { max-width: 460px; color: #c9c1d6; font-size: 1.05rem; line-height: 1.6; }

.sheet-backdrop, .management-backdrop, .lightbox, .install-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(18,15,27,.62); backdrop-filter: blur(5px); }
.sheet { width: min(470px, 100%); max-height: min(720px, 90svh); overflow: auto; padding: 20px; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.sheet header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet h2 { margin: 0; font-size: 1.3rem; }
.sheet p { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.contact-list { display: grid; gap: 7px; }
.contact-button { width: 100%; min-height: 60px; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 11px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.contact-button:hover { border-color: var(--gold); background: var(--cream); }
.contact-button span:first-child { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--dark); color: #d5b85e; font-size: .7rem; font-weight: 800; }
.contact-button span:last-child { min-width: 0; display: grid; gap: 3px; }
.contact-button strong, .contact-button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-button small { color: var(--muted); font-size: .7rem; }
.management-sheet { width: min(980px, 100%); max-height: min(820px, 92svh); overflow: auto; border: 1px solid rgba(213,184,94,.38); border-radius: 26px; background: linear-gradient(145deg, #fffdfa, #f9f3e7); box-shadow: 0 34px 90px rgba(18,15,27,.3); }
.management-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: rgba(255,253,250,.95); backdrop-filter: blur(16px); }
.management-head > div { min-width: 0; }
.management-head > div > span { color: var(--gold-dark); font-size: .66rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.management-head h2 { margin: 4px 0 5px; font-family: Ikra, Georgia, serif; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 500; }
.management-head p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.management-tabs { position: sticky; z-index: 2; top: 89px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 24px; background: rgba(255,253,250,.96); backdrop-filter: blur(16px); }
.management-tabs button { min-height: 46px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.management-tabs button[aria-selected="true"] { border-color: #dfc978; background: linear-gradient(145deg, #f8e9be, #f5eddc); color: var(--ink); box-shadow: 0 6px 18px rgba(141,104,28,.09); }
.management-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); gap: 18px; padding: 12px 24px 24px; }
.management-form, .management-list { min-width: 0; align-self: start; display: grid; gap: 15px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.76); box-shadow: var(--soft-shadow); }
.management-form__title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.management-form__title span { color: var(--gold-dark); font-size: .64rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.management-form__title h3, .management-list > h3 { margin: 4px 0 0; font-size: 1.06rem; }
.management-form__title > button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--cream); color: var(--ink); cursor: pointer; }
.management-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.management-field { min-width: 0; display: grid; gap: 7px; }
.management-field span, .member-picker legend { color: var(--ink); font-size: .72rem; font-weight: 800; }
.management-field input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #d9c99f; border-radius: 12px; background: #fffdfa; color: var(--ink); }
.management-field input:focus { border-color: var(--gold); }
.member-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.member-picker > p { margin: 4px 0 10px; color: var(--muted); font-size: .69rem; }
.member-picker > div { max-height: 260px; overflow: auto; display: grid; gap: 6px; padding-right: 3px; }
.member-option { min-height: 56px; display: grid; grid-template-columns: 20px 38px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.member-option:has(input:checked) { border-color: var(--gold); background: #fbf1d6; }
.member-option input { width: 18px; height: 18px; accent-color: var(--gold-dark); }
.member-option > span:last-child { min-width: 0; display: grid; gap: 2px; }
.member-option strong, .member-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-option small { color: var(--muted); font-size: .68rem; }
.member-avatar, .management-card__avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--dark); color: #d9bf6e; font-size: .65rem; font-weight: 850; }
.management-primary { min-height: 50px; border: 0; border-radius: 13px; background: linear-gradient(145deg, #d8bb60, var(--gold)); color: var(--dark); box-shadow: 0 8px 20px rgba(141,104,28,.18); font-weight: 850; cursor: pointer; }
.management-primary:disabled { opacity: .55; cursor: wait; }
.management-hint { margin: -3px 0 0; padding: 10px 12px; border-radius: 12px; background: #f0ebf4; color: #594f67; font-size: .7rem; line-height: 1.45; }
.management-list { align-content: start; max-height: 565px; overflow: auto; }
.management-card { min-height: 64px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.management-card.is-inactive { opacity: .62; background: #f3efe8; }
.management-card > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.management-card strong, .management-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.management-card small { color: var(--muted); font-size: .68rem; }
.management-card__icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: #eee7f3; color: #55486b; }
.management-card__icon svg { width: 20px; height: 20px; }
.management-card > button { min-width: 44px; min-height: 44px; padding: 0 11px; border: 1px solid #dfd3bd; border-radius: 11px; background: var(--cream); color: var(--ink); cursor: pointer; }
.management-card > button svg { width: 18px; height: 18px; }
.management-empty { margin: 0; padding: 22px 14px; border: 1px dashed #d9c99f; border-radius: 13px; color: var(--muted); font-size: .75rem; line-height: 1.5; text-align: center; }
.lightbox button { position: fixed; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.35); border-radius: 14px; background: rgba(30,26,46,.75); color: #fff; cursor: pointer; }
.lightbox img { max-width: 95vw; max-height: 88svh; object-fit: contain; border-radius: 14px; box-shadow: var(--shadow); }
.profile-menu { position: fixed; z-index: 40; top: 66px; right: max(18px, env(safe-area-inset-right)); width: min(290px, calc(100vw - 28px)); display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.profile-menu strong, .profile-menu small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu small { color: var(--muted); }
.profile-menu button { min-height: 44px; margin-top: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--cream); color: var(--ink); cursor: pointer; }
.install-card { width: min(460px, 100%); display: grid; gap: 14px; padding: 22px; border-radius: 20px; background: var(--paper); }
.install-card h2, .install-card p { margin: 0; }
.install-card p, .install-card li { color: var(--muted); line-height: 1.5; }
.install-card ol { display: grid; gap: 8px; margin: 0; padding-left: 22px; }
.install-card__actions { display: flex; gap: 8px; }
.install-card__actions button { min-height: 46px; flex: 1; border: 1px solid var(--line); border-radius: 11px; background: var(--cream); cursor: pointer; }
.install-card__actions .primary-button { border: 0; background: var(--gold); }
.toast { position: fixed; z-index: 80; right: 18px; bottom: 18px; max-width: min(380px, calc(100vw - 36px)); padding: 12px 15px; border-radius: 12px; background: var(--dark); color: #fff; box-shadow: var(--shadow); font-size: .8rem; }
.toast.error { background: #8e3f3e; }

@media (max-width: 760px) {
  .chat-shell { grid-template-rows: calc(60px + env(safe-area-inset-top)) minmax(0, 1fr); }
  .chat-topbar { padding: env(safe-area-inset-top) 10px 0; }
  .chat-brand img { width: 32px; height: 40px; }
  .chat-brand strong { font-size: 1rem; }
  .chat-brand small { max-width: 145px; }
  .top-action { min-width: 46px; width: 46px; padding: 0; }
  .top-action > span:not(.avatar) { display: none; }
  .top-action .avatar { display: grid; }
  .chat-main { display: block; }
  .conversation-panel, .chat-room { width: 100%; height: 100%; }
  .chat-room { display: none; }
  .chat-shell--open .conversation-panel { display: none; }
  .chat-shell--open .chat-room { display: grid; }
  .conversation-panel__head { padding: 16px 14px 12px; }
  .conversation-search { margin-inline: 14px; }
  .conversation-list { padding-inline: 6px; }
  .conversation-item { min-height: 74px; }
  .room-head { padding: 8px 10px; }
  .room-head__back { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 44px; border: 0; border-radius: 12px; background: var(--cream); color: var(--ink); }
  .task-context { grid-template-columns: minmax(0, 1fr) 44px; padding: 9px 10px; }
  .task-context__copy strong { font-size: .78rem; }
  .task-link { width: 44px; min-width: 44px; padding: 0; justify-content: center; }
  .task-link span { display: none; }
  .messages { padding: 14px 10px; }
  .message { max-width: 87%; }
  .message--system { max-width: 94%; }
  .composer { grid-template-columns: auto minmax(0, 1fr) 48px; gap: 7px; padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .composer__tools { gap: 5px; }
  .composer__tool { width: 46px; height: 46px; border-radius: 14px; }
  .composer textarea { min-height: 46px; padding: 12px; }
  .composer__send { min-width: 48px; width: 48px; min-height: 46px; padding: 0; }
  .composer__send span { display: none; }
  .composer__preview { grid-column: 1 / -1; }
  .emoji-popover { right: max(8px, env(safe-area-inset-right)); left: max(8px, env(safe-area-inset-left)); width: auto; bottom: calc(100% + 6px); border-radius: 18px; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .emoji-grid button { width: 100%; min-width: 0; min-height: 44px; }
  .login-screen { display: block; background: var(--paper); }
  .login-card { min-height: 100svh; align-content: start; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
  .login-card h1 { font-size: 2.3rem; }
  .login-visual { display: none; }
  .sheet-backdrop { align-items: end; padding: 0; }
  .sheet { width: 100%; max-height: 84svh; border-radius: 22px 22px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .management-backdrop { align-items: end; padding: 0; }
  .management-sheet { width: 100%; max-height: 92svh; border-width: 1px 0 0; border-radius: 24px 24px 0 0; }
  .management-head { padding: 18px 16px 14px; }
  .management-head p { max-width: 270px; }
  .management-tabs { top: 80px; padding: 8px 12px; }
  .management-layout { grid-template-columns: 1fr; padding: 8px 12px max(18px, env(safe-area-inset-bottom)); }
  .management-form, .management-list { padding: 14px; border-radius: 17px; }
  .management-fields { grid-template-columns: 1fr; }
  .management-list { max-height: none; }
  .toast { right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .chat-brand { gap: 8px; }
  .chat-brand strong { font-size: .92rem; }
  .chat-brand small { display: none; }
  .chat-topbar__actions { gap: 4px; }
  .message { max-width: 91%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
