:root {
  color-scheme: light;
  --ink: #172b4d;
  --muted: #52617a;
  --paper: #f3f7ff;
  --white: #ffffff;
  --line: #dbe4f0;
  --teal: #2563eb;
  --teal-deep: #173a8a;
  --coral: #2563eb;
  --coral-soft: #e8efff;
  --mint: #e8f2ff;
  --lavender: #eef0ff;
  --gold: #06b6d4;
  --shadow: 0 24px 60px rgba(43, 65, 62, .09);
  font-family: IRANSans, Tahoma, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: var(--paper); font-family: IRANSans, Tahoma, "Segoe UI", Arial, sans-serif; font-size: 16px; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(91, 137, 127, .38); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
.is-hidden { display: none !important; }
.hidden-token { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(1px); pointer-events: none; opacity: .4; }
.ambient-one { width: 440px; height: 440px; background: radial-gradient(circle, #eed8c7 0, rgba(238,216,199,0) 70%); inset-block-start: -220px; inset-inline-end: 7%; }
.ambient-two { width: 520px; height: 520px; background: radial-gradient(circle, #d5e7df 0, rgba(213,231,223,0) 70%); inset-block-end: -300px; inset-inline-start: -140px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--teal-deep); font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.brand img { display: block; width: 38px; height: 38px; }
.brand-light { color: #fffdf6; }
.eyebrow { color: #52617a; font-size: 14px; font-weight: 800; letter-spacing: 1.45px; }
.button { min-height: 44px; border: 0; border-radius: 14px; padding: 0 19px; cursor: pointer; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .6; cursor: progress; transform: none; }
.button-primary { color: #fffdf8; background: linear-gradient(135deg, #476b66, #31524e); box-shadow: 0 10px 22px rgba(54, 91, 89, .16); }
.button-primary:hover { background: linear-gradient(135deg, #537c75, #31524e); box-shadow: 0 14px 26px rgba(54, 91, 89, .21); }
.button-primary span { margin-inline-start: 16px; font-size: 17px; }
.button-wide { width: 100%; justify-content: space-between; display: flex; align-items: center; }
.button-outline { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d7e2dc; color: var(--teal); background: white; }
.button-outline:hover { background: #f3f8f5; }
.button-quiet { background: #e7efff; color: var(--teal-deep); }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: #52617a; font-size: 18px; cursor: pointer; transition: background .15s, color .15s; }
.icon-button:hover { color: var(--teal-deep); background: #eff3ef; }
.round-button { display: grid; place-items: center; flex: 0 0 39px; width: 39px; height: 39px; border: 0; border-radius: 14px; color: white; background: var(--coral); box-shadow: 0 6px 15px rgba(233, 133, 112, .23); font-size: 24px; cursor: pointer; transition: transform .18s; }
.round-button:hover { transform: rotate(90deg); }

/* Welcome and sign-in */
.auth-layout { position: relative; display: grid; grid-template-columns: 1.06fr .94fr; min-height: 100vh; max-width: 1600px; margin: auto; overflow: hidden; background: rgba(255, 254, 250, .68); }
.auth-visual { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: clamp(30px, 5.2vw, 78px); overflow: hidden; color: #fffdf6; background: linear-gradient(150deg, #3c6460 0%, #315652 54%, #244744 100%); }
.auth-visual::before, .auth-visual::after { position: absolute; content: ""; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.auth-visual::before { width: 620px; height: 620px; inset-inline-end: -265px; inset-block-start: 15%; }
.auth-visual::after { width: 460px; height: 460px; inset-inline-end: -183px; inset-block-start: 24%; }
.auth-visual .eyebrow { color: #c7dcd2; }
.visual-copy { position: relative; z-index: 1; margin: auto 0; max-width: 570px; padding-block: 54px 36px; }
.visual-copy h1 { margin: 17px 0 18px; font-size: clamp(35px, 4.4vw, 62px); line-height: 1.5; font-weight: 800; letter-spacing: -1.3px; }
.visual-copy h1 em, .welcome-copy h1 em { color: #f1c995; font-style: normal; }
.visual-copy p { max-width: 420px; color: #d6e4dc; font-size: 16px; line-height: 2.2; }
.room-art { display: block; width: min(80%, 450px); height: auto; margin: 4px auto -5px; filter: drop-shadow(0 18px 24px rgba(12, 37, 35, .18)); animation: float 6s ease-in-out infinite; }
.visual-note { display: flex; align-items: center; gap: 9px; color: #d3e2db; font-size: 15px; }
.pulse-dot, .online-dot { position: relative; display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #97c9a9; }
.pulse-dot::after { position: absolute; inset: -5px; border: 1px solid rgba(151,201,169,.4); border-radius: 50%; content: ""; animation: pulse 2s infinite; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: clamp(28px, 5.4vw, 80px); background: rgba(255, 254, 250, .74); }
.auth-mobile-brand { display: none; }
.auth-card { width: min(100%, 395px); animation: rise-in .55s both; }
.auth-heading { margin-bottom: 27px; }
.auth-heading h2 { margin: 9px 0 8px; font-size: 29px; letter-spacing: -.7px; }
.auth-heading p, .settings-card p, .dialog-card p { margin: 0; color: var(--muted); line-height: 1.9; }
.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 24px; padding: 4px; border-radius: 13px; background: #eaf0fa; }
.auth-tab { z-index: 1; height: 37px; border: 0; border-radius: 10px; color: #52617a; background: transparent; cursor: pointer; transition: color .2s; }
.auth-tab.is-active { color: var(--teal-deep); font-weight: 700; }
.tab-glider { position: absolute; inset-block: 4px; inset-inline-start: 4px; width: calc(50% - 4px); border-radius: 10px; background: white; box-shadow: 0 2px 8px rgba(43,65,62,.07); transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.auth-tab[data-auth-tab="register"].is-active ~ .tab-glider { transform: translateX(-100%); }
.auth-form, .settings-form { display: grid; gap: 15px; }
.auth-form label, .settings-form label { display: grid; gap: 8px; color: #536562; font-size: 15px; font-weight: 700; }
.auth-form input, .settings-form input:not([type=checkbox]), .settings-form textarea { width: 100%; min-height: 47px; padding: 0 14px; border: 1px solid #e3e7e1; border-radius: 13px; color: var(--ink); background: #fff; outline: none; transition: border-color .18s, box-shadow .18s; }
.auth-form input[data-latin-input], .settings-form input[data-latin-input], .confirmation-field input[data-latin-input] { direction: ltr; text-align: left; }
.latin-input-hint { display: block; margin-top: 7px; color: #c52a3a; font-size: 12px; line-height: 1.7; font-weight: 500; }
.has-latin-input-warning { border-color: #c52a3a !important; box-shadow: 0 0 0 3px rgba(197,42,58,.12) !important; }
.auth-form input:focus, .settings-form input:focus, .settings-form textarea:focus { border-color: #89aaa1; box-shadow: 0 0 0 4px rgba(137,170,161,.13); }
.auth-form input::placeholder { color: #52617a; }
.password-field { position: relative; }
.password-field input { padding-inline-end: 46px; }
.password-toggle { position: absolute; inset-inline-end: 10px; top: 7px; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: #52617a; cursor: pointer; }
.auth-form .button { margin-top: 4px; }
.form-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.form-message.error { color: #bd584d; }
.form-message.success { color: #43846b; }
.auth-privacy { display: flex; align-items: center; gap: 10px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); color: #52617a; font-size: 15px; }
.auth-privacy span:first-child { color: var(--coral); font-size: 16px; }
.local-link { display: block; width: fit-content; margin-top: 13px; color: #52617a; font-size: 15px; }
.local-link:hover, .back-home:hover { color: var(--coral); }
.auth-footer { margin-top: auto; padding-top: 32px; color: #52617a; font-size: 14px; }
.auth-footer span { padding-inline: 6px; color: var(--coral); }

/* Main chat workspace */
.app-shell { position: relative; display: grid; grid-template-columns: minmax(300px, 352px) minmax(0, 1fr); width: 100%; height: 100dvh; min-height: 620px; overflow: hidden; background: #f3f7ff; }
.sidebar { z-index: 4; display: flex; flex-direction: column; min-width: 0; height: 100%; padding: 27px 22px 20px; border-inline-start: 1px solid #ebeee8; background: #ffffff; box-shadow: 5px 0 28px rgba(36, 56, 58, .025); }
.sidebar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.mobile-close { display: none; }
.profile-strip { display: flex; align-items: center; gap: 11px; padding: 12px 11px; border: 1px solid #efeee7; border-radius: 17px; background: #f5f8ff; }
.avatar { display: block; width: 43px; height: 43px; flex: 0 0 43px; object-fit: cover; border: 2px solid white; border-radius: 15px; background: #eaf0eb; box-shadow: 0 3px 8px rgba(36,56,58,.07); }
.avatar-self { border-radius: 50%; }
.avatar-large { width: 68px; height: 68px; flex-basis: 68px; border-radius: 24px; }
.profile-copy { display: grid; min-width: 0; flex: 1; gap: 6px; }
.profile-copy strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; }
.profile-copy span { color: #52617a; font-size: 14px; }
.profile-copy .online-dot { margin-inline-end: 5px; }
.admin-pill { padding: 4px 8px; border-radius: 20px; color: #805c2b; background: #f7ebd3; font-size: 14px; font-weight: 800; white-space: nowrap; }
.sidebar-section-head { display: flex; align-items: end; justify-content: space-between; margin: 30px 2px 16px; }
.sidebar-section-head h2 { margin: 5px 0 0; font-size: 21px; }
.search-box { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 13px; border: 1px solid #eff0eb; border-radius: 13px; color: #52617a; background: #f5f8ff; }
.search-box span { font-size: 22px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 15px; }
.search-box input::placeholder { color: #52617a; }
.friend-list { flex: 1; min-height: 80px; overflow: auto; padding: 11px 0; scrollbar-width: thin; scrollbar-color: #dce4dd transparent; }
.friend-item { display: flex; width: 100%; align-items: center; gap: 11px; padding: 10px 9px; border: 0; border-radius: 15px; text-align: right; background: transparent; cursor: pointer; transition: background .18s, transform .18s; }
.friend-item:hover { transform: translateX(-2px); background: #f6f8f4; }
.friend-item.is-selected { background: #e7efff; }
.friend-copy { display: grid; min-width: 0; flex: 1; gap: 5px; }
.friend-copy strong { overflow: hidden; color: #405452; font-size: 15px; text-overflow: ellipsis; }
.friend-copy small { overflow: hidden; color: #52617a; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.friend-meta { display: flex; align-items: center; gap: 6px; }
.presence-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d4dcd6; }
.presence-dot.is-online { background: #7bb38e; box-shadow: 0 0 0 3px #e6f0e8; }
.unread-badge { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 20px; color: white; background: var(--coral); font-size: 14px; }
.friend-empty { display: grid; justify-items: center; gap: 9px; padding: 33px 12px; color: #52617a; text-align: center; }
.friend-empty span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: #b67564; background: var(--coral-soft); font-size: 19px; }
.friend-empty strong { color: #5d706b; font-size: 15px; }
.friend-empty small, .search-empty { color: #52617a; font-size: 14px; }
.search-empty { padding: 15px 8px; text-align: center; }
.friend-requests { max-height: 170px; overflow: auto; border-top: 1px solid #f0f0eb; }
.requests-title { padding: 14px 4px 8px; color: #52617a; font-size: 14px; font-weight: 700; }
.request-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 5px; color: #5a6d68; font-size: 15px; }
.request-accept { padding: 6px 12px; border: 0; border-radius: 9px; color: #426359; background: #e5f0e9; font-size: 14px; cursor: pointer; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid #f0f0eb; color: #52617a; font-size: 14px; }
.privacy-mark { color: var(--coral); font-size: 16px; }
.main-panel { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 0 clamp(22px, 4vw, 62px) 24px; overflow: hidden; }
.impersonation-banner { z-index: 5; position: absolute; inset-block-start: 8px; inset-inline: clamp(22px, 4vw, 62px); display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 5px 11px 5px 6px; border: 1px solid #f0d5c8; border-radius: 13px; color: #89584c; background: #fff4ee; box-shadow: 0 5px 15px rgba(96,65,54,.05); font-size: 14px; }
.impersonation-banner strong { color: #65463d; }
.impersonation-banner .button { min-height: 31px; padding-inline: 11px; color: #805b43; background: #f8e6d8; font-size: 14px; }
.main-panel.is-impersonating .topbar { margin-top: 51px; }
.topbar { display: flex; min-height: 83px; align-items: center; justify-content: space-between; border-bottom: 1px solid #e9ece5; }
.topbar-title { display: grid; gap: 5px; }
.topbar-title .eyebrow { letter-spacing: .5px; }
.topbar-title strong { color: #455b57; font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.admin-nav { min-height: 37px; padding: 0 12px; font-size: 15px; }
.admin-nav span { margin-inline-start: 6px; color: #b48a4f; }
.menu-toggle { display: none; }
.welcome-view { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; align-content: center; align-items: center; flex: 1; gap: 10px; max-width: 1200px; margin: auto; padding: 25px 0 0; animation: rise-in .45s both; }
.welcome-copy { z-index: 1; padding-bottom: 30px; }
.welcome-copy h1 { margin: 13px 0 14px; font-size: clamp(31px, 3.2vw, 49px); line-height: 1.55; letter-spacing: -1px; }
.welcome-copy h1 em { color: #df876f; }
.welcome-copy p { max-width: 400px; margin: 0 0 23px; color: #52617a; font-size: 15px; line-height: 2.1; }
.welcome-art-wrap { position: relative; display: grid; place-items: center; min-height: 310px; }
.welcome-art-wrap > img { z-index: 1; display: block; width: min(100%, 475px); height: auto; filter: drop-shadow(0 20px 22px rgba(45,76,68,.1)); animation: float 6.5s ease-in-out infinite; }
.art-orbit { position: absolute; border: 1px solid rgba(92,139,121,.12); border-radius: 50%; }
.orbit-a { width: 330px; height: 330px; }
.orbit-b { width: 260px; height: 260px; border-style: dashed; animation: orbit 32s linear infinite; }
.floating-note { z-index: 2; position: absolute; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid rgba(255,255,255,.9); border-radius: 14px; color: #647570; background: rgba(255,254,250,.94); box-shadow: 0 12px 30px rgba(47,71,65,.11); font-size: 14px; animation: float 4s ease-in-out infinite; }
.note-a { inset-block-start: 15%; inset-inline-start: 0; }
.note-b { inset-block-end: 14%; inset-inline-end: -2%; animation-delay: -1.8s; }
.note-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 10px; color: #8e6556; font-weight: 800; }
.note-avatar.peach { background: #f9e0d5; }
.note-avatar.green { color: #507565; background: #dfede3; }
.welcome-stats { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 21px 0 0; border-top: 1px solid #e9ece5; }
.welcome-stats div { display: grid; gap: 6px; }
.welcome-stats strong { color: #536a63; font-size: 15px; }
.welcome-stats span { color: #52617a; font-size: 14px; }
.chat-view { display: flex; flex-direction: column; flex: 1; min-height: 0; animation: rise-in .3s both; }
.chat-header { display: flex; align-items: center; justify-content: space-between; min-height: 73px; border-bottom: 1px solid #e9ece5; }
.chat-person { display: flex; align-items: center; gap: 11px; }
.chat-person > div { display: grid; gap: 6px; }
.chat-person strong { font-size: 15px; }
.chat-person span { color: #52617a; font-size: 14px; }
.chat-person .online-dot { width: 6px; height: 6px; margin-inline-end: 3px; }
.online-dot.is-offline { background: #c4cec7; }
.message-scroll { flex: 1; overflow-y: auto; padding: 20px 2px 24px; scrollbar-width: thin; scrollbar-color: #dce4dd transparent; }
.message-day { width: fit-content; margin: 0 auto 21px; padding: 6px 11px; border-radius: 20px; color: #52617a; background: #eef1ec; font-size: 14px; }
.message-list { display: flex; flex-direction: column; gap: 11px; }
.message-row { display: flex; width: 100%; }
.message-row.is-mine { justify-content: flex-start; }
.message-row.is-theirs { justify-content: flex-end; }
.message-bubble { max-width: min(76%, 520px); padding: 11px 14px 8px; border-radius: 17px; box-shadow: 0 4px 12px rgba(42,65,60,.035); }
.is-mine .message-bubble { border-start-end-radius: 5px; color: #fafff9; background: #2563eb; }
.is-theirs .message-bubble { border-start-start-radius: 5px; color: #50635e; background: #ffffff; }
.message-bubble p { margin: 0; font-size: 15px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 5px; opacity: .64; font-size: 14px; }
.read-state { letter-spacing: -3px; }
.read-state.is-read { color: #addcc2; opacity: 1; }
.message-image-link img { display: block; max-width: min(100%, 300px); max-height: 280px; border-radius: 12px; object-fit: cover; }
.message-bubble video { display: block; max-width: min(100%, 360px); max-height: 280px; border-radius: 12px; background: #20312f; }
.message-file { display: grid; grid-template-columns: 37px 1fr; align-items: center; gap: 2px 10px; min-width: 200px; color: inherit; }
.message-file > span { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: var(--teal); background: #dcece2; font-size: 18px; }
.is-mine .message-file > span { color: white; background: rgba(255,255,255,.15); }
.message-file strong { max-width: 240px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.message-file small { opacity: .7; font-size: 14px; }
.composer { position: relative; display: flex; align-items: end; gap: 10px; min-height: 61px; padding: 9px 10px; border: 1px solid #e6e9e2; border-radius: 19px; background: #ffffff; box-shadow: 0 10px 28px rgba(45,69,63,.055); }
.attach-button { display: grid; place-items: center; position: relative; width: 39px; height: 39px; flex: 0 0 39px; overflow: hidden; border-radius: 12px; color: #52617a; background: #e7efff; font-size: 23px; cursor: pointer; }
.attach-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.composer textarea { width: 100%; min-height: 39px; max-height: 110px; resize: none; border: 0; outline: 0; padding: 10px 4px; color: var(--ink); background: transparent; font-size: 15px; line-height: 1.65; }
.composer textarea::placeholder { color: #52617a; }
.send-button { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border: 0; border-radius: 13px; color: white; background: var(--coral); font-size: 16px; cursor: pointer; transition: transform .18s, background .18s; }
.send-button:hover { transform: translateY(-2px); background: #df755f; }
.attachment-caption { position: absolute; inset-block-end: 100%; inset-inline-start: 54px; color: #52617a; font-size: 14px; }
.chat-footnote { margin: 8px 0 0; color: #52617a; text-align: center; font-size: 14px; }

/* Settings and admin */
.settings-view, .admin-view { flex: 1; min-height: 0; overflow: auto; padding: 30px 0 16px; animation: rise-in .35s both; scrollbar-width: thin; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.section-heading h1 { margin: 5px 0 0; font-size: 24px; }
.back-button { transform: rotate(180deg); background: #ffffff; border-color: #e8ebe4; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 980px; }
.settings-card { min-height: 200px; padding: 20px; border: 1px solid #eaede6; border-radius: 19px; background: #ffffff; box-shadow: 0 7px 24px rgba(45,69,63,.03); }
.settings-card h2, .dialog-card h2 { margin: 13px 0 7px; font-size: 15px; }
.settings-card p, .dialog-card p { font-size: 15px; }
.card-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; font-size: 17px; }
.card-icon.coral { color: #ab6554; background: #e8efff; }
.card-icon.lavender { color: #52617a; background: #ece8f5; }
.card-icon.mint { color: #507a67; background: #e0eee5; }
.avatar-setting { display: flex; align-items: center; gap: 15px; margin-top: 17px; }
.avatar-setting .button { min-height: 37px; padding-inline: 13px; font-size: 14px; }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; gap: 10px !important; margin-top: 20px; font-size: 15px !important; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 20px; background: #d8ded9; transition: background .2s; }
.switch::after { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; content: ""; box-shadow: 0 2px 5px rgba(30,50,46,.16); transition: transform .2s; }
.switch-row input:checked + .switch { background: #5d8d79; }
.switch-row input:checked + .switch::after { transform: translateX(-18px); }
.password-card { grid-column: 1 / -1; max-width: 490px; }
.password-card .settings-form { grid-template-columns: 1fr 1fr; align-items: end; margin-top: 17px; }
.password-card .settings-form button, .password-card .form-message { grid-column: 1 / -1; }
.settings-form small { color: #52617a; font-size: 14px; font-weight: 400; }
.dialog-card { width: min(calc(100% - 28px), 430px); padding: 25px; border: 1px solid #e8ede6; border-radius: 24px; color: var(--ink); background: var(--white); box-shadow: var(--shadow); animation: rise-in .25s both; }
.dialog-card::backdrop { background: rgba(30, 48, 45, .3); backdrop-filter: blur(4px); }
.dialog-close-row { display: flex; justify-content: flex-end; margin: -14px -14px 10px; }
.dialog-close-row button { font-size: 24px; }
.dialog-card .settings-form { margin-top: 17px; }
.admin-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 19px; }
.summary-card { display: grid; gap: 9px; padding: 15px; border: 1px solid #e9ede6; border-radius: 16px; background: white; }
.summary-card span { color: #52617a; font-size: 14px; }
.summary-card strong { color: #45645b; font-size: 23px; }
.admin-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 13px; background: #eaf0fa; }
.admin-tab { min-height: 35px; padding: 0 15px; border: 0; border-radius: 10px; color: #52617a; background: transparent; cursor: pointer; font-size: 14px; }
.admin-tab.is-active { color: var(--teal-deep); background: white; box-shadow: 0 2px 7px rgba(43,65,62,.07); font-weight: 700; }
.admin-content { min-height: 200px; margin-top: 12px; overflow: auto; border: 1px solid #e9ede6; border-radius: 17px; background: #ffffff; }
.admin-loading, .admin-empty { padding: 22px; color: #52617a; font-size: 15px; }
.admin-table { min-width: 680px; }
.admin-row { display: grid; grid-template-columns: 1.4fr 1fr .65fr 1.2fr; gap: 12px; align-items: center; min-height: 61px; padding: 9px 14px; border-bottom: 1px solid #f0f1ed; color: #687975; font-size: 14px; }
.admin-row:last-child { border-bottom: 0; }
.admin-header { min-height: 39px; color: #52617a; background: #fafbf7; font-size: 14px; font-weight: 700; }
.admin-person { display: flex; align-items: center; gap: 9px; color: #425752; font-weight: 700; }
.avatar-small { width: 31px; height: 31px; flex-basis: 31px; border-radius: 11px; }
.account-status { width: fit-content; padding: 4px 8px; border-radius: 12px; font-size: 14px; }
.account-status.is-active { color: #4b7a63; background: #e8f3eb; }
.account-status.is-disabled { color: #a25a50; background: #f9e9e4; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.text-button { padding: 4px 0; border: 0; color: #537669; background: transparent; cursor: pointer; font-size: 14px; }
.danger-text { color: #bf7164; }
.admin-actions small { color: #52617a; }
.admin-message-list, .session-log-list { display: grid; }
.admin-message-card { padding: 13px 15px; border-bottom: 1px solid #f0f1ed; }
.admin-message-card:last-child { border-bottom: 0; }
.admin-message-heading { display: flex; justify-content: space-between; gap: 10px; color: #647872; font-size: 14px; }
.admin-message-heading time, .admin-message-card small { color: #52617a; font-size: 14px; }
.admin-message-card p { margin: 8px 0; color: #536660; font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.admin-file-link { display: inline-block; margin-bottom: 7px; color: #4d8070; font-size: 14px; }
.session-row { display: grid; grid-template-columns: 1fr .65fr 1fr 1fr; gap: 10px; align-items: center; padding: 12px 15px; border-bottom: 1px solid #f0f1ed; color: #657872; font-size: 14px; }
.session-row:last-child { border: 0; }
.session-row code { color: #52617a; direction: ltr; text-align: right; font-size: 14px; }
.session-row time { color: #52617a; font-size: 14px; }
.toast-message { z-index: 20; position: fixed; inset-block-end: 22px; inset-inline-start: 50%; max-width: calc(100vw - 32px); padding: 12px 18px; border: 1px solid rgba(255,255,255,.5); border-radius: 13px; color: white; background: #344f4c; box-shadow: 0 12px 35px rgba(36,56,58,.2); font-size: 15px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; }
.toast-message.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-shade { display: none; }

/* Local-only setup and recovery */
.tools-page { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: #f3f7ff; }
.tools-card { position: relative; width: min(100%, 455px); padding: clamp(24px, 6vw, 44px); border: 1px solid #e9ece5; border-radius: 25px; background: rgba(255,254,250,.96); box-shadow: var(--shadow); animation: rise-in .4s both; }
.tools-card .brand { margin-bottom: 30px; }
.tools-mark { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 18px; border-radius: 16px; color: #b16f5e; background: #e8efff; font-size: 22px; }
.recovery-mark { color: #5b7d70; background: #e2eee7; }
.tools-card h1 { margin: 7px 0 9px; font-size: 26px; }
.tools-card > p { margin: 0 0 22px; color: #52617a; font-size: 15px; line-height: 2; }
.tools-card .settings-form { gap: 14px; }
.tools-card .button { margin-top: 7px; }
.back-home { display: inline-block; margin-top: 18px; color: #52617a; font-size: 14px; }

@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes pulse { 0% { transform: scale(.65); opacity: .75; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes orbit { to { transform: rotate(360deg); } }

@media (max-width: 920px) {
  .auth-layout { grid-template-columns: .9fr 1.1fr; }
  .auth-visual { padding: 34px; }
  .visual-copy h1 { font-size: 39px; }
  .room-art { width: 100%; }
  .app-shell { grid-template-columns: minmax(285px, 320px) minmax(0, 1fr); }
  .main-panel { padding-inline: 25px; }
  .welcome-view { grid-template-columns: 1fr .85fr; }
  .welcome-copy h1 { font-size: 34px; }
  .floating-note { font-size: 14px; }
}
@media (max-width: 700px) {
  body { background: #f3f7ff; }
  .auth-layout { display: flex; min-height: 100dvh; flex-direction: column; background: #ffffff; }
  .auth-visual { min-height: 0; height: 33dvh; max-height: 260px; padding: 20px 23px; }
  .auth-visual > .brand { display: none; }
  .visual-copy { margin: auto 0; padding: 0; }
  .visual-copy .eyebrow { font-size: 14px; }
  .visual-copy h1 { margin: 7px 0 5px; font-size: clamp(26px, 7vw, 36px); line-height: 1.36; }
  .visual-copy p { max-width: 320px; margin: 0; font-size: 14px; line-height: 1.8; }
  .visual-copy .room-art, .visual-note { display: none; }
  .auth-panel { flex: 1; justify-content: start; align-items: stretch; padding: 18px 23px 22px; }
  .auth-mobile-brand { display: inline-flex; margin-bottom: 22px; font-size: 17px; }
  .auth-mobile-brand img { width: 32px; height: 32px; }
  .auth-card { width: 100%; }
  .auth-heading { margin-bottom: 18px; }
  .auth-heading h2 { font-size: 23px; }
  .auth-heading p { font-size: 15px; }
  .auth-tabs { margin-bottom: 18px; }
  .auth-form { gap: 12px; }
  .auth-form input { min-height: 45px; }
  .auth-privacy { margin-top: 19px; padding-top: 14px; }
  .auth-footer { margin-top: 18px; padding-top: 0; text-align: center; }
  .app-shell { display: block; height: 100dvh; min-height: 0; }
  .sidebar { position: absolute; z-index: 7; top: 0; bottom: 0; inset-inline-end: auto; right: 0; width: min(87vw, 355px); height: 100%; padding: 20px 19px 17px; box-shadow: -15px 0 45px rgba(27,46,43,.14); transform: translateX(110%); transition: transform .25s cubic-bezier(.2,.7,.2,1); }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-close { display: inline-grid; }
  .mobile-shade { position: fixed; z-index: 6; inset: 0; display: block; background: rgba(32,49,47,.29); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .mobile-shade.is-visible { opacity: 1; pointer-events: auto; }
  .main-panel { height: 100%; padding: 0 16px 14px; }
  .impersonation-banner { inset-inline: 12px; min-height: 40px; font-size: 14px; }
  .impersonation-banner .button { min-height: 30px; padding-inline: 8px; font-size: 14px; }
  .main-panel.is-impersonating .topbar { margin-top: 48px; }
  .topbar { min-height: 68px; gap: 8px; }
  .menu-toggle { display: inline-grid; margin-inline-start: -8px; }
  .topbar-title { flex: 1; }
  .topbar-title .eyebrow { font-size: 14px; }
  .topbar-title strong { font-size: 15px; }
  .topbar-actions { gap: 2px; }
  .top-settings { display: none; }
  .topbar-actions > .icon-button { width: 33px; height: 33px; }
  .admin-nav { min-height: 33px; padding: 0 9px; font-size: 14px; }
  .welcome-view { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 2px; padding: 17px 0 0; }
  .welcome-copy { padding-bottom: 0; }
  .welcome-copy h1 { margin: 10px 0; font-size: clamp(26px, 7.2vw, 36px); line-height: 1.48; }
  .welcome-copy p { margin-bottom: 15px; font-size: 15px; }
  .welcome-copy .button { min-height: 41px; }
  .welcome-art-wrap { min-height: min(35vh, 255px); max-height: 255px; }
  .welcome-art-wrap > img { width: min(80%, 300px); max-height: 245px; }
  .orbit-a { width: 230px; height: 230px; }
  .orbit-b { width: 190px; height: 190px; }
  .floating-note { padding: 7px 9px; font-size: 14px; }
  .note-a { inset-inline-start: 0; }
  .note-b { inset-inline-end: 0; }
  .note-avatar { width: 22px; height: 22px; }
  .welcome-stats { gap: 7px; margin-top: 5px; padding-top: 13px; }
  .welcome-stats div { gap: 4px; }
  .welcome-stats strong { font-size: 14px; }
  .welcome-stats span { max-width: 100px; font-size: 14px; line-height: 1.6; }
  .chat-header { min-height: 63px; }
  .chat-person .avatar { width: 38px; height: 38px; flex-basis: 38px; border-radius: 13px; }
  .message-scroll { padding-top: 14px; }
  .message-bubble { max-width: 86%; padding: 10px 12px 7px; }
  .composer { gap: 7px; min-height: 55px; padding: 7px; border-radius: 16px; }
  .attach-button, .send-button { width: 37px; height: 37px; flex-basis: 37px; }
  .composer textarea { min-height: 37px; padding-block: 9px; font-size: 15px; }
  .chat-footnote { margin-top: 6px; font-size: 14px; }
  .settings-view, .admin-view { padding-top: 20px; }
  .section-heading { margin-bottom: 17px; }
  .section-heading h1 { font-size: 21px; }
  .settings-grid { grid-template-columns: 1fr; gap: 10px; }
  .settings-card { min-height: 0; padding: 16px; border-radius: 17px; }
  .settings-card h2 { margin-top: 10px; font-size: 16px; }
  .password-card { grid-column: auto; }
  .password-card .settings-form { grid-template-columns: 1fr; }
  .password-card .settings-form button, .password-card .form-message { grid-column: auto; }
  .admin-summary { gap: 7px; margin-bottom: 12px; }
  .admin-content { min-height: 0; overflow: visible; border: 0; background: transparent; }
  .admin-table { display: grid; min-width: 0; gap: 9px; }
  .admin-row.admin-header { display: none; }
  .admin-row.admin-user-card { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; min-height: 0; padding: 13px; border: 1px solid #e9ede6; border-radius: 15px; background: #ffffff; font-size: 15px; }
  .admin-user-card .admin-person { grid-column: 1 / -1; }
  .admin-user-card [data-label] { display: grid; gap: 3px; }
  .admin-user-card [data-label]::before { content: attr(data-label); color: #52617a; font-size: 14px; font-weight: 400; }
  .admin-user-card .admin-actions { grid-column: 1 / -1; gap: 14px; padding-top: 8px; border-top: 1px solid #f0f1ed; }
  .admin-user-card .text-button { font-size: 15px; }
  .summary-card { gap: 6px; padding: 11px 9px; border-radius: 13px; }
  .summary-card span { font-size: 14px; }
  .summary-card strong { font-size: 19px; }
  .admin-tab { flex: 1; padding: 0 7px; font-size: 14px; }
  .session-row { grid-template-columns: minmax(0, .9fr) minmax(0, .55fr) minmax(0, .9fr); gap: 7px; padding: 11px 10px; font-size: 14px; }
  .session-row code { overflow-wrap: anywhere; }
  .session-row time { grid-column: 1 / -1; }
  .toast-message { inset-block-end: 16px; }
}
@media (max-width: 390px) {
  .auth-visual { height: 30dvh; }
  .auth-panel { padding-inline: 18px; }
  .auth-heading h2 { font-size: 21px; }
  .profile-strip { gap: 8px; padding-inline: 8px; }
  .profile-strip .avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .admin-pill { padding: 4px 6px; font-size: 14px; }
  .main-panel { padding-inline: 12px; }
  .welcome-stats span { max-width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
