:root {
  --tas-app-topbar-height: 56px;
  color-scheme: light;
  --blue: #0877d1;
  --blue-dark: #075fa8;
  --blue-soft: #e8f4ff;
  --green: #198754;
  --ink: #192a3a;
  --muted: #718096;
  --line: #dfe7ef;
  --panel: #ffffff;
  --surface: #f3f7fb;
  --login-glow: #dcefff;
  --danger: #bb2d3b;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; height: 100vh; background: var(--surface); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 16% 18%, #dcefff, transparent 32%), var(--surface); }
.login-card { width: min(420px, 100%); padding: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 18px 60px #12304b17; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: #fff; background: linear-gradient(145deg, #13a2ef, #0768bc); font-size: 28px; font-weight: 800; box-shadow: 0 8px 20px #0877d133; }
.brand-mark.small { width: 32px; height: 32px; border-radius: 10px; font-size: 18px; }
.brand-mark-image { display: block; width: 32px; height: 32px; flex: 0 0 32px; object-fit: contain; }
.brand-mark-image.small { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
.login-card h1 { margin-bottom: 5px; font-size: 30px; }
.muted { color: var(--muted); }
.stack-form { display: grid; gap: 10px; }
.stack-form label { margin-top: 7px; color: #41556b; font-size: 13px; font-weight: 650; }
.stack-form input, .stack-form select, .user-management-heading input { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); outline: none; }
.stack-form input:focus, .stack-form select:focus, .user-management-heading input:focus, #message-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #0877d11c; }
.primary-button, .send-button { min-height: 42px; padding: 10px 16px; border: 0; border-radius: 10px; color: white; background: var(--blue); font-weight: 700; transition: background .15s ease, transform .15s ease; }
.primary-button:hover, .send-button:hover { background: var(--blue-dark); }
.primary-button:active, .send-button:active { transform: translateY(1px); }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }

.app-view { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 56px; flex: 0 0 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: linear-gradient(100deg, #0798ef, #0878d0); border-bottom: 1px solid #006ebd; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 750; }
.topbar .brand { color: #fff; }
.topbar .brand-mark.small { background: #fff; color: #0878d0; box-shadow: none; }
.topbar-actions, .account-menu, .thread-tools, .button-row { display: flex; align-items: center; gap: 12px; }
.current-user { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: 14px; font-weight: 650; }
.connection-status { display: flex; align-items: center; gap: 7px; color: #e8f5ff; font-size: 12px; }
.connection-status i { width: 8px; height: 8px; border-radius: 50%; background: #d2a222; }
.connection-status.online i { background: #26a269; }
.connection-status.offline i { background: var(--danger); }
.text-button, .quiet-button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #395168; font-weight: 650; }
.text-button:hover, .quiet-button:hover, .icon-button:hover { background: var(--blue-soft); color: var(--blue-dark); }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #51677c; font-size: 19px; }
.topbar .icon-button { color: #fff; }
.topbar .icon-button:hover { background: #ffffff24; color: #fff; }

.chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 304px minmax(0, 1fr); padding: 0; gap: 0; }
.sidebar, .thread, .admin-card { background: var(--panel); border: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.sidebar { min-height: calc(100vh - 56px); display: flex; flex-direction: column; overflow: hidden; border-top: 0; border-left: 0; border-bottom: 0; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; padding: 20px 18px 12px; }
.sidebar-heading h2 { margin: 0; font-size: 19px; }
.sidebar-heading .eyebrow { margin-bottom: 3px; }
.conversation-list, .contact-list { overflow-y: auto; }
.conversation-list { max-height: 46%; }
.conversation-item, .contact-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 13px; border: 0; border-bottom: 1px solid #edf1f5; background: #fff; text-align: left; color: var(--ink); }
.conversation-item:hover, .contact-item:hover { background: #f5faff; }
.conversation-item.active { background: #eaf5ff; box-shadow: inset 3px 0 var(--blue); }
.avatar { position: relative; flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #e0f1ff, #b8dfff); color: #1468a9; font-weight: 800; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.presence-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; background: #aeb8c2; }
.presence-dot.is-online { background: #25a55b; }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-title { display: flex; align-items: center; gap: 5px; font-weight: 680; }
.conversation-preview { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.contacts-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; border-top: 1px solid var(--line); }
.contacts-heading h3 { margin: 0; color: #52677d; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.contacts-actions { display: flex; align-items: center; gap: 7px; }
.small-text-button { padding: 4px 7px; border: 0; border-radius: 7px; background: var(--blue-soft); color: var(--blue-dark); font-size: 11px; font-weight: 700; }
.group-create { display: grid; gap: 8px; padding: 10px 14px; border-top: 1px solid #edf1f5; background: #f8fbfe; }
.group-create label { color: #52677d; font-size: 12px; font-weight: 700; }
.group-create input { min-width: 0; height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.group-members { display: grid; gap: 5px; max-height: 120px; overflow: auto; }
.group-member-option { display: flex; align-items: center; gap: 7px; color: #52677d; font-size: 12px; }
.group-member-option input { width: 15px; height: 15px; }
.count-pill { min-width: 23px; padding: 3px 7px; border-radius: 99px; background: #eef3f8; color: var(--muted); font-size: 11px; text-align: center; }
.contact-list { flex: 1; }
.contact-item { min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
.contact-item .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 13px; }
.contact-name { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.badge { display: inline-grid; place-items: center; flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; color: #fff; font-size: 10px; line-height: 1; }
.badge-blue { background: #1479e6; }
.badge-green { background: #188b58; }
.badge-none { display: none; }

.thread { min-width: 0; min-height: calc(100vh - 56px); position: relative; overflow: hidden; display: flex; flex-direction: column; border: 0; }
.thread-empty { flex: 1; display: grid; align-content: center; justify-items: center; padding: 30px; color: var(--muted); text-align: center; }
.thread-empty h2 { margin: 15px 0 6px; color: var(--ink); font-size: 20px; }
.empty-icon { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; background: var(--blue-soft); color: var(--blue); font-size: 34px; }
.thread-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.thread-header { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.thread-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.thread-person h2 { display: flex; align-items: center; gap: 6px; margin: 0 0 3px; font-size: 16px; }
.thread-person p { margin: 0; font-size: 12px; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 22px clamp(14px, 4vw, 54px); background-color: #f3f6f8; background-image: radial-gradient(#dfe6eb 0.65px, transparent 0.65px); background-size: 14px 14px; }
.message { max-width: min(78%, 680px); margin: 0 0 11px; padding: 10px 13px; border: 1px solid #e0e7ec; border-radius: 12px 12px 12px 4px; background: #fff; box-shadow: 0 1px 3px #18334d12; overflow-wrap: anywhere; }
.message.own { margin-left: auto; border-color: #b9def7; border-radius: 12px 12px 4px 12px; background: #e3f3ff; }
.message-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.message-meta strong { color: #416077; font-size: 12px; }
.message-meta time { margin-left: auto; }
.message-body { margin: 6px 0 0; color: #24384a; font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.message-attachment { margin-top: 8px; }
.message-attachment audio { display: block; width: min(360px, 100%); }
.attachment-image-link { display: inline-flex; max-width: 100%; overflow: hidden; border-radius: 10px; }
.message-image { display: block; width: auto; max-width: min(420px, 100%); max-height: 440px; object-fit: contain; }
.message-video { display: block; width: min(460px, 100%); max-height: 440px; border-radius: 10px; background: #101820; }
.message-attachment a { color: var(--blue-dark); }
.message-status { flex: 0 0 auto; font-size: 13px; font-weight: 800; letter-spacing: -3px; padding-right: 2px; }
.message-status.sent, .message-status.delivered { color: #6d8799; }
.message-status.read { color: var(--blue); }
.composer { display: flex; align-items: center; gap: 7px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.composer .attach-button { cursor: pointer; }
#message-input { flex: 1; min-width: 0; height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; outline: none; }
.send-button { min-height: 40px; padding: 8px 14px; }
.voice-status { min-height: 0; margin: 0; padding: 0 18px 6px; color: var(--muted); font-size: 12px; }
.voice-status.recording { color: var(--danger); font-weight: 700; }
.incoming-call { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-top: 1px solid #cde8d8; background: #effaf4; }
.call-panel { padding: 10px 14px; border-top: 1px solid var(--line); background: #162331; color: #fff; }
.call-videos { min-height: 120px; display: flex; justify-content: center; gap: 10px; }
.call-videos video { width: min(48%, 360px); max-height: 220px; border-radius: 10px; background: #08111a; object-fit: cover; }
.call-videos video:only-of-type { width: 100%; }
.call-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; font-size: 13px; }
.compact { min-height: 34px; padding: 7px 12px; font-size: 13px; }
.danger-button { border: 0; border-radius: 9px; background: var(--danger); color: #fff; font-weight: 700; }

.admin-layout { padding: 26px clamp(16px, 4vw, 52px); }
.admin-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.admin-header h1 { margin-bottom: 6px; font-size: 25px; }
.admin-header p { margin-bottom: 0; }
.admin-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); align-items: start; gap: 16px; }
.admin-card { padding: 20px; }
.admin-card h2 { margin-bottom: 15px; font-size: 17px; }
.user-management-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.user-management-heading h2 { margin: 0 0 4px; }
.user-management-heading p { margin: 0; font-size: 12px; }
.user-management-heading input { max-width: 260px; }
.admin-user-list { display: grid; gap: 8px; margin-top: 16px; }
.admin-user { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(125px, 150px) repeat(4, max-content); align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.admin-user.inactive { opacity: .6; }
.admin-user-name { min-width: 0; }
.admin-user-name strong, .admin-user-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-name span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.admin-user select { min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-user .quiet-button, .admin-user .danger-button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.user-management .admin-user { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 9px; }
.user-management .admin-user-name { flex: 1 1 155px; }
.user-management .admin-user select { flex: 1 1 130px; min-width: 120px; max-width: 150px; }
.user-management .admin-user .quiet-button,
.user-management .admin-user .danger-button,
.user-management .admin-user .witchee-admin-button { flex: 0 0 auto; min-height: 34px; padding: 6px 8px; font-size: 11px; white-space: nowrap; }
.user-management .admin-user .admin-user-promote { border-color: #087a58; background: #087a58; color: #fff; }
.user-management .admin-user .admin-user-promote:hover { border-color: #066747; background: #066747; color: #fff; }
.toast { position: fixed; z-index: 20; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); padding: 12px 15px; border-radius: 10px; background: #1f3447; color: #fff; box-shadow: 0 12px 30px #10243a33; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.empty-note { padding: 18px; color: var(--muted); font-size: 13px; text-align: center; }
.conversation-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: clamp(22px, 5vh, 44px) 20px; color: var(--muted); text-align: center; }
.conversation-empty strong { color: var(--ink); font-size: 15px; }
.conversation-empty > span:not(.conversation-empty-icon) { max-width: 290px; font-size: 13px; line-height: 1.5; }
.conversation-empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--blue-soft); color: var(--blue); }
.conversation-empty-icon .ui-icon { width: 23px; height: 23px; }
.conversation-empty .quiet-button { min-height: 38px; margin-top: 3px; }

/* Admin-managed home artwork, colors, and maintenance screen. */
.login-view {
  background-color: var(--tas-home-color, #071a2d);
  background-image: radial-gradient(ellipse at 16% 18%, color-mix(in srgb, var(--tas-home-color, #071a2d) 48%, #16446a), transparent 48%), linear-gradient(135deg, var(--tas-home-color, #071a2d), color-mix(in srgb, var(--tas-home-color, #071a2d) 78%, #0b4c75));
}
.login-card { background-color: color-mix(in srgb, var(--tas-home-color, #071a2d) 48%, var(--panel)); }
.user-management { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.user-management-heading { flex: 0 0 auto; }
.user-management > .admin-user-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.admin-user-list { scrollbar-gutter: stable; }
.site-control-card { grid-column: 1 / -1; }
.site-customization-form { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 2fr); align-items: center; gap: 9px 14px; max-width: 760px; }
.site-customization-form > label, .site-asset-grid > label { color: var(--muted); font-size: 13px; font-weight: 650; }
.site-customization-form input:not([type="color"]):not([type="checkbox"]), .site-asset-grid input[type="file"] { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); }
.site-customization-form input[type="color"] { width: 76px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.site-customization-form input[type="checkbox"] { width: 21px; min-height: 21px; height: 21px; accent-color: var(--blue); }
.home-emoji-fields { display: flex; flex-wrap: wrap; gap: 7px; }
.home-emoji-fields input { width: 54px !important; min-height: 40px !important; padding: 5px !important; font-size: 22px; text-align: center; }
.site-customization-form .primary-button { grid-column: 1 / -1; justify-self: start; min-width: 180px; }
.site-asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 900px; margin-top: 20px; }
.site-asset-control { display: grid; grid-template-columns: 1fr; gap: 7px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--panel) 85%, transparent); }
.site-asset-control > strong { margin-bottom: 2px; color: var(--ink); font-size: 14px; }
.site-asset-control > label { color: var(--muted); font-size: 12px; font-weight: 650; }
.site-asset-control input[type="file"], .site-asset-control input[type="url"] { width: 100%; min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 12px; }
.site-asset-control input[type="range"] { width: 100%; accent-color: var(--blue); }
.site-asset-control output { color: var(--ink); font-variant-numeric: tabular-nums; }
.maintenance-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.maintenance-controls .quiet-button { border-color: #16865f; background: #08764e; color: white; }
.maintenance-controls .quiet-button:hover { background: #096340; color: white; }
.maintenance-view { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: radial-gradient(ellipse at 50% 0%, #133d5b 0%, transparent 54%), #061522; color: #e7f3fb; }
.maintenance-card { width: min(480px, 100%); padding: clamp(24px, 6vw, 44px); border: 1px solid #24465b; background: linear-gradient(150deg, #0d2232, #071824); text-align: center; box-shadow: 0 24px 80px #0005; }
.maintenance-logo { width: 58px; height: 58px; margin-bottom: 20px; }
.maintenance-card h1 { margin-bottom: 10px; color: #f3f8fc; font-size: clamp(25px, 6vw, 34px); }
.maintenance-card .eyebrow { color: #41c7ff; }
.maintenance-card .muted { margin-bottom: 24px; color: #a9bdcc; line-height: 1.6; }
.maintenance-card .quiet-button { border-color: #29516c; background: #123149; color: #eaf6ff; }
.return-to-maintenance { width: 100%; margin-top: 10px; }
body.maintenance-active { overflow: hidden; }

@media (max-width: 760px) {
  .login-view { background-color: var(--tas-home-color, #071a2d); background-image: linear-gradient(165deg, color-mix(in srgb, var(--tas-home-color, #071a2d) 92%, #0e5482) 0%, var(--tas-home-color, #071a2d) 38%, color-mix(in srgb, var(--tas-home-color, #071a2d) 90%, #000) 100%); }
  .login-card { background-color: transparent; }
  .user-management { height: auto !important; max-height: none; overflow: visible; }
  .user-management > .admin-user-list { flex: initial; max-height: 70vh; overflow-y: auto; }
  .site-control-card { grid-column: auto; }
  .site-customization-form, .site-asset-grid { grid-template-columns: 1fr; }
  .site-customization-form .primary-button { grid-column: auto; width: 100%; }
  .maintenance-view { padding: 16px; }
}

@media (max-width: 760px) {
  body { height: auto; min-height: 100vh; }
  .topbar { height: 56px; padding: 0 12px; }
  .connection-status { display: none; }
  .chat-layout { display: flex; flex-direction: column; min-height: calc(100vh - 56px); padding: 0; gap: 0; }
  .sidebar { min-height: 0; max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list { max-height: 130px; }
  .contact-list { max-height: 100px; }
  .sidebar-heading { padding: 12px 12px 7px; }
  .sidebar-heading h2 { font-size: 16px; }
  .thread { min-height: 58vh; flex: 1; }
  .messages { padding: 14px 10px; }
  .message { max-width: 90%; }
  .thread-header { padding: 10px; }
  .thread-tools { gap: 0; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-header { align-items: flex-start; }
  .user-management-heading { align-items: stretch; flex-direction: column; }
  .user-management-heading input { max-width: none; }
  .user-management .admin-user { display: flex; flex-wrap: wrap; }
  .user-management .admin-user-name,
  .user-management .admin-user select { flex-basis: 100%; max-width: none; }
  .admin-user { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-user-name { grid-column: 1 / -1; }
  .admin-user select { grid-column: 1 / -1; grid-row: 2; }
  .admin-user .witchee-admin-button { grid-column: 1 / 2; grid-row: 3; }
  .admin-user .quiet-button { grid-column: 2 / 3; grid-row: 3; }
  .admin-user .danger-button { grid-column: 1 / -1; grid-row: 4; }
  .login-card { padding: 28px 22px; }
  .current-user { max-width: 110px; }
}

/* Compact message layout and consistent vector controls. */
.ui-icon { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button .ui-icon, label .ui-icon { pointer-events: none; }
.sidebar-heading-actions { display: flex; align-items: center; gap: 3px; }
.sidebar-heading-actions .icon-button { width: 36px; height: 36px; }
.sidebar-search > span { display: grid; place-items: center; width: 19px; height: 19px; flex: 0 0 19px; }
.sidebar-search > span .ui-icon { width: 17px; height: 17px; }
.conversation-list { flex: 1; max-height: none; overflow-x: hidden; }
.contact-list, .contacts-heading { display: none !important; }
.contact-list .contact-item { max-width: 100%; }
.chat-layout { min-width: 0; }
.sidebar { min-width: 0; }
.thread { min-width: 0; }
.messages { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 18px clamp(12px, 2vw, 28px); }
.message { width: fit-content; min-width: 0; max-width: min(78%, 680px); margin: 0; padding: 9px 12px; }
.message:not(.own) { align-self: flex-start; }
.message.own { align-self: flex-end; margin-left: 0; }
.message-meta { min-width: 0; gap: 6px; }
.message-meta time { margin-left: 8px; }
.message-status { margin-left: 1px; }
.message-body { max-width: 100%; }
.message-attachment { min-width: 0; max-width: 100%; }
.message-image { max-width: min(460px, 70vw); }
.message-video { width: min(460px, 70vw); max-width: 100%; }
.thread-tools .ui-icon { width: 19px; height: 19px; }
.back-to-chats .ui-icon { width: 23px; height: 23px; }
.send-button { display: grid; place-items: center; }
.send-button .ui-icon { width: 21px; height: 21px; }
.voice-button .ui-icon { width: 19px; height: 19px; }
.voice-button.recording { background: #d94756; color: #fff !important; animation: record-pulse 1.2s ease-in-out infinite; }
.voice-button.recording:hover { background: #bc3443 !important; }
@keyframes record-pulse { 50% { box-shadow: 0 0 0 5px #d9475628; } }
.voice-status { display: flex; align-items: center; min-height: 0; padding: 0 16px 5px; }
.voice-status:empty { display: none; }
.recording-indicator { width: min(460px, 100%); display: flex; align-items: center; gap: 8px; color: #b63141; font-size: 12px; font-weight: 650; }
.recording-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #d94756; animation: record-pulse 1.2s ease-in-out infinite; }
.recording-indicator time { color: #72899b; font-variant-numeric: tabular-nums; }
.voice-player { width: min(360px, 72vw); max-width: 100%; min-width: min(250px, 70vw); display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 3px 9px; padding: 2px 0; }
.voice-audio-source { display: none; }
.voice-play-button { grid-row: 1 / span 2; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #1686d9; color: #fff; }
.voice-play-button:hover { background: #126eaf; }
.voice-play-button .ui-icon { width: 18px; height: 18px; fill: currentColor; stroke-width: 1.2; }
.voice-waveform { min-width: 0; height: 25px; display: flex; align-items: center; justify-content: space-between; gap: 2px; overflow: hidden; }
.voice-player .voice-waveform { cursor: pointer; }
.wave-bar { display: block; width: 3px; min-width: 2px; max-height: 22px; flex: 1 1 2px; border-radius: 3px; background: #9db5c5; transition: background-color .12s ease; }
.wave-bar.played { background: #1686d9; }
.wave-bar.h1 { height: 4px; }
.wave-bar.h2 { height: 7px; }
.wave-bar.h3 { height: 11px; }
.wave-bar.h4 { height: 16px; }
.wave-bar.h5 { height: 22px; }
.voice-duration { grid-column: 2; color: #71899a; font-size: 10px; line-height: 1; font-variant-numeric: tabular-nums; }
.recording-waveform { height: 21px; flex: 1; }
.recording-waveform .wave-bar { background: #dc7b84; }
.recording-waveform .wave-bar-animated { animation: voice-wave 520ms ease-in-out infinite alternate; }
.recording-waveform .wave-bar:nth-child(3n) { animation-delay: 100ms; }
.recording-waveform .wave-bar:nth-child(4n) { animation-delay: 220ms; }
@keyframes voice-wave { to { transform: scaleY(.42); opacity: .65; } }

@media (max-width: 760px) {
  .app-view.thread-mode .mobile-tabs { display: none; }
  .chat-layout:not(.conversation-open) .contact-list { display: none !important; }
  body[data-mobile-section="status"] .chat-layout:not(.conversation-open) .contact-list,
  body[data-mobile-section="calls"] .chat-layout:not(.conversation-open) .contact-list { display: flex !important; flex-direction: column; max-height: none; flex: 1; overflow-y: auto; }
  .conversation-list { max-height: none; }
  .messages { gap: 8px; padding: 12px 9px; }
  .message { max-width: 86%; padding: 8px 10px; }
  .message-image { max-width: min(350px, 74vw); }
  .message-video { width: min(350px, 74vw); }
  .voice-player { width: min(320px, 73vw); min-width: min(230px, 70vw); }
  .sidebar-heading-actions .icon-button { width: 34px; }
  .contact-call-item { width: 100%; }
}

/* New branded entry, account header, responsive media and real settings dialogs. */
:root { --blue: #1284d4; --blue-dark: #086bb3; --blue-soft: #e8f5ff; }
.login-view {
  width: min(1280px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: center;
  justify-items: stretch;
  gap: clamp(26px, 6vw, 84px);
  padding: clamp(22px, 5vw, 66px);
  background: radial-gradient(ellipse at 5% 15%, #d9edff 0, transparent 42%), var(--surface);
}
body.login-active { height: auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
.login-active .login-view { overflow: visible; }
.login-hero {
  position: relative;
  width: 100%;
  min-width: 0;
  height: min(78vh, 760px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.login-people { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.hero-caption { position: absolute; right: 22px; bottom: 20px; left: 22px; display: flex; align-items: center; gap: 12px; max-width: max-content; padding: 12px 16px; border: 1px solid #ffffffa8; border-radius: 17px; background: #fafdffdc; box-shadow: 0 10px 28px #16476a18; backdrop-filter: blur(10px); }
.hero-caption div { display: grid; gap: 3px; }
.hero-caption strong { color: #19425f; font-size: 14px; }
.hero-caption span { color: #69839a; font-size: 12px; }
.hero-emoji { position: absolute; z-index: 2; display: grid; place-items: center; width: 54px; height: 54px; border: 1px solid #ffffffc9; border-radius: 42%; background: #ffffffdf; box-shadow: 0 12px 30px #1e63902c; font-size: 27px; animation: float-emoji 4.8s ease-in-out infinite; }
.hero-emoji-one { top: 8%; left: 2%; width: 66px; height: 66px; font-size: 33px; }
.hero-emoji-two { top: 14%; right: 2%; width: 42px; height: 42px; font-size: 22px; animation-delay: -1.6s; }
.hero-emoji-three { bottom: 8%; left: 48%; width: 56px; height: 56px; font-size: 28px; animation-delay: -3s; }
.hero-floating-sticker-link { position: absolute; z-index: 3; top: 38%; right: 0; display: block; width: clamp(48px, 6vw, 70px); filter: drop-shadow(0 8px 16px #0c416344); animation: float-sticker 5.8s ease-in-out infinite; animation-delay: -2.2s; }
.hero-floating-sticker-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.hero-floating-sticker { display: block; width: 100%; height: auto; object-fit: contain; }
.hero-service-logo { position: absolute; z-index: 4; display: block; animation: float-sticker 5.4s ease-in-out infinite; }
.hero-service-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hero-service-logo-t { top: 61%; left: 2%; width: clamp(34px, 4.5vw, 48px); height: clamp(34px, 4.5vw, 48px); padding: 4px; border: 1px solid #1d3949; border-radius: 12px; background: #030506; animation-delay: -1.1s; }
.hero-service-logo-location { top: calc(50% - 38px); left: calc(50% - 38px); width: 76px; height: 76px; animation-delay: -3.1s; }
.hero-service-logo:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
@keyframes float-emoji { 50% { transform: translateY(-9px) rotate(4deg); } }
@keyframes float-sticker { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-11px) rotate(3deg); } }
.login-card { width: 100%; padding: clamp(26px, 4vw, 40px); border-radius: 24px; }
.login-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 30px; color: #1d3c56; text-decoration: none; font-size: 19px; font-weight: 800; }
.login-logo-mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 13px; font-size: 24px; }
.brand-mark-image.login-logo-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
.brand-wordmark { color: inherit; font-size: 19px; font-weight: 800; letter-spacing: -.035em; white-space: nowrap; }
.chat-word { color: var(--blue); }
.login-card h1 { margin-bottom: 7px; font-size: clamp(26px, 3vw, 34px); }
.login-card > .muted { margin-bottom: 23px; font-size: 14px; }
.login-secondary { width: 100%; min-height: 42px; }
.register-prompt { display: grid; gap: 9px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.recovery-box { margin-top: 15px; color: var(--blue-dark); font-size: 13px; }
.recovery-box summary { width: fit-content; cursor: pointer; }
.recovery-box .stack-form { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.recovery-result { display: grid; gap: 10px; padding: 13px; border: 1px solid #b6dff8; border-radius: 12px; background: #eef8ff; overflow-wrap: anywhere; }
.recovery-result p { margin: 0; color: #315a77; font-size: 12px; }
.recovery-result code { padding: 9px; border-radius: 8px; background: #fff; color: #153a55; font-size: 14px; user-select: all; }
.small-copy { margin: 0; font-size: 12px; }
.brand-logo { display: block; width: 142px; height: 34px; flex: 0 0 142px; object-fit: contain; }
.topbar { background: #eaf6ff; color: #24455f; border-color: #cfe6f7; }
.topbar .brand { color: #17354d; }
.topbar .icon-button { color: #42647f; }
.topbar .icon-button:hover { background: #dcefff; color: var(--blue-dark); }
.sidebar-account { display: flex; align-items: center; gap: 10px; min-height: 68px; padding: 12px 17px 8px; border-bottom: 1px solid #eef3f7; }
.account-avatar { width: 42px; height: 42px; flex-basis: 42px; font-size: 13px; }
.sidebar-account-copy { min-width: 0; display: grid; gap: 3px; }
.sidebar-account-name { display: flex; align-items: center; gap: 5px; min-width: 0; color: #17354d; font-size: 14px; }
.sidebar-account-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-info { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-heading { padding-top: 12px; }
.badge { width: 16px; height: 16px; font-size: 11px; font-weight: 800; box-shadow: 0 1px 2px #0b4d8924; }
.thread-person h2, #contact-panel-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.message-save { width: 24px; height: 24px; flex: 0 0 24px; padding: 0; color: #98a9b7; }
.message-save .ui-icon { width: 15px; height: 15px; }
.message-save.is-saved { color: #0d7bc6; }
.message-video { width: auto; height: auto; max-width: min(520px, 70vw); max-height: min(72vh, 720px); object-fit: contain; background: #111c24; }
.message-image { max-width: min(520px, 70vw); max-height: min(72vh, 720px); }
.message { position: relative; overflow: visible; border-radius: 14px 14px 14px 4px; padding-bottom: 8px; }
.message.own { border-radius: 14px 14px 4px 14px; }
.message:not(.own)::before, .message.own::before { position: absolute; bottom: 0; width: 12px; height: 12px; content: ""; filter: drop-shadow(0 1px 0 #dce7ef); }
.message:not(.own)::before { left: -6px; background: #fff; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.message.own::before { right: -6px; background: #e1f2ff; clip-path: polygon(0 0, 0 100%, 100% 100%); filter: drop-shadow(1px 1px 0 #b8def7); }
.message-meta { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.message-heading { display: flex; align-items: center; gap: 6px; min-width: 0; }
.message-heading .message-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-heading .message-save { margin-left: auto; }
.message-footer { display: flex; justify-content: flex-end; align-items: center; gap: 5px; min-height: 14px; color: var(--muted); font-size: 10px; }
.message-footer time { margin-left: 0; }

/* Resolve one palette for the login, chat, contact and admin surfaces. */
html[data-theme-resolved="dark"] {
  color-scheme: dark;
  --ink: #e8f1f7;
  --muted: #adc0ce;
  --line: #2b4355;
  --panel: #111f2c;
  --surface: #0a1520;
  --login-glow: #153451;
  --blue-soft: #15354d;
  --blue-dark: #85ceff;
}
html[data-theme-resolved="dark"] body,
html[data-theme-resolved="dark"] .login-view,
html[data-theme-resolved="dark"] .admin-layout { background-color: var(--surface); background-image: none; color: var(--ink); }
html[data-theme-resolved="dark"] .login-view { background-image: radial-gradient(ellipse at 5% 15%, #153451 0, transparent 42%); }
html[data-theme-resolved="dark"] .login-card,
html[data-theme-resolved="dark"] .app-dialog,
html[data-theme-resolved="dark"] .sidebar,
html[data-theme-resolved="dark"] .thread,
html[data-theme-resolved="dark"] .contact-panel,
html[data-theme-resolved="dark"] .admin-card,
html[data-theme-resolved="dark"] .mobile-tabs { background: var(--panel); color: var(--ink); border-color: var(--line); }
html[data-theme-resolved="dark"] .topbar,
html[data-theme-resolved="dark"] .thread-header,
html[data-theme-resolved="dark"] .contact-panel-header,
html[data-theme-resolved="dark"] .composer,
html[data-theme-resolved="dark"] .message-search-bar { background: #101c28; color: var(--ink); border-color: var(--line); }
html[data-theme-resolved="dark"] .login-card h1,
html[data-theme-resolved="dark"] .admin-header h1,
html[data-theme-resolved="dark"] .admin-card h2,
html[data-theme-resolved="dark"] .contact-panel-header h2,
html[data-theme-resolved="dark"] .contact-profile h3,
html[data-theme-resolved="dark"] .thread-person h2,
html[data-theme-resolved="dark"] .dialog-heading h2,
html[data-theme-resolved="dark"] .dialog-section h3,
html[data-theme-resolved="dark"] .message-body,
html[data-theme-resolved="dark"] .message-meta strong,
html[data-theme-resolved="dark"] .admin-user-name strong { color: var(--ink); }
html[data-theme-resolved="dark"] .muted,
html[data-theme-resolved="dark"] .thread-person p,
html[data-theme-resolved="dark"] .conversation-preview,
html[data-theme-resolved="dark"] .sidebar-account-info,
html[data-theme-resolved="dark"] .admin-user-name span,
html[data-theme-resolved="dark"] .panel-value,
html[data-theme-resolved="dark"] .message-footer { color: var(--muted); }
html[data-theme-resolved="dark"] .eyebrow,
html[data-theme-resolved="dark"] .recovery-box,
html[data-theme-resolved="dark"] .contact-panel-section > h3,
html[data-theme-resolved="dark"] .panel-icon,
html[data-theme-resolved="dark"] .search-results-label { color: #79c9ff; }
html[data-theme-resolved="dark"] .login-brand,
html[data-theme-resolved="dark"] .topbar .brand,
html[data-theme-resolved="dark"] .sidebar-account-name,
html[data-theme-resolved="dark"] .current-user,
html[data-theme-resolved="dark"] .connection-status,
html[data-theme-resolved="dark"] .conversation-item,
html[data-theme-resolved="dark"] .contact-item,
html[data-theme-resolved="dark"] .panel-row,
html[data-theme-resolved="dark"] .contact-open { color: var(--ink); }
html[data-theme-resolved="dark"] .stack-form label,
html[data-theme-resolved="dark"] .dialog-section label { color: #c3d3de; }
html[data-theme-resolved="dark"] .stack-form input,
html[data-theme-resolved="dark"] .stack-form select,
html[data-theme-resolved="dark"] .dialog-section input,
html[data-theme-resolved="dark"] .dialog-section select,
html[data-theme-resolved="dark"] .user-management-heading input,
html[data-theme-resolved="dark"] .admin-user select,
html[data-theme-resolved="dark"] .sidebar-search,
html[data-theme-resolved="dark"] .sidebar-search input,
html[data-theme-resolved="dark"] #message-input,
html[data-theme-resolved="dark"] .action-notes,
html[data-theme-resolved="dark"] .action-list-input { background: #0b1824; color: var(--ink); border-color: var(--line); }
html[data-theme-resolved="dark"] input::placeholder,
html[data-theme-resolved="dark"] textarea::placeholder { color: #9cb1c0; opacity: 1; }
html[data-theme-resolved="dark"] .quiet-button,
html[data-theme-resolved="dark"] .text-button,
html[data-theme-resolved="dark"] .small-text-button,
html[data-theme-resolved="dark"] .list-chip button { background: #193247; color: #e7f3fb; border-color: #35536a; }
html[data-theme-resolved="dark"] .quiet-button:hover,
html[data-theme-resolved="dark"] .text-button:hover,
html[data-theme-resolved="dark"] .small-text-button:hover,
html[data-theme-resolved="dark"] .list-chip button:hover { background: #224560; color: #fff; }
html[data-theme-resolved="dark"] .icon-button { color: #c4d5e0; }
html[data-theme-resolved="dark"] .primary-button,
html[data-theme-resolved="dark"] .send-button,
html[data-theme-resolved="dark"] .voice-button { background: #087fc8; color: #fff; }
html[data-theme-resolved="dark"] .conversation-item,
html[data-theme-resolved="dark"] .contact-item { background: var(--panel); border-color: #263b4c; }
html[data-theme-resolved="dark"] .conversation-item:hover,
html[data-theme-resolved="dark"] .contact-item:hover { background: #172b3b; }
html[data-theme-resolved="dark"] .conversation-item.active { background: #15334a; box-shadow: inset 3px 0 #45aaf0; }
html[data-theme-resolved="dark"] .sidebar-account,
html[data-theme-resolved="dark"] .contact-profile,
html[data-theme-resolved="dark"] .contact-panel-section,
html[data-theme-resolved="dark"] .panel-row,
html[data-theme-resolved="dark"] .admin-user { border-color: var(--line); }
html[data-theme-resolved="dark"] .contact-profile,
html[data-theme-resolved="dark"] .contact-panel-section { border-bottom-color: #1b2b39; }
html[data-theme-resolved="dark"] .panel-row:hover { background: #172b3b; color: #e9f5fc; }
html[data-theme-resolved="dark"] .messages { background-color: #0b1722; background-image: radial-gradient(#263b4b .65px, transparent .65px); }
html[data-theme-resolved="dark"] .message { background: #142433; border-color: #2a4051; color: var(--ink); }
html[data-theme-resolved="dark"] .message.own { background: #15344b; border-color: #24557a; }
html[data-theme-resolved="dark"] .message:not(.own)::before { background: #142433; filter: drop-shadow(0 1px 0 #2a4051); }
html[data-theme-resolved="dark"] .message.own::before { background: #15344b; filter: drop-shadow(1px 1px 0 #24557a); }
html[data-theme-resolved="dark"] .message-status.sent,
html[data-theme-resolved="dark"] .message-status.delivered { color: #bfced9; }
html[data-theme-resolved="dark"] .message-status.read,
html[data-theme-resolved="dark"] .message-attachment a { color: #7acaff; }
html[data-theme-resolved="dark"] .contact-call-actions .icon-button,
html[data-theme-resolved="dark"] .thread-tools .icon-button,
html[data-theme-resolved="dark"] .composer .icon-button,
html[data-theme-resolved="dark"] .topbar .icon-button { color: #c2d4e0; }
html[data-theme-resolved="dark"] .thread-tools .icon-button:hover,
html[data-theme-resolved="dark"] .thread-header .icon-button:hover,
html[data-theme-resolved="dark"] .topbar .icon-button:hover { background: #20384a; color: #fff; }
html[data-theme-resolved="dark"] .contact-profile,
html[data-theme-resolved="dark"] .contact-panel-section { background-color: var(--panel); }
html[data-theme-resolved="dark"] .shared-media-grid a,
html[data-theme-resolved="dark"] .shared-media-grid img,
html[data-theme-resolved="dark"] .shared-media-grid video,
html[data-theme-resolved="dark"] .admin-user { background-color: #122231; }
html[data-theme-resolved="dark"] .mobile-tab { color: #a9bfce; }
html[data-theme-resolved="dark"] .mobile-tab.active { color: #7acaff; }
html[data-theme-resolved="dark"] .count-pill { background: #203548; color: #d3e2ec; }
html[data-theme-resolved="dark"] .voice-duration,
html[data-theme-resolved="dark"] .recording-indicator time { color: #b6c7d2; }
html[data-theme-resolved="dark"] .recording-indicator { color: #ff9aa5; }
html[data-theme-resolved="dark"] .recovery-result { background: #132a3c; border-color: #294e6b; }
html[data-theme-resolved="dark"] .recovery-result p { color: #d5e7f2; }
html[data-theme-resolved="dark"] .recovery-result code,
html[data-theme-resolved="dark"] .security-setup code { background: #0b1824; color: #e8f1f7; }
html[data-theme-resolved="dark"] .hero-caption { background: #102638e8; border-color: #3c5c72; }
html[data-theme-resolved="dark"] .hero-caption strong { color: #f0f7fc; }
html[data-theme-resolved="dark"] .hero-caption span { color: #c1d3df; }
html[data-theme-resolved="dark"] .hero-emoji { background: #152a3bde; border-color: #385368; }
html[data-theme-resolved="dark"] .admin-user-list .admin-user { color: var(--ink); }
html[data-theme-resolved="dark"] .message-search-bar input { background: #0b1824; color: var(--ink); border-color: var(--line); }
html[data-theme-resolved="dark"] .text-button:disabled,
html[data-theme-resolved="dark"] .quiet-button:disabled { color: #91a5b4; }
html[data-theme-resolved="dark"] .group-create { background: #111f2c; border-color: var(--line); }
html[data-theme-resolved="dark"] .group-create label,
html[data-theme-resolved="dark"] .group-member-option { color: #c3d3de; }
html[data-theme-resolved="dark"] .group-create input { background: #0b1824; color: var(--ink); border-color: var(--line); }
html[data-theme-resolved="dark"] .incoming-call { background: #11291f; border-color: #28573f; color: #d9f4e4; }
html[data-theme-resolved="dark"] .voice-waveform .wave-bar { background: #67849a; }
html[data-theme-resolved="dark"] .voice-waveform .wave-bar.played { background: #68c5ff; }
html[data-theme-resolved="dark"] .form-error { color: #ff9ba5; }
.message-footer .message-status { font-size: 12px; }
.contact-panel { min-width: 0; }
.contact-panel-section { min-width: 0; }
.panel-row { min-width: 0; flex-wrap: wrap; }
.panel-row > span:nth-child(2) { min-width: 0; flex: 1 1 150px; overflow-wrap: anywhere; }
.panel-value { max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
.shared-media-grid video { object-fit: contain; }
.app-dialog { width: min(560px, calc(100vw - 28px)); max-height: min(88dvh, 850px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 80px #10243a55; }
.app-dialog::backdrop { background: #0d1b29a8; backdrop-filter: blur(3px); }
.dialog-heading { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dialog-heading .eyebrow { margin-bottom: 3px; }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.dialog-section { display: grid; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dialog-section h3 { margin: 0; font-size: 15px; }
.dialog-section > p { margin: 0; }
.dialog-section label { color: var(--muted); font-size: 12px; font-weight: 650; }
.dialog-section select, .dialog-section input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); }
.security-setup { display: grid; gap: 10px; padding: 13px; border: 1px solid #b6dff8; border-radius: 12px; background: var(--blue-soft); }
.security-setup p { margin: 0; font-size: 12px; }
.security-setup code { display: block; max-height: 130px; padding: 10px; overflow: auto; border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 11px; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
.security-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.passkey-list { display: grid; gap: 7px; }
.passkey-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.security-footnote { margin: 0; padding: 14px 20px 18px; color: var(--muted); font-size: 11px; }
.saved-dialog { width: min(620px, calc(100vw - 28px)); }
.saved-message-list { display: grid; gap: 8px; padding: 16px 20px 22px; }
.saved-message-item { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.saved-message-item strong { font-size: 13px; }
.saved-message-item p { margin: 6px 0; overflow-wrap: anywhere; }
.saved-message-item time { color: var(--muted); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 13px 20px 18px; }
.action-notes { width: 100%; min-height: 160px; resize: vertical; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); font: inherit; line-height: 1.45; }
.action-list-input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); }
.list-chip-area { display: grid; gap: 7px; }
.list-chip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; }
.list-chip button { border: 0; border-radius: 8px; padding: 6px 9px; background: var(--blue-soft); color: var(--blue-dark); font-size: 11px; font-weight: 700; }
.storage-total { color: var(--blue-dark); font-size: clamp(24px, 7vw, 38px); }

@media (min-width: 761px) and (max-width: 1100px) {
  .chat-layout.contact-open { position: relative; grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); }
  .chat-layout.contact-open .contact-panel { position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; width: min(400px, 44vw); box-shadow: -18px 0 40px #20394c20; }
}
@media (min-width: 1101px) {
  .chat-layout.contact-open { grid-template-columns: minmax(270px, 310px) minmax(0, 1fr) minmax(330px, 390px); }
}
@media (max-width: 760px) {
  .login-view { min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-start; gap: 0; padding: 0; }
  .login-view { background: var(--panel); }
  .login-hero { width: 100%; height: auto; aspect-ratio: 3 / 2; min-height: 0; flex: 0 0 auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .login-people { object-fit: contain; object-position: center; }
  .hero-caption { display: none; }
  .hero-caption { right: 12px; bottom: 12px; left: 12px; gap: 8px; padding: 8px 11px; }
  .hero-caption img { width: 31px; height: 31px; }
  .hero-caption strong { font-size: 12px; }
  .hero-caption span { font-size: 10px; }
  .hero-emoji { z-index: 2; display: grid; border-radius: 42%; }
  .hero-emoji-one { top: 8%; left: 2%; width: 48px; height: 48px; font-size: 25px; }
  .hero-emoji-two { top: 12%; right: 2%; width: 34px; height: 34px; font-size: 18px; }
  .hero-emoji-three { top: auto; bottom: 2%; left: 47%; width: 40px; height: 40px; font-size: 21px; }
  .hero-floating-sticker-link { top: 38%; right: 1%; width: 48px; }
  .login-card { width: 100%; min-height: 0; flex: 1; margin-top: 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .login-brand { margin-bottom: 19px; }
  .login-card > .muted { margin-bottom: 16px; }
  .login-card h1 { font-size: 27px; }
  .topbar .brand { gap: 7px; font-size: 14px; }
  .brand-logo { width: 118px; height: 29px; flex-basis: 118px; }
  .sidebar-account { min-height: 64px; padding: 8px 14px 6px; }
  .account-avatar { width: 40px; height: 40px; flex-basis: 40px; }
  .sidebar-heading { padding-top: 10px; }
  .message-video { width: auto; height: auto; max-width: min(100%, 84vw); max-height: 54dvh; }
  .message-image { max-width: min(100%, 84vw); max-height: 54dvh; }
  .contact-panel { z-index: 8; padding-bottom: env(safe-area-inset-bottom); }
  .contact-profile { padding: 19px 14px 15px; }
  .large-avatar { width: 78px; height: 78px; }
  .contact-panel-section { padding: 10px 14px; }
  .panel-row { min-height: 45px; gap: 9px; font-size: 12px; }
  .panel-value { max-width: 40%; }
  .shared-media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dialog-heading, .dialog-section { padding-right: 16px; padding-left: 16px; }
  .dialog-actions { padding-right: 16px; padding-left: 16px; }
  .passkey-item { align-items: flex-start; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e5eef5; --muted: #9fb1c0; --line: #2a3d4f; --panel: #111e2b; --surface: #0b1520; --blue-soft: #153047;
}
html[data-theme="dark"] body, html[data-theme="dark"] .login-view { background-color: var(--surface); color: var(--ink); }
html[data-theme="dark"] .login-view { background-image: radial-gradient(ellipse at 5% 15%, #153451 0, transparent 42%); }
html[data-theme="dark"] .login-hero { border-color: #294d69; background: linear-gradient(150deg, #122d42, #1b3b54); }
html[data-theme="dark"] .login-card, html[data-theme="dark"] .app-dialog { background: var(--panel); color: var(--ink); }
html[data-theme="dark"] .login-brand, html[data-theme="dark"] .sidebar-account-name { color: #e4f2fb; }
html[data-theme="dark"] .stack-form label { color: #b6c7d4; }
html[data-theme="dark"] .stack-form input, html[data-theme="dark"] .stack-form select, html[data-theme="dark"] .dialog-section input, html[data-theme="dark"] .dialog-section select { background: #0c1722; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .topbar, html[data-theme="dark"] .thread-header, html[data-theme="dark"] .composer, html[data-theme="dark"] .contact-panel-header { background: #101c28; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .topbar .brand { color: var(--ink); }
html[data-theme="dark"] .topbar .icon-button { color: #c0d1df; }
html[data-theme="dark"] .sidebar, html[data-theme="dark"] .thread, html[data-theme="dark"] .contact-panel { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .conversation-item, html[data-theme="dark"] .contact-item { background: var(--panel); color: var(--ink); border-color: #243747; }
html[data-theme="dark"] .conversation-item:hover, html[data-theme="dark"] .contact-item:hover { background: #172b3b; }
html[data-theme="dark"] .conversation-item.active { background: #16334a; }
html[data-theme="dark"] .sidebar-search, html[data-theme="dark"] #message-input { background: #0c1722; color: var(--ink); }
html[data-theme="dark"] .messages { background-color: #0c1722; background-image: radial-gradient(#253747 .65px, transparent .65px); }
html[data-theme="dark"] .message { background: #142433; border-color: #2a4051; }
html[data-theme="dark"] .message.own { background: #15344b; border-color: #24557a; }
html[data-theme="dark"] .message:not(.own)::before { background: #142433; filter: drop-shadow(0 1px 0 #2a4051); }
html[data-theme="dark"] .message.own::before { background: #15344b; filter: drop-shadow(1px 1px 0 #24557a); }
html[data-theme="dark"] .message-body, html[data-theme="dark"] .message-meta strong, html[data-theme="dark"] .panel-row { color: #deebf4; }
html[data-theme="dark"] .panel-row { border-color: #26394a; }
html[data-theme="dark"] .panel-row:hover { background: #172b3b; }
html[data-theme="dark"] .contact-profile, html[data-theme="dark"] .contact-panel-section { border-color: #1b2b39; }
html[data-theme="dark"] .shared-media-grid a, html[data-theme="dark"] .shared-media-grid img, html[data-theme="dark"] .shared-media-grid video { background: #0c1722; }
html[data-theme="dark"] .dialog-section select, html[data-theme="dark"] .dialog-section input, html[data-theme="dark"] .security-setup code, html[data-theme="dark"] .recovery-result code { background: #0c1722; color: var(--ink); }
html[data-theme="dark"] .recovery-result { background: #132a3c; border-color: #294e6b; }
html[data-theme="dark"] .mobile-tabs { background: var(--panel); }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] { color-scheme: dark; --ink: #e5eef5; --muted: #9fb1c0; --line: #2a3d4f; --panel: #111e2b; --surface: #0b1520; --blue-soft: #153047; }
  html[data-theme="system"] body { background: var(--surface); color: var(--ink); }
  html[data-theme="system"] .topbar, html[data-theme="system"] .thread-header, html[data-theme="system"] .composer { background: #101c28; color: var(--ink); border-color: var(--line); }
  html[data-theme="system"] .sidebar, html[data-theme="system"] .thread, html[data-theme="system"] .contact-panel, html[data-theme="system"] .login-card, html[data-theme="system"] .app-dialog { background: var(--panel); color: var(--ink); }
  html[data-theme="system"] .conversation-item, html[data-theme="system"] .contact-item { background: var(--panel); color: var(--ink); border-color: #243747; }
  html[data-theme="system"] .messages { background-color: #0c1722; background-image: radial-gradient(#253747 .65px, transparent .65px); }
  html[data-theme="system"] .message { background: #142433; border-color: #2a4051; }
  html[data-theme="system"] .message.own { background: #15344b; border-color: #24557a; }
  html[data-theme="system"] .message:not(.own)::before { background: #142433; }
  html[data-theme="system"] .message.own::before { background: #15344b; }
}

/* Updated TAS Chat workspace: soft-blue desktop panels and mobile-first navigation. */
:root {
  --blue: #1686d9;
  --blue-dark: #126eaf;
  --blue-soft: #e8f5ff;
  --line: #d9e6f1;
  --surface: #f3f8fc;
}
body, .app-view { height: 100dvh; min-height: 0; overflow: hidden; }
.topbar { background: #eaf6ff; border-bottom: 1px solid #cfe6f7; color: var(--ink); }
.topbar .brand { color: #17354d; }
.topbar .brand-mark.small { background: linear-gradient(145deg, #24a0ed, #0b70bf); color: #fff; }
.topbar .icon-button { color: #42647f; }
.current-user { color: #294b65; }
.connection-status { color: #496880; }
.text-button { border-color: #cfe2f0; color: #24516f; }
.mobile-tabs { display: none; }
.chat-layout { grid-template-columns: minmax(285px, 330px) minmax(0, 1fr); height: calc(100dvh - 56px); min-height: 0; overflow: hidden; background: #edf4f9; }
.chat-layout.contact-open { grid-template-columns: minmax(275px, 310px) minmax(0, 1fr) minmax(280px, 330px); }
.sidebar, .thread, .contact-panel { min-height: 0; height: 100%; border: 0; border-right: 1px solid var(--line); background: #fff; }
.sidebar { border-right: 1px solid var(--line); }
.sidebar-heading { padding: 19px 18px 10px; }
.sidebar-search { display: flex; align-items: center; gap: 9px; margin: 0 14px 10px; padding: 0 12px; height: 40px; border-radius: 12px; background: #f0f5f9; color: #57809c; }
.sidebar-search span { font-size: 22px; line-height: 1; }
.sidebar-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.mobile-section-label { display: none; }
.conversation-list { max-height: min(48%, 410px); }
.conversation-item, .contact-item { padding: 10px 14px; }
.conversation-item.active { background: #e7f4fd; box-shadow: inset 3px 0 #1585d5; }
.conversation-title { font-size: 14px; }
.contact-list { min-height: 0; }
.thread { border-right: 1px solid var(--line); background: #fff; }
.thread-header { min-height: 68px; padding: 10px 16px; }
.thread-person { flex: 1; }
.thread-person > .avatar { width: 44px; height: 44px; flex-basis: 44px; }
.thread-person h2 { font-size: 15px; }
.thread-tools { gap: 4px; }
.thread-tools .icon-button { width: 40px; height: 40px; border-radius: 50%; color: #42677f; }
.thread-tools .icon-button:hover, .thread-header .icon-button:hover { background: #e9f5fd; }
.back-to-chats { display: none; }
.messages { background-color: #f5f9fc; background-image: radial-gradient(#dceaf4 .65px, transparent .65px); }
.message { max-width: min(80%, 660px); border-color: #e0eaf2; border-radius: 14px 14px 14px 5px; box-shadow: 0 2px 8px #2447650b; }
.message.own { border-color: #b8def7; background: #e1f2ff; border-radius: 14px 14px 5px 14px; }
.message-body { color: #233f54; }
.composer { gap: 5px; padding: 10px 13px calc(10px + env(safe-area-inset-bottom)); }
.composer .icon-button { color: #57809c; }
.composer .attach-button { width: 38px; font-size: 22px; }
#message-input { border: 0; border-radius: 20px; background: #f0f5f9; padding: 10px 15px; }
.send-button { width: 42px; height: 42px; min-height: 42px; padding: 0; border-radius: 50%; font-size: 20px; }
.voice-button { background: var(--blue); color: white !important; border-radius: 50%; }
.voice-button:hover { background: var(--blue-dark) !important; color: white !important; }
.contact-panel { display: flex; flex-direction: column; overflow: auto; border-left: 1px solid var(--line); border-right: 0; }
.contact-panel-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 13px; background: #fff; border-bottom: 1px solid var(--line); }
.contact-panel-header h2 { margin: 0; font-size: 15px; }
.contact-profile { display: grid; justify-items: center; padding: 25px 16px 19px; border-bottom: 8px solid #f3f7fa; text-align: center; }
.contact-profile[hidden], #direct-contact-info[hidden], #group-info-section[hidden], .group-info-management[hidden] { display: none !important; }
.group-info-section { display: grid; align-content: start; }
.group-info-summary { display: flex; align-items: center; gap: 14px; padding: 22px 16px; border-bottom: 8px solid #f3f7fa; }
.group-info-summary .large-avatar { flex: 0 0 auto; }
.group-info-summary h3 { margin: 0 0 5px; font-size: 18px; overflow-wrap: anywhere; }
.group-info-summary p { margin: 0; font-size: 12px; }
.group-info-management > h3:not(:first-child) { margin-top: 18px; }
.group-current-members { display: grid; gap: 4px; max-height: 42dvh; overflow: auto; }
.group-current-member { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 2px; }
.group-current-member .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
.group-current-member-name { min-width: 0; flex: 1; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.group-current-member small { color: var(--muted); font-size: 10px; }
.large-avatar { width: 94px; height: 94px; font-size: 26px; }
.contact-profile h3 { margin: 12px 0 4px; font-size: 18px; }
.contact-profile p { margin: 0; font-size: 12px; }
.contact-panel-section { padding: 13px 15px; border-bottom: 8px solid #f3f7fa; }
.contact-panel-section > h3 { margin: 0 0 8px; color: #187cae; font-size: 12px; }
.panel-row { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 8px 3px; border: 0; border-bottom: 1px solid #edf1f4; background: transparent; color: #27465c; text-align: left; font-size: 13px; }
.panel-row:last-child { border-bottom: 0; }
.panel-row:hover { color: var(--blue-dark); background: #f6fbff; }
.panel-row:disabled { opacity: .42; cursor: not-allowed; }
.contact-call-item { cursor: default; }
.contact-open { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.contact-call-actions { display: flex; gap: 2px; }
.contact-call-actions .icon-button { width: 34px; height: 34px; color: #4a7895; }
.messages.plain-wallpaper { background-image: none; background-color: #eaf5fc; }
.message[hidden] { display: none !important; }
.panel-icon { width: 26px; flex: 0 0 26px; color: #1686d9; font-size: 19px; text-align: center; }
.panel-value { margin-left: auto; color: #8193a1; white-space: nowrap; font-size: 12px; }
.shared-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.shared-media-grid a, .shared-media-grid img, .shared-media-grid video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: #edf4f8; }
.message-search-bar { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.message-search-bar input { flex: 1; min-width: 0; height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; }
.message-search-bar input:focus { border-color: var(--blue); }
.chat-layout.contact-open .thread { border-right: 0; }
.admin-layout { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }

@media (max-width: 760px) {
  html { height: 100%; }
  body:not(.login-active) { height: 100%; min-height: 100%; overflow: hidden; }
  body:not(.login-active) #app-view { height: 100%; min-height: 0; }
  body, .app-view { height: 100dvh; min-height: 0; overflow: hidden; }
  .topbar { flex: 0 0 54px; height: 54px; padding: 0 12px; }
  .topbar .brand { font-size: 15px; }
  .brand-mark-image.small { width: 30px; height: 30px; flex-basis: 30px; }
  .topbar-actions { gap: 6px; }
  .current-user { max-width: 92px; font-size: 12px; }
  #admin-tab { padding: 7px 8px; font-size: 11px; }
  .mobile-tabs { flex: 0 0 48px; height: 48px; display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: #fff; }
  .mobile-tab { position: relative; border: 0; background: transparent; color: #718798; font-size: 13px; font-weight: 700; }
  .mobile-tab.active { color: var(--blue-dark); }
  .mobile-tab.active::after { position: absolute; right: 20%; bottom: 0; left: 20%; height: 3px; border-radius: 4px 4px 0 0; background: var(--blue); content: ""; }
  .chat-layout, .chat-layout.contact-open { position: relative; display: block; flex: 1; height: auto; min-height: 0; overflow: hidden; }
  .sidebar, .thread, .contact-panel { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border: 0; }
  .sidebar { display: flex; }
  .sidebar-heading { padding: 14px 16px 9px; }
  .sidebar-heading h2 { font-size: 18px; }
  .sidebar-search { height: 38px; margin: 0 14px 8px; }
  .mobile-section-label { display: block; padding: 8px 16px 6px; color: #7790a2; font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
  .conversation-list { max-height: none; flex: 1; overflow: auto; }
  .conversation-empty { min-height: 190px; padding: 22px 16px; }
  .contacts-heading { padding: 11px 16px 6px; }
  .contact-list { max-height: 31%; flex: 0 0 auto; overflow: auto; }
  .chat-layout:not(.conversation-open) .thread { display: none; }
  .chat-layout.conversation-open .sidebar { display: none; }
  .chat-layout.conversation-open .thread { display: flex; }
  .chat-layout.contact-open .thread { display: none; }
  .chat-layout.contact-open .contact-panel { display: flex; }
  .back-to-chats { display: inline-grid; width: 34px; height: 38px; margin-left: -8px; font-size: 30px; }
  .thread-header { min-height: 58px; padding: 6px 8px; }
  .thread-tools { gap: 0; }
  .thread-tools .icon-button { width: 36px; height: 36px; font-size: 17px; }
  .thread-person { gap: 8px; }
  .thread-person > .avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .thread-person h2 { max-width: 37vw; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  .thread-person p { font-size: 11px; }
  .messages { padding: 12px 10px; }
  .message { max-width: 88%; padding: 9px 11px; }
  .composer { gap: 2px; padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); }
  .composer .icon-button { width: 34px; height: 38px; }
  .camera-button { display: none; }
  #message-input { height: 40px; padding: 8px 12px; }
  .send-button, .voice-button { width: 38px; height: 38px; min-height: 38px; flex: 0 0 38px; }
  .contact-panel { border: 0; }
  .contact-panel-section { padding-right: 17px; padding-left: 17px; }
  .admin-layout { height: calc(100dvh - 102px); overflow: auto; }
  .app-view.admin-mode .mobile-tabs { display: none; }
  .app-view.admin-mode .admin-layout { height: calc(100dvh - 54px); }
  body[data-mobile-section="status"] .chat-layout:not(.conversation-open) .conversation-list,
  body[data-mobile-section="status"] .chat-layout:not(.conversation-open) .contacts-heading,
  body[data-mobile-section="status"] .chat-layout:not(.conversation-open) #group-create-form,
  body[data-mobile-section="calls"] .chat-layout:not(.conversation-open) .conversation-list,
  body[data-mobile-section="calls"] .chat-layout:not(.conversation-open) .contacts-heading,
  body[data-mobile-section="calls"] .chat-layout:not(.conversation-open) #group-create-form { display: none; }
  body[data-mobile-section="status"] .chat-layout:not(.conversation-open) .contact-list,
  body[data-mobile-section="calls"] .chat-layout:not(.conversation-open) .contact-list { display: block; max-height: none; flex: 1; }
  body[data-mobile-section="calls"] .mobile-section-label::after { content: " · toca a una persona para abrir el chat"; }
}

/* Keep message bubbles content-sized and the chat area free of duplicate contacts. */
.contact-list, .contacts-heading { display: none !important; }
.sidebar { overflow: hidden; }
.conversation-list { flex: 1; max-height: none; overflow-x: hidden; }
.conversation-item { min-width: 0; }
.conversation-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-preview { max-width: 100%; }
.search-results-label { margin: 10px 16px 2px; color: #6b8497; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.messages { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding-right: clamp(12px, 2vw, 28px); padding-left: clamp(12px, 2vw, 28px); }
.message { display: block; width: fit-content; min-width: 0; max-width: min(78%, 680px); margin: 0; }
.message:not(.own) { align-self: flex-start; }
.message.own { align-self: flex-end; margin-left: 0; }
.message-meta time { margin-left: 8px; }
.message-attachment { min-width: 0; max-width: 100%; }

/* Mobile browsers and embedded webviews report a changing visual viewport. */
@media (max-width: 760px) {
  body:not(.login-active) {
    height: var(--tas-app-height, 100dvh);
    min-height: 0;
  }
  body:not(.login-active) #app-view {
    height: var(--tas-app-height, 100dvh);
    min-height: 0;
    flex: 0 0 var(--tas-app-height, 100dvh);
  }
  body:not(.login-active) #chat-view {
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
  }
}



.voice-player { width: min(360px, 72vw); max-width: 100%; }
@media (max-width: 760px) {
  .chat-layout:not(.conversation-open) .contact-list { display: none !important; }
  body[data-mobile-section="status"] .chat-layout:not(.conversation-open) .contact-list,
  body[data-mobile-section="calls"] .chat-layout:not(.conversation-open) .contact-list { display: flex !important; flex-direction: column; max-height: none; flex: 1; overflow-y: auto; }
  .messages { gap: 8px; padding-right: 9px; padding-left: 9px; }
  .message { max-width: 86%; }
  .voice-player { width: min(320px, 73vw); min-width: min(230px, 70vw); }
}

@media (max-width: 760px) {
  html, body { width: 100%; height: 100%; min-height: 100%; touch-action: pan-x pan-y; }
  body:not(.login-active) { height: 100vh; height: 100dvh; min-height: 100svh; overflow: hidden; }
  body:not(.login-active) #app-view { height: 100%; min-height: 100%; }
  body:not(.login-active) #chat-view { height: auto; min-height: 0; flex: 1 1 auto; }
  body:not(.login-active) .topbar { box-sizing: border-box; height: calc(54px + env(safe-area-inset-top)); flex-basis: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; }
  body:not(.login-active) { --tas-app-topbar-height: calc(54px + env(safe-area-inset-top)); }
  body.login-active { height: auto; min-height: 100vh; min-height: 100svh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
  body.login-active .login-view { min-height: 100vh; min-height: 100svh; min-height: 100dvh; padding-top: env(safe-area-inset-top); }
  body.login-active .login-card { margin-top: 0; }
  input, textarea, select { font-size: 16px; }
}
.message-footer time { margin-left: 0; }

/* Final mobile viewport override; this must follow all mobile theme rules. */
@media (max-width: 760px) {
  html { height: 100%; min-height: 100%; }
  body:not(.login-active) {
    height: var(--tas-app-height, 100dvh);
    min-height: 0;
    max-height: var(--tas-app-height, 100dvh);
    overflow: hidden;
  }
  body:not(.login-active) #app-view {
    position: fixed;
    top: var(--tas-viewport-offset-top, 0px);
    right: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: var(--tas-app-height, 100dvh);
    min-height: 0;
    max-height: var(--tas-app-height, 100dvh);
    flex: 0 0 var(--tas-app-height, 100dvh);
    overflow: hidden;
  }
  body:not(.login-active) .chat-layout .sidebar {
    max-height: none;
  }
  body:not(.login-active) #chat-view {
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
  }
  body:not(.login-active) .messages {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  body:not(.login-active) .composer {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }
  body:not(.login-active) #message-input {
    font-size: 16px;
    scroll-margin-block: 8px;
  }
  html.tas-keyboard-open body:not(.login-active) .composer {
    padding-bottom: 7px;
  }
  body:not(.login-active) .app-view.admin-mode .admin-layout {
    height: auto;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
  }
}

/* Calls take over the chat area while keeping the TAS Chat header visible. */
.call-panel {
  position: fixed;
  z-index: 80;
  inset: calc(var(--tas-viewport-offset-top, 0px) + var(--tas-app-topbar-height, 56px)) 0 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 20px max(18px, env(safe-area-inset-bottom));
  border: 0;
  background: radial-gradient(ellipse at 50% 35%, #193b54 0%, #0c1a28 58%, #07111c 100%);
  color: #eef7fc;
}
.call-audio-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.call-audio-stage[hidden], .call-videos[hidden] { display: none !important; }
.call-audio-stage h2 { margin: 4px 0 0; font-size: clamp(22px, 4vw, 32px); }
.call-audio-stage p { margin: 0; color: #abc2d1; }
.call-peer-avatar { width: clamp(120px, 24vw, 190px); height: clamp(120px, 24vw, 190px); flex-basis: auto; font-size: 46px; box-shadow: 0 16px 54px #0007, 0 0 0 7px #ffffff12; }
.call-videos { position: relative; flex: 1; min-height: 0; display: block; overflow: hidden; border-radius: 20px; background: #03080e; }
.call-videos #remote-video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-height: none; border-radius: 0; object-fit: cover; background: #03080e; }
.local-video-tile { position: absolute; z-index: 2; top: 16px; right: 16px; width: clamp(94px, 20vw, 178px); aspect-ratio: 3 / 4; overflow: hidden; border: 2px solid #ffffffc9; border-radius: 16px; background: #172534; box-shadow: 0 8px 26px #0008; transition: inset .2s ease, width .2s ease, height .2s ease, border-radius .2s ease; }
.local-video-tile video { display: block; width: 100%; height: 100%; max-height: none; border-radius: 0; object-fit: cover; }
.local-video-tile > span { position: absolute; right: 6px; bottom: 5px; left: 6px; color: white; font-size: 10px; text-shadow: 0 1px 5px #000; }
.call-video-swapped .local-video-tile { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.call-video-swapped .local-video-tile video { object-fit: cover; }
.call-video-swapped .local-video-tile > span { display: none; }
.call-video-swapped .call-videos #remote-video { z-index: 3; inset: 16px 16px auto auto; width: clamp(94px, 20vw, 178px); height: auto; aspect-ratio: 3 / 4; border: 2px solid #ffffffc9; border-radius: 16px; box-shadow: 0 8px 26px #0008; }
.call-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 2px 2px; }
.call-status-copy { display: grid; gap: 5px; }
.call-status-copy strong { font-size: 16px; }
.call-status-copy span { color: #abc2d1; font-size: 13px; }
.call-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.call-control-button { display: flex; min-width: 74px; min-height: 62px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px 11px; border: 1px solid #ffffff24; border-radius: 16px; background: #ffffff12; color: #f0f8fc; font-size: 11px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.call-control-button .ui-icon { width: 22px; height: 22px; }
.call-control-button[aria-pressed="true"] { background: #b13d4d; border-color: #ff8997; }
.call-control-button.call-hangup { min-width: 84px; border-color: #ec3444; background: #d51f32; }
.call-control-button.call-hangup:hover { background: #f02d40; }
.incoming-call { position: fixed; z-index: 79; inset: calc(var(--tas-viewport-offset-top, 0px) + var(--tas-app-topbar-height, 56px)) 0 0; display: grid; place-items: center; padding: 22px; border: 0; background: radial-gradient(ellipse at 50% 35%, #193b54 0%, #0c1a28 58%, #07111c 100%); color: #eef7fc; }
.incoming-call-card { display: flex; width: min(390px, 100%); flex-direction: column; align-items: center; gap: 12px; padding: 32px 24px; text-align: center; }
.incoming-call-card .large-avatar { width: 112px; height: 112px; flex-basis: 112px; font-size: 30px; }
.incoming-call-card .eyebrow, .incoming-call-card h2, .incoming-call-card p { margin: 0; }
.incoming-call-card h2 { font-size: 26px; }
.incoming-call-card .muted { color: #abc2d1; }
.incoming-call-actions { display: flex; justify-content: center; gap: 26px; margin-top: 24px; }
.incoming-call-actions button { min-width: 112px; min-height: 48px; border-radius: 24px; }
.incoming-call-actions .danger-button { padding: 10px 16px; }
.group-current-member .avatar img, .group-sender-avatar img { object-fit: cover; }
.media-viewer-nav { display: none !important; }

@media (max-width: 760px) {
  .call-panel, .incoming-call { padding-right: 14px; padding-left: 14px; }
  .call-videos { border-radius: 0; margin: -18px -14px 0; }
  .call-footer { align-items: stretch; flex-direction: column; gap: 16px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .call-status-copy { text-align: center; }
  .call-controls { justify-content: center; gap: 9px; }
  .call-control-button { min-width: 66px; min-height: 62px; padding: 7px 8px; border-radius: 18px; }
  .call-control-button.call-hangup { min-width: 74px; }
  .local-video-tile { top: 14px; right: 14px; }
  .call-video-swapped .call-videos #remote-video { top: 14px; right: 14px; }
}

.witchee-admin-button.witchee-request-pending,
#admin-tab.witchee-request-pending {
  position: relative;
  animation: witchee-request-pulse 1s ease-in-out infinite;
  box-shadow: 0 0 0 3px #35b66b55;
}
#admin-tab.witchee-request-pending { background: #168550; border-color: #168550; color: #fff; }
@keyframes witchee-request-pulse {
  50% { filter: brightness(1.3); box-shadow: 0 0 0 6px #35b66b22; }
}
@media (prefers-reduced-motion: reduce) {
  .witchee-admin-button.witchee-request-pending,
  #admin-tab.witchee-request-pending { animation: none; outline: 2px solid #35b66b; outline-offset: 2px; }
}

/* Account settings behave like the contact details drawer without blocking the chat. */
#settings-dialog.settings-drawer[open] {
  position: fixed;
  z-index: 35;
  inset: 42px 0 0 auto;
  display: flex;
  flex-direction: column;
  width: min(390px, 100vw);
  height: calc(100dvh - 42px);
  max-height: none;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-radius: 18px 0 0 0;
  background: var(--panel);
  box-shadow: -18px 0 44px #07152133;
}
#settings-dialog.settings-drawer::backdrop { display: none; }
.settings-drawer-header { position: sticky; top: 0; z-index: 2; justify-content: space-between; min-height: 64px; background: var(--panel); }
.settings-drawer-header h2 { margin: 0; font-size: 17px; }
.settings-drawer-header .eyebrow { margin: 0 0 3px; }
#settings-dialog .settings-group > summary { min-height: 58px; padding: 9px 16px; }
#settings-dialog .settings-group-content { padding: 8px 16px 16px; }
#settings-dialog .settings-shortcuts { gap: 0; }
#settings-dialog .settings-shortcuts .panel-row { min-height: 43px; padding: 6px 0; border-bottom: 1px solid var(--line); text-align: left; }
#settings-dialog.profile-settings-mode .settings-group:not([data-account-quick]) { display: none !important; }
.security-questions-subsection { margin-top: 12px; border-top: 1px solid var(--line); }
.security-questions-subsection > summary { padding: 11px 0 7px; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 700; }
.security-questions-subsection > .settings-group-content { padding: 8px 0 0; }
.settings-check { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; }
.settings-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.contact-call-history-item { display: flex; align-items: center; gap: 9px; }
.contact-call-history-item .contact-open { flex: 1; }
.contact-history-copy { display: grid; min-width: 0; gap: 3px; text-align: left; }
.contact-history-copy strong { display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.contact-history-copy > span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.contact-call-date { flex: 0 0 auto; align-self: flex-start; margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.call-contacts-heading { padding-top: 12px; border-top: 1px solid var(--line); }
.message.system { align-self: center; max-width: min(88%, 580px); }
.message.system .message-bubble { padding: 5px 11px; border: 1px solid #ffffff0f; border-radius: 999px; background: #193247aa; box-shadow: none; text-align: center; }
.message.system .message-body { color: var(--muted); font-size: 11px; line-height: 1.4; }
.message.system .message-footer { display: none; }
.holiday-lights { top: 0; right: 0; left: 0; width: 100%; height: 28px; border: 0; background: none; }
.holiday-lights::before { position: absolute; inset: 0 0 auto; height: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 24' preserveAspectRatio='none'%3E%3Cpath d='M0 4 C90 25 180 25 300 4 S510 -10 600 4 S810 25 900 4 S1110 -10 1200 4' fill='none' stroke='%23168550' stroke-width='2'/%3E%3C/svg%3E") center top / 100% 22px no-repeat; content: ""; }
.holiday-bulb { transform: translateX(-50%); }
.holiday-thread-layer .holiday-lights { right: 0; left: 0; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
#new-group-button[hidden] { display: none !important; }
body.settings-open .mobile-tabs { visibility: hidden; }
@media (max-width: 760px) {
  #settings-dialog.settings-drawer[open] { inset: 0 0 0 auto; width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .settings-drawer-header { min-height: 56px; padding-top: env(safe-area-inset-top); }
  .holiday-lights { height: 24px; }
  .holiday-lights::before { height: 20px; }
}

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* TAS global wallpaper: the supplied artwork stays at 40% behind every view. */
body { position: relative; isolation: isolate; background: #071521; }
body > #login-view, body > #app-view { position: relative; z-index: 2; }
#app-view, #chat-view, .chat-layout { background: transparent !important; }
#app-view .topbar, #app-view .mobile-tabs, #app-view .thread-header, #app-view .composer,
#app-view .contact-panel-header, #app-view .message-search-bar { background-color: rgba(7, 22, 34, .78) !important; }
#app-view .sidebar, #app-view .thread, #app-view .contact-panel, #app-view .admin-layout,
#app-view .admin-card { background-color: rgba(7, 21, 33, .54) !important; }
#app-view .messages:not(.has-chat-wallpaper) { background: transparent !important; }
#app-view .conversation-item, #app-view .contact-item, #app-view .contact-profile,
#app-view .contact-panel-section, #app-view .group-info-summary { background-color: rgba(9, 25, 38, .44) !important; }
#app-view .conversation-item.active { background-color: rgba(21, 66, 94, .72) !important; }
#app-view .admin-user { background-color: rgba(12, 31, 45, .70) !important; }
#app-view #settings-dialog.settings-drawer[open], #app-view .app-dialog,
#app-view .action-dialog { background-color: rgba(9, 27, 41, .82) !important; -webkit-backdrop-filter: blur(18px) saturate(145%); backdrop-filter: blur(18px) saturate(145%); }
.holiday-global-layer { position: fixed; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.holiday-global-layer .holiday-flake { opacity: .72; }

/* Tapping a group member opens that person's direct conversation. */
button.group-current-member { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.group-current-member:hover, button.group-current-member:focus-visible { border-radius: 10px; outline: 1px solid #61c5ff75; background: rgba(58, 158, 216, .13); }

/* Call controls float above the call view as separate glass buttons. */
.call-panel { padding: 0 !important; overflow: hidden; background: rgba(4, 17, 28, .50) !important; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.call-videos { margin: 0 !important; border-radius: 0 !important; background: #03080e; }
.call-footer { position: absolute; z-index: 6; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; display: flex; justify-content: center; padding: 0 12px; pointer-events: none; }
.call-status-copy { display: none !important; }
.call-controls { justify-content: center; gap: clamp(8px, 2vw, 15px); pointer-events: auto; }
.call-control-button { position: relative; isolation: isolate; min-width: 72px; min-height: 62px; overflow: hidden; padding: 8px 11px; border: 1px solid #e4f7ff6b; border-radius: 17px; background: linear-gradient(145deg, #f3fbff55 0%, #b4e8ff20 42%, #102b3aaa 100%); color: #f3fbff; box-shadow: inset 0 1px 0 #ffffff91, inset 0 -1px 0 #ffffff14, 0 10px 28px #0006; -webkit-backdrop-filter: blur(18px) saturate(175%); backdrop-filter: blur(18px) saturate(175%); text-shadow: 0 1px 4px #071521b5; }
.call-control-button::before { position: absolute; z-index: -1; top: 1px; right: 16%; left: 16%; height: 1px; background: linear-gradient(90deg, transparent, #fff, transparent); content: ""; opacity: .82; }
.call-control-button .ui-icon { width: 23px; height: 23px; filter: drop-shadow(0 1px 2px #001); }
.call-control-button[aria-pressed="true"] { border-color: #b6e4f9a3; background: linear-gradient(145deg, #ffffff50, #344f63c9); }
.call-control-button.call-hangup { min-width: 76px; border-color: #ff9aabb5; background: linear-gradient(145deg, #ff829088, #a30625e8); }
.call-control-button.call-hangup:hover { background: linear-gradient(145deg, #ffa1aa, #d51f32); }
.local-video-tile, .call-videos #remote-video { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; cursor: grab; }
.local-video-tile:active, .call-videos #remote-video:active { cursor: grabbing; }
.local-video-tile.camera-off { background: radial-gradient(circle at 50% 35%, #29475d, #071521 78%); }
.local-video-tile.camera-off video { visibility: hidden; }
.local-camera-off-label { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; color: #edf8ff; font-size: 12px; text-align: center; text-shadow: 0 2px 6px #000; }
.local-camera-off-label[hidden] { display: none !important; }
.group-current-member { cursor: pointer; }

@media (max-width: 760px) {
  .call-panel { padding: 0 !important; }
  .call-footer { bottom: max(14px, env(safe-area-inset-bottom)); padding: 0 9px; }
  .call-controls { gap: 8px; }
  .call-control-button { min-width: 66px; min-height: 60px; padding: 7px 8px; border-radius: 16px; }
  .call-control-button.call-hangup { min-width: 68px; }
  .local-video-tile { top: 14px; right: 14px; }
  .call-video-swapped .call-videos #remote-video { top: 14px; right: 14px; }
}

/* Seasonal layers remain behind the chat and never intercept taps. */
.holiday-lights { display: none; }
body.christmas-season.login-active .holiday-winter-layer .holiday-lights { display: block; }
body:not(.login-active) .topbar::after { display: none !important; }
.thread-content { position: relative; isolation: isolate; }
.holiday-thread-layer { z-index: 0; }
.thread-content > :not(.holiday-thread-layer) { position: relative; z-index: 1; }
.christmas-season .messages, .new-year-season .messages { background-color: transparent !important; background-image: none !important; }
.holiday-new-year-layer { z-index: 1; }
.holiday-fireworks, .holiday-confetti { position: absolute; inset: 0; overflow: hidden; }
.holiday-firework-burst { position: absolute; top: var(--burst-y); left: var(--burst-x); width: 1px; height: 1px; animation: holiday-burst 3.8s ease-out var(--burst-delay) infinite; }
.holiday-firework-burst i { position: absolute; top: 0; left: 0; width: 4px; height: 14px; border-radius: 50%; background: hsl(var(--spark-hue) 96% 68%); box-shadow: 0 0 9px hsl(var(--spark-hue) 96% 68% / .8); transform: rotate(var(--spark-angle)) translateY(-4px); transform-origin: 50% 4px; opacity: 0; animation: holiday-spark 3.8s ease-out var(--burst-delay) infinite; }
.holiday-confetti i { position: absolute; top: -12px; left: var(--confetti-x); width: 6px; height: 10px; background: hsl(var(--confetti-hue) 92% 63%); opacity: .8; animation: holiday-confetti-fall var(--confetti-duration) linear var(--confetti-delay) infinite; }
.holiday-year-label { position: absolute; z-index: 0; top: 7%; left: 50%; padding: 5px 11px; border: 1px solid #ffffff3b; border-radius: 999px; background: #102b3a71; color: #fff; font-size: clamp(14px, 2vw, 22px); font-weight: 800; letter-spacing: .08em; transform: translateX(-50%); text-shadow: 0 2px 8px #061521c9; }
.message-attachment.voice-attachment { width: min(382px, calc(100vw - 64px)); max-width: 100%; min-width: 0; box-sizing: border-box; }
.message-attachment.voice-attachment .voice-player { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
@keyframes holiday-burst { 0%, 18% { opacity: 0; } 22%, 62% { opacity: 1; } 100% { opacity: 0; } }
@keyframes holiday-spark { 0%, 18% { opacity: 0; transform: rotate(var(--spark-angle)) translateY(-4px) scale(.15); } 25% { opacity: 1; } 58% { opacity: .9; transform: rotate(var(--spark-angle)) translateY(-58px) scale(1); } 82%, 100% { opacity: 0; transform: rotate(var(--spark-angle)) translateY(-72px) scale(.5); } }
@keyframes holiday-confetti-fall { from { transform: translate3d(0, -4vh, 0) rotate(0); } to { transform: translate3d(22px, 108vh, 0) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) {
  .holiday-firework-burst, .holiday-firework-burst i, .holiday-confetti i { animation: none !important; }
  .holiday-confetti i { display: none; }
}
.typing-indicator { flex: 0 0 auto; align-self: flex-start; margin: 0; padding: 2px 18px 5px; color: var(--muted); font-size: 11px; line-height: 1.3; }
#typing-indicator[hidden] { display: none !important; }
.typing-indicator::after { display: inline-block; width: 15px; height: 6px; margin-left: 6px; background: radial-gradient(circle, #63c8ff 0 2px, transparent 2.5px) 0 50% / 6px 6px, radial-gradient(circle, #63c8ff 0 2px, transparent 2.5px) 6px 50% / 6px 6px, radial-gradient(circle, #63c8ff 0 2px, transparent 2.5px) 12px 50% / 6px 6px; background-repeat: no-repeat; content: ""; animation: typing-dots 1s ease-in-out infinite alternate; }
@keyframes typing-dots { to { opacity: .35; transform: translateY(-1px); } }

/* Account restoration, stories and small-screen navigation polish. */
.session-checking #login-view,
.session-checking #app-view,
.session-checking #maintenance-view { display: none !important; }
.app-boot-screen { display: none; }
.session-checking .app-boot-screen { position: fixed; z-index: 1000; inset: 0; place-items: center; align-content: center; gap: 12px; background: #071a2d; color: #dcebf5; font-size: 14px; }
.session-checking .app-boot-screen { display: grid; }
.app-boot-screen img { width: 52px; height: 52px; }
.sidebar-heading-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.mobile-section-back { display: none; }
.desktop-section-button { display: none; }
.story-contact-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
button.story-contact-item { cursor: pointer; }
.story-contact-item:hover { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.story-contact-item > .avatar { flex: 0 0 44px; width: 44px; height: 44px; }
.story-contact-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
.story-contact-copy strong { overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.story-contact-copy > span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.story-contact-item time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.story-contact-actions { display: flex; align-items: center; gap: 6px; }
.story-contact-actions .primary-button, .story-contact-actions .quiet-button { min-height: 34px; padding: 6px 10px; }
.story-own-item { background: color-mix(in srgb, var(--blue) 6%, transparent); }
.story-empty-note { padding: 18px 16px; }
.avatar.has-unseen-story { box-shadow: 0 0 0 2px #dd47bc, 0 0 0 4px #ffbc52; }
.story-viewer { position: fixed; inset: 0; width: min(520px, 100vw); height: min(920px, 100dvh); max-width: 100vw; max-height: 100dvh; margin: auto; padding: 16px; overflow: hidden; border: 0; border-radius: 20px; background: #07121e; color: #f0f7fc; }
.story-viewer::backdrop { background: #000c; -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.story-viewer[open] { display: flex; flex-direction: column; }
.story-viewer-progress { display: flex; gap: 4px; height: 3px; flex: 0 0 3px; }
.story-progress-segment { position: relative; flex: 1; overflow: hidden; border-radius: 99px; background: #ffffff4a; }
.story-progress-segment.complete { background: #fff; }
.story-progress-segment.current::after { position: absolute; inset: 0; transform: scaleX(0); transform-origin: left; background: #fff; content: ""; animation: story-progress var(--story-duration, 5s) linear forwards; }
.story-viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.story-viewer-user { display: flex; align-items: center; min-width: 0; gap: 9px; }
.story-viewer-user .avatar { width: 34px; height: 34px; flex-basis: 34px; }
.story-viewer-user strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.story-viewer-user time { color: #b7c8d6; font-size: 10px; white-space: nowrap; }
.story-viewer-header .icon-button { flex: 0 0 38px; color: #fff; }
.story-viewer-media { display: grid; flex: 1; min-height: 0; place-items: center; }
.story-viewer-media img, .story-viewer-media video { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; }
.story-viewer-nav { position: absolute; z-index: 2; top: 72px; bottom: 76px; width: 34%; border: 0; background: transparent; }
.story-viewer-prev { left: 0; }
.story-viewer-next { right: 0; }
@keyframes story-progress { to { transform: scaleX(1); } }

.holiday-lights { background: none !important; }
.holiday-bulb { position: absolute; top: var(--bulb-y); left: var(--bulb-x); width: 8px; height: 13px; border: 1px solid #ffffff75; border-radius: 50% 50% 45% 45%; background: hsl(var(--bulb-hue) 96% 62%); box-shadow: 0 0 7px 2px hsl(var(--bulb-hue) 96% 62% / .72); animation: holiday-bulb-color 18s linear var(--bulb-delay) infinite; }
.holiday-bulb::before { position: absolute; top: -4px; left: 2px; width: 3px; height: 4px; border-radius: 2px 2px 0 0; background: #9fb3bb; content: ""; }
.holiday-thread-layer .holiday-bulb { transform: scale(.78); transform-origin: top center; }
.christmas-season .topbar::after { height: 17px; background-position: 8px 2px, 25px 10px, 42px 3px, 59px 11px; background-size: 68px 17px; animation: holiday-color-shift 22s linear infinite; }
@keyframes holiday-bulb-color { 0%, 100% { filter: hue-rotate(0deg) brightness(1); } 50% { filter: hue-rotate(175deg) brightness(1.16); } }
@keyframes holiday-color-shift { to { filter: hue-rotate(360deg) brightness(1.12); } }

.message-media-item { display: grid; justify-items: end; gap: 2px; }
.message-media-visual { position: relative; display: block; width: fit-content; max-width: 100%; line-height: 0; }
.attachment-footer { position: absolute; right: 9px; bottom: 8px; display: flex; gap: 5px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #f4fbff; text-shadow: 0 1px 3px #000, 0 0 7px #000; -webkit-backdrop-filter: none; backdrop-filter: none; line-height: 1.2; }
.message-media-item .media-forward-button { position: static; justify-self: end; display: grid; place-items: center; width: 34px; height: 30px; padding: 0; border: 1px solid #a7d8f23f; border-radius: 10px; background: #10243480; color: #e9f7ff; box-shadow: none; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.message-image, .attachment-image-open { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: pan-y; }
.message-image { pointer-events: none; }
.message-video { -webkit-touch-callout: none; }

@media (max-width: 760px) {
  .mobile-section-back:not([hidden]) { display: inline-grid; flex: 0 0 34px; width: 34px; height: 38px; margin-left: -8px; color: var(--ink); }
  .sidebar-heading-title h2 { font-size: 18px; }
  .thread { padding-bottom: 0 !important; }
  .thread-mode .thread-content { padding-bottom: 0; }
  .thread-mode .composer { margin-bottom: 0; padding-bottom: max(7px, env(safe-area-inset-bottom)); }
  .story-viewer { inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); border-radius: 0; }
  .story-contact-item { min-height: 70px; padding-right: 13px; padding-left: 13px; }
  .story-contact-item > .avatar { width: 48px; height: 48px; flex-basis: 48px; }
}

@media (min-width: 761px) {
  .desktop-section-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-color: #ffffff35; background: #ffffff12; color: #eef8ff; }
  .desktop-section-button .ui-icon { width: 17px; height: 17px; }
  .desktop-section-button:hover, .desktop-section-button.active { border-color: #ffffff5c; background: #ffffff28; color: #fff; }
  .mobile-section-back:not([hidden]) { display: inline-grid; flex: 0 0 34px; width: 34px; height: 38px; margin-left: -8px; }
  body.section-status #chat-view { grid-template-columns: minmax(0, 1fr); }
  body.section-status #chat-view .thread { display: none; }
  body.section-status #chat-view .sidebar { border-right: 0; }
  body.section-status #chat-view .conversation-list,
  body.section-status #chat-view .contacts-heading,
  body.section-status #chat-view #group-create-form { display: none !important; }
  body.section-status #chat-view .contact-list { display: flex !important; flex: 1; min-height: 0; flex-direction: column; overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .holiday-bulb, .christmas-season .topbar::after, .story-progress-segment.current::after { animation: none !important; }
}

/* Stable in-app media viewer, native-safe selection, and clearer save feedback. */
body.christmas-season:not(.login-active) .topbar::after { display: none !important; }
.christmas-season .thread { isolation: auto; }
.christmas-season .messages { background-color: var(--surface) !important; }
.typing-indicator { border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.messages.has-chat-wallpaper { background-color: #071521 !important; }
.shared-media-preview { display: block; width: 100%; aspect-ratio: 1; padding: 0; overflow: hidden; border: 0; border-radius: 5px; background: #101e2b; }
.shared-media-preview img, .shared-media-preview video { display: block; width: 100%; height: 100%; object-fit: cover; }
.open-video-viewer { position: absolute; right: 9px; top: 9px; z-index: 2; min-height: 34px; padding: 5px 10px; border: 1px solid #ffffff50; border-radius: 10px; background: #102434b8; color: #fff; font-size: 12px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.media-viewer[open] { display: grid; place-items: center; isolation: isolate; }
.media-viewer::backdrop { background: #05090ee8; }
.media-viewer img, .media-viewer video { grid-area: 1 / 1; display: block; width: auto; height: auto; max-width: min(100%, 1500px); max-height: 100%; object-fit: contain; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.media-viewer-nav { position: absolute; z-index: 2; top: 50%; display: grid; place-items: center; width: 46px; height: 54px; padding: 0; transform: translateY(-50%); border: 1px solid #ffffff40; border-radius: 14px; background: #10243485; color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.media-viewer-nav .ui-icon { width: 25px; height: 25px; }
.media-viewer-prev { left: max(10px, env(safe-area-inset-left)); }
.media-viewer-next { right: max(10px, env(safe-area-inset-right)); }
.media-viewer-counter { position: absolute; z-index: 2; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; text-shadow: 0 1px 5px #000; }
.media-viewer-close { z-index: 3; }
.action-dialog { border-color: #b6e3fa55; background: #10243380; box-shadow: 0 18px 56px #0006, inset 0 1px #ffffff30; -webkit-backdrop-filter: blur(16px) saturate(155%); backdrop-filter: blur(16px) saturate(155%); }
.action-dialog::backdrop { background: #02080d33; -webkit-backdrop-filter: none; backdrop-filter: none; }
.action-dialog .dialog-actions { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 14px 14px; }
.action-dialog .dialog-actions > button { width: 100%; min-height: 46px; padding: 10px 12px; border: 0; border-bottom: 1px solid #ffffff1e; border-radius: 0; background: transparent; color: var(--ink); text-align: left; box-shadow: none; }
.action-dialog .dialog-actions > button:last-child { border-bottom: 0; }
.action-dialog .dialog-actions > button:hover { background: #ffffff17; }
.action-dialog .dialog-actions > .danger-button { color: #ff9a9a; }
.settings-save-status:not(:empty) { margin: 8px 0 2px; padding: 8px 10px; border-left: 2px solid #22a878; border-radius: 0 8px 8px 0; background: #16a06b12; color: var(--ink); font-size: 12px; }
img, svg, video, canvas, button, .hero-emoji, .holiday-login-layer, .avatar, .brand-mark-image { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
img, svg, canvas { -webkit-user-drag: none; }
.message-body, .message-action-excerpt, .conversation-preview, .conversation-title { -webkit-user-select: text; user-select: text; }
.story-compose-dialog { position: fixed; inset: 0; width: min(520px, calc(100vw - 24px)); height: min(820px, calc(100dvh - 24px)); max-width: none; max-height: none; margin: auto; padding: 14px; overflow: hidden; border: 1px solid #a7d8f250; border-radius: 18px; background: #0c1a28; color: #eef7fc; box-shadow: 0 24px 80px #000b; }
.story-compose-dialog::backdrop { background: #02080dc9; }
.story-compose-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.story-compose-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.story-compose-header .eyebrow { margin-bottom: 4px; }
.story-compose-header h2 { margin: 0; font-size: 18px; }
.story-viewer-header-actions { display: flex; align-items: center; gap: 7px; }
.story-viewer-header-actions .danger-button { min-height: 34px; padding: 6px 10px; }
.story-compose-preview { display: grid; flex: 1; min-height: 0; place-items: center; overflow: hidden; border-radius: 12px; background: #050a10; }
.story-compose-preview img, .story-compose-preview video { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; }
.story-compose-actions { display: flex; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.story-viewer-header-actions { display: flex; align-items: center; gap: 7px; }
.story-compose-actions button:disabled, .story-viewer-header-actions button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 760px) {
  .media-viewer { padding-right: max(8px, env(safe-area-inset-right)); padding-left: max(8px, env(safe-area-inset-left)); }
  .media-viewer-nav { width: 38px; height: 48px; background: #10243470; }
  .media-viewer img, .media-viewer video { max-width: 100%; max-height: 100%; }
  .story-compose-dialog { inset: 0; width: 100vw; height: 100dvh; margin: 0; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; }
}

/* Final overrides for the in-page account drawer and seasonal garland. */
#settings-dialog.settings-drawer[open] {
  position: fixed;
  z-index: 35;
  inset: 42px 0 0 auto;
  display: flex;
  flex-direction: column;
  width: min(390px, 100vw);
  height: calc(100dvh - 42px);
  max-height: none;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-radius: 18px 0 0 0;
  background: var(--panel);
  box-shadow: -18px 0 44px #07152133;
}
#settings-dialog.settings-drawer::backdrop { display: none; }
.settings-drawer-header { position: sticky; top: 0; z-index: 2; justify-content: space-between; min-height: 64px; background: var(--panel); }
.settings-drawer-header h2 { margin: 0; font-size: 17px; }
.settings-drawer-header .eyebrow { margin: 0 0 3px; }
#settings-dialog .settings-group > summary { min-height: 58px; padding: 9px 16px; }
#settings-dialog .settings-group-content { padding: 8px 16px 16px; }
#settings-dialog .settings-shortcuts { gap: 0; }
#settings-dialog .settings-shortcuts .panel-row { min-height: 43px; padding: 6px 0; border-bottom: 1px solid var(--line); text-align: left; }
.settings-check { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; }
.settings-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.contact-call-history-item { display: flex; align-items: center; gap: 9px; }
.contact-call-history-item .contact-open { flex: 1; }
.contact-history-copy { display: grid; min-width: 0; gap: 3px; text-align: left; }
.contact-history-copy strong { display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.contact-history-copy > span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.contact-call-date { flex: 0 0 auto; align-self: flex-start; margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.call-contacts-heading { padding-top: 12px; border-top: 1px solid var(--line); }
.message.system { align-self: center; max-width: min(88%, 580px); }
.message.system .message-bubble { padding: 5px 11px; border: 1px solid #ffffff0f; border-radius: 999px; background: #193247aa; box-shadow: none; text-align: center; }
.message.system .message-body { color: var(--muted); font-size: 11px; line-height: 1.4; }
.message.system .message-footer { display: none; }
.holiday-lights { top: 0; right: 0; left: 0; width: 100%; height: 28px; border: 0; background: none; }
.holiday-lights::before { position: absolute; inset: 0 0 auto; height: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 24' preserveAspectRatio='none'%3E%3Cpath d='M0 4 C90 25 180 25 300 4 S510 -10 600 4 S810 25 900 4 S1110 -10 1200 4' fill='none' stroke='%23168550' stroke-width='2'/%3E%3C/svg%3E") center top / 100% 22px no-repeat; content: ""; }
.holiday-bulb { transform: translateX(-50%); }
.holiday-thread-layer .holiday-lights { right: 0; left: 0; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
#new-group-button[hidden] { display: none !important; }
body.settings-open .mobile-tabs { visibility: hidden; }
@media (max-width: 760px) {
  #settings-dialog.settings-drawer[open] { inset: 0 0 0 auto; width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .settings-drawer-header { min-height: 56px; padding-top: env(safe-area-inset-top); }
  .holiday-lights { height: 24px; }
  .holiday-lights::before { height: 20px; }
}

/* The transparent login artwork sits on one continuous panel, without a separate card. */
.login-hero { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
html[data-theme="dark"] .login-hero { border: 0; background: transparent; box-shadow: none; }
@media (max-width: 760px) {
  html body.login-active #login-view { background: var(--panel); }
  html body.login-active #login-view .login-card { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
}

.account-onboarding { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.account-onboarding h2 { margin: 0; font-size: 20px; }
.account-onboarding p { margin: 0; }

/* Mobile navigation, conversation actions, and compact standalone media. */
.conversation-item { align-items: flex-start; }
.conversation-meta { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 5px; margin-left: auto; color: #8398a8; font-size: 10px; white-space: nowrap; }
.conversation-pin { color: #58b4ed; font-size: 9px; font-weight: 750; }
.conversation-item.unread .conversation-title { font-weight: 850; }
.archive-toggle { width: 100%; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: #62c2ff; text-align: left; font-size: 12px; font-weight: 750; }
.archive-toggle:hover { background: #172b3b; }
.thread-person { border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.thread-person:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 8px; }
.action-dialog .dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
.action-dialog .dialog-actions > button { min-width: 0; }

.message { position: relative; display: flex; flex-direction: column; gap: 4px; overflow: visible; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
.message::before { display: none !important; }
.message-body { width: fit-content; max-width: 100%; margin: 0; padding: 8px 12px; border: 1px solid #344757; border-radius: 15px 15px 15px 5px; background: #26313c; color: #e8f1f7; line-height: 1.45; }
.message.own .message-body { align-self: flex-end; border-color: #24557a; border-radius: 15px 15px 5px 15px; background: #15344b; color: #e8f1f7; }
.message-attachment { width: fit-content; max-width: 100%; margin: 0; padding: 7px 10px; border: 1px solid #344757; border-radius: 14px 14px 14px 5px; background: #26313c; overflow-wrap: anywhere; }
.message.own .message-attachment:not(.visual-media) { align-self: flex-end; border-color: #24557a; border-radius: 14px 14px 5px 14px; background: #15344b; }
.message-attachment.visual-media { display: grid; gap: 7px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.message.media-message { max-width: min(86%, 680px); }
.message-footer { display: flex; justify-content: flex-end; align-items: center; gap: 5px; min-height: 13px; padding: 0 5px; color: #9db1c1; font-size: 10px; }
.message-footer time { margin: 0; }
.attachment-image-open { display: block; max-width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 13px; background: transparent; line-height: 0; }
.attachment-image-open:focus-visible { outline: 2px solid #4bb7ff; outline-offset: 3px; }
.message-image { display: block; width: auto; max-width: min(460px, 70vw); max-height: min(60vh, 620px); border-radius: 13px; object-fit: contain; }
.message-video { display: block; width: auto; max-width: min(460px, 70vw); max-height: min(60vh, 620px); border-radius: 13px; background: #080e14; }
.media-viewer { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: max(24px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom)); overflow: hidden; border: 0; background: #05090eeF; color: white; }
.media-viewer::backdrop { background: #05090ef2; }
.media-viewer[open] { display: grid; place-items: center; }
.media-viewer img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; touch-action: none; }
.media-viewer-close { position: absolute; z-index: 1; top: max(12px, env(safe-area-inset-top)); right: 12px; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #ffffff44; border-radius: 50%; background: #182b3acc; color: white; }

@media (max-width: 760px) {
  .mobile-tabs,
  .app-view.thread-mode .mobile-tabs { position: fixed; z-index: 30; right: 10px; bottom: max(8px, env(safe-area-inset-bottom)); left: 10px; width: auto; height: 66px; padding: 5px; display: grid !important; grid-template-columns: minmax(64px, 1.35fr) repeat(4, minmax(45px, 1fr)); gap: 3px; border: 1px solid #a4d5f034; border-radius: 22px; background: #102333d9; color: #e7f2f8; box-shadow: 0 12px 38px #0007, inset 0 1px #ffffff18; -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); }
  html[data-theme-resolved="dark"] .mobile-tabs { border-color: #a4d5f034; background: #102333d9; color: #e7f2f8; }
  .mobile-profile-tab, .mobile-tab { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 16px; background: transparent; color: #a9bdcb; font-size: 9px; font-weight: 700; line-height: 1.1; }
  .mobile-profile-tab { flex-direction: row; gap: 5px; padding: 0 3px; color: #e8f3fa; }
  .mobile-profile-tab:active, .mobile-tab:active { background: #ffffff17; }
  .mobile-profile-avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
  .mobile-profile-avatar .presence-dot { width: 9px; height: 9px; }
  .mobile-profile-name { max-width: 54px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-tab > span:first-child { display: grid; place-items: center; height: 21px; }
  .mobile-tab .ui-icon { width: 19px; height: 19px; }
  .mobile-tab.active { background: #1b4058; color: #84d0ff; }
  .mobile-tab.active::after { display: none; }
  .mobile-section-label, .sidebar-heading .eyebrow { display: none !important; }
  .sidebar-account { display: none !important; }
  #settings-button { display: none; }
  .sidebar { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .thread, .contact-panel { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .conversation-meta { padding-top: 2px; font-size: 9px; }
  .conversation-item { gap: 9px; padding: 10px 12px; }
  .message { max-width: 88%; }
  .message.media-message { max-width: 91%; }
  .message-image, .message-video { max-width: min(360px, 78vw); max-height: min(54vh, 520px); }
  .message-body { padding: 8px 11px; font-size: 14px; }
  .media-viewer { padding-right: 8px; padding-left: 8px; }
  .app-view.admin-mode .mobile-tabs { display: none !important; }
}
.verification-management { grid-column: 1 / -1; }
.generated-password-dialog { width: min(520px, calc(100vw - 24px)); }
.generated-password-value { display: block; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; user-select: all; }
.password-save-confirm { display: flex; align-items: center; gap: 10px; color: var(--ink) !important; font-size: 14px !important; }
.password-save-confirm input { width: 18px !important; min-height: 18px !important; margin: 0; accent-color: var(--blue); }
.stack-form input[type="file"] { padding: 7px; }
html[data-theme-resolved="dark"] .account-onboarding { background: #101e2b; border-color: #2a3d4f; }
html[data-theme-resolved="dark"] .generated-password-value { background: #0b1824; border-color: #2a3d4f; }
html[data-theme="dark"] .account-onboarding { background: #101e2b; border-color: #2a3d4f; }
html[data-theme="dark"] .generated-password-value { background: #0b1824; border-color: #2a3d4f; }
@media (max-width: 760px) {
  .account-onboarding { padding: 14px; }
  .verification-management { grid-column: auto; }
  .generated-password-dialog { max-height: 85dvh; }
}

.settings-group { border-bottom: 1px solid var(--line); }
.settings-group > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 14px; min-height: 68px; padding: 12px 20px; color: var(--ink); cursor: pointer; list-style: none; }
.settings-group > summary::-webkit-details-marker { display: none; }
.settings-group > summary::after { content: "+"; grid-column: 2; grid-row: 1 / span 2; color: var(--blue); font-size: 24px; font-weight: 400; }
.settings-group[open] > summary::after { content: "−"; }
.settings-group > summary span { font-size: 14px; font-weight: 750; }
.settings-group > summary small { color: var(--muted); font-size: 11px; }
.settings-group > summary:hover { background: var(--surface); }
.settings-group-content { display: grid; gap: 10px; padding: 2px 20px 18px; }
.settings-group-content > p { margin: 0; }
.settings-group-content > label { color: var(--muted); font-size: 12px; font-weight: 650; }
.settings-group-content > input, .settings-group-content > select { min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); }
.settings-group-content .stack-form { padding: 0; }
.settings-group-content .security-footnote { padding: 4px 0 0; }
.witchee-button, .witchee-admin-button { min-height: 40px; padding: 9px 13px; border: 1px solid #168550; border-radius: 10px; background: #168550; color: #fff; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.witchee-button:hover, .witchee-admin-button:hover { background: #117343; }
.witchee-button:disabled, .witchee-admin-button:disabled { cursor: not-allowed; opacity: .55; }
.witchee-admin-button { min-height: 36px; padding: 7px 10px; white-space: nowrap; }
.witchee-admin-button.witchee-request-reviewing { border-color: #c38a20; background: #a86a0b; }
.witchee-admin-button.witchee-request-verified { border-color: #087f54; background: #087f54; }
.witchee-code-dialog { width: min(460px, calc(100vw - 28px)); }
.witchee-countdown { color: var(--muted); text-align: center; }
.witchee-countdown strong { color: var(--ink); font-size: 18px; }
.witchee-review-panel:not([hidden]) { display: grid; flex: 0 1 auto; gap: 10px; max-height: min(38vh, 350px); padding: 12px 16px; overflow: auto; border-bottom: 1px solid var(--line); background: var(--surface); }
.witchee-review-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.witchee-review-heading h2 { margin: 2px 0 0; font-size: 16px; }
.witchee-review-heading .eyebrow { margin: 0; }
.witchee-review-profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 7px; }
.witchee-review-profile > div { display: grid; gap: 2px; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; }
.witchee-review-profile strong { color: var(--muted); font-size: 10px; }
.witchee-review-profile span { overflow-wrap: anywhere; font-size: 12px; }
.witchee-review-form, .witchee-review-manual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; align-items: end; }
.witchee-review-form[hidden], .witchee-review-manual[hidden] { display: none; }
.witchee-review-form label, .witchee-review-manual label { color: var(--muted); font-size: 11px; }
.witchee-review-form input, .witchee-review-manual input { width: 100%; min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.witchee-review-form button, .witchee-review-manual button { grid-column: 1 / -1; justify-self: start; }
.witchee-review-panel > .small-copy { max-width: 900px; margin: 0; font-size: 11px; }
.witchee-review-panel > .form-error { margin: 0; }
html[data-theme="dark"] .settings-group > summary:hover { background: #0c1722; }
html[data-theme="dark"] .settings-group-content > input, html[data-theme="dark"] .settings-group-content > select { background: #0c1722; color: var(--ink); }
@media (max-width: 760px) {
  .settings-group > summary { padding-right: 16px; padding-left: 16px; }
  .settings-group-content { padding-right: 16px; padding-left: 16px; }
  .witchee-admin-button { font-size: 11px; padding: 6px 8px; }
  .witchee-review-panel:not([hidden]) { max-height: 32dvh; padding: 10px; }
  .witchee-review-profile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .witchee-review-form, .witchee-review-manual { grid-template-columns: 1fr; }
}

.witchee-assist-view, .witchee-feedback-view { display: grid; gap: 12px; margin-top: 14px; }
.witchee-assist-view > .eyebrow, .witchee-feedback-view > .eyebrow,
.witchee-assist-view > h2, .witchee-feedback-view > h2,
.witchee-assist-view > p, .witchee-feedback-view > p { margin-bottom: 0; }
.witchee-masked-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.witchee-masked-code strong { color: var(--ink); letter-spacing: .16em; }
.witchee-assist-chat { display: flex; flex-direction: column; gap: 8px; min-height: 130px; max-height: min(34vh, 300px); padding: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.witchee-assist-message { align-self: flex-start; width: min(88%, 520px); padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: var(--panel); overflow-wrap: anywhere; }
.witchee-assist-message.mine { align-self: flex-end; border-color: #93cff4; border-radius: 12px 12px 4px; background: var(--blue-soft); }
.witchee-assist-message-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.witchee-assist-message-meta strong { color: var(--ink); }
.witchee-assist-identity { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.witchee-blue-tick { display: inline-grid; place-items: center; width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%; background: #1687ee; color: #fff; font-size: 10px; font-weight: 900; line-height: 1; }
.witchee-lit-bulb { display: inline-block; font-size: 14px; transform-origin: 50% 90%; animation: witchee-bulb-glow 1.8s ease-in-out infinite; }
.witchee-assist-message p { margin: 5px 0 0; white-space: pre-wrap; }
.witchee-assist-message.mine { position: relative; }
.witchee-question-floaters { position: absolute; z-index: 1; top: -11px; right: 11px; display: flex; align-items: flex-end; gap: 2px; pointer-events: none; }
.witchee-question-mark { color: #0877d1; font-weight: 900; line-height: 1; text-shadow: 0 1px 3px rgb(255 255 255 / 80%); animation: witchee-question-float 1.8s ease-in-out infinite; }
.witchee-question-mark-1 { font-size: 8px; animation-delay: -0.4s; }
.witchee-question-mark-2 { font-size: 11px; animation-delay: -1.1s; }
.witchee-question-mark-3 { font-size: 9px; animation-delay: -0.7s; }
@keyframes witchee-question-float { 0%, 100% { transform: translateY(2px) rotate(-8deg); opacity: .55; } 50% { transform: translateY(-4px) rotate(8deg); opacity: 1; } }
@keyframes witchee-bulb-glow { 0%, 100% { filter: brightness(.9) drop-shadow(0 0 1px #ffca55); transform: rotate(-4deg); } 50% { filter: brightness(1.35) drop-shadow(0 0 5px #ffd45e); transform: rotate(5deg); } }
.witchee-typing-indicator::after { content: ""; display: inline-block; width: 1.1em; text-align: left; animation: witchee-typing-dots 1.1s steps(4, end) infinite; }
@keyframes witchee-typing-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
@media (prefers-reduced-motion: reduce) { .witchee-lit-bulb, .witchee-question-mark, .witchee-typing-indicator::after { animation: none; } }
.witchee-assist-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.witchee-assist-chat-form input { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); }
.witchee-assist-error:empty { display: none; }
.witchee-assist-cancel { justify-self: start; }
.witchee-feedback-view input[type="range"] { width: 100%; accent-color: var(--blue); }
.witchee-feedback-view output { justify-self: center; min-width: 42px; padding: 4px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); text-align: center; font-size: 18px; font-weight: 800; }
.witchee-rating-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.witchee-rating-actions > button { flex: 1 1 150px; }
.witchee-close-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.witchee-review-questions { display: grid; gap: 6px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.witchee-review-questions > strong { color: var(--muted); font-size: 11px; }
.witchee-review-questions > span { font-size: 12px; }
.witchee-review-questions > span:not([hidden]) { padding: 6px 8px; border-radius: 7px; background: var(--surface); }
.witchee-feedback-list { display: grid; gap: 8px; }
.witchee-feedback-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.witchee-feedback-row > div { display: grid; gap: 3px; min-width: 0; }
.witchee-feedback-row > div strong { overflow-wrap: anywhere; }
.witchee-feedback-row > div span { color: var(--muted); font-size: 12px; }
.witchee-feedback-score { flex: 0 0 auto; color: var(--blue); font-size: 16px; }
html[data-theme="dark"] .witchee-assist-message.mine,
html[data-theme="dark"] .witchee-feedback-view output { background: #173b55; color: #d9efff; }
html[data-theme="dark"] .witchee-masked-code,
html[data-theme="dark"] .witchee-assist-chat,
html[data-theme="dark"] .witchee-feedback-row { background: #0c1722; }
@media (max-width: 560px) {
  .witchee-assist-chat-form { grid-template-columns: 1fr; }
  .witchee-assist-chat-form .primary-button { width: 100%; }
  .witchee-close-actions > button { flex: 1 1 100%; }
}

@media (max-width: 760px) {
  body.witchee-assist-active #login-view {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  }
  body.witchee-assist-active #login-view .login-hero { display: none !important; }
  body.witchee-assist-active #login-view .login-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 8px 14px 10px;
  }
  body.witchee-assist-active #login-view .login-brand,
  body.witchee-assist-active #login-view .login-card > .eyebrow,
  body.witchee-assist-active #login-view .login-card > h1,
  body.witchee-assist-active #login-view .login-card > .muted { display: none !important; }
  body.witchee-assist-active #login-view .witchee-assist-view {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 7px;
    min-height: 0;
    margin: 0;
    padding: 4px 0 0;
    overflow: hidden;
    border: 0;
    background: transparent;
  }
  body.witchee-assist-active .witchee-assist-view > .eyebrow { font-size: 9px; }
  body.witchee-assist-active .witchee-assist-view > h2 { margin: 0; font-size: 17px; }
  body.witchee-assist-active .witchee-assist-view > p.muted { font-size: 12px; line-height: 1.35; }
  body.witchee-assist-active .witchee-assist-chat { flex: 1; min-height: 0; max-height: none; }
  body.witchee-assist-active .witchee-assist-chat-form { flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  body.witchee-assist-active .witchee-assist-chat-form input { min-height: 44px; }
  body.witchee-assist-active .witchee-assist-chat-form .primary-button { width: auto; }
  body.witchee-assist-active .witchee-assist-cancel { flex: 0 0 auto; align-self: flex-start; min-height: 32px; padding: 5px 9px; }
}

/* Seasonal details run locally every December and stay behind app content. */
.login-hero { isolation: isolate; }
.holiday-login-layer, .holiday-thread-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.holiday-login-layer { z-index: 1; }
.login-people { z-index: 2; }
.hero-emoji { z-index: 3; }
.hero-floating-sticker-link { z-index: 4; }
.holiday-lights {
  position: absolute;
  top: 5px;
  right: 8%;
  left: 8%;
  height: 20px;
  border-top: 2px solid #168550a8;
  background-image:
    radial-gradient(ellipse at 8% 5px, #ffcf55 0 3px, transparent 4px),
    radial-gradient(ellipse at 27% 8px, #ff6c70 0 3px, transparent 4px),
    radial-gradient(ellipse at 48% 5px, #50d5b2 0 3px, transparent 4px),
    radial-gradient(ellipse at 69% 8px, #71b8ff 0 3px, transparent 4px),
    radial-gradient(ellipse at 91% 5px, #ffcf55 0 3px, transparent 4px);
  animation: holiday-twinkle 2.8s ease-in-out infinite alternate;
}
.holiday-emoji { position: absolute; display: block; opacity: .86; filter: drop-shadow(0 3px 8px #17486c20); animation: holiday-sway 4.5s ease-in-out infinite; }
.holiday-login-layer .holiday-emoji { z-index: 2; }
.holiday-emoji-1 { top: 17%; left: 3%; font-size: clamp(22px, 3vw, 38px); }
.holiday-emoji-2 { top: 54%; right: 3%; font-size: clamp(18px, 2.5vw, 31px); animation-delay: -1.3s; }
.holiday-emoji-3 { right: 15%; bottom: 8%; font-size: clamp(16px, 2.3vw, 28px); animation-delay: -2.2s; }
.holiday-emoji-4 { top: 34%; left: 8%; font-size: clamp(17px, 2.4vw, 29px); animation-delay: -.7s; }
.holiday-emoji-5 { right: 12%; top: 15%; font-size: clamp(19px, 2.6vw, 32px); animation-delay: -1.8s; }
.holiday-flakes { position: absolute; inset: 0; overflow: hidden; }
.holiday-flake { position: absolute; top: -8%; left: var(--flake-x); color: #fff; font-size: var(--flake-size); line-height: 1; opacity: .66; text-shadow: 0 1px 5px #1483c766; animation: holiday-fall var(--flake-duration) linear var(--flake-delay) infinite; }
.holiday-thread-layer { z-index: 0; }
.holiday-thread-layer .holiday-lights { top: 0; right: 5%; left: 5%; }
.holiday-thread-layer .holiday-flake { opacity: .42; }
.holiday-thread-layer .holiday-emoji { opacity: .28; filter: none; }
.holiday-thread-layer .holiday-emoji-1 { top: 20%; left: 5%; font-size: 30px; }
.holiday-thread-layer .holiday-emoji-2 { top: 54%; right: 5%; font-size: 26px; animation-delay: -1.3s; }
.holiday-thread-layer .holiday-emoji-3 { right: 18%; bottom: 13%; font-size: 23px; animation-delay: -2.2s; }
.christmas-season .topbar { position: relative; isolation: isolate; }
.christmas-season .topbar::after {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  left: 0;
  height: 10px;
  border-top: 2px solid #16855080;
  background-image:
    radial-gradient(circle, #ffcf55 0 3px, transparent 4px),
    radial-gradient(circle, #ff6c70 0 3px, transparent 4px),
    radial-gradient(circle, #50d5b2 0 3px, transparent 4px),
    radial-gradient(circle, #71b8ff 0 3px, transparent 4px);
  background-position: 8px 3px, 25px 5px, 42px 3px, 59px 5px;
  background-size: 68px 10px;
  content: "";
  pointer-events: none;
  animation: holiday-twinkle 2.8s ease-in-out infinite alternate;
}
.christmas-season .topbar > .brand, .christmas-season .topbar > .topbar-actions { position: relative; z-index: 1; }
.christmas-season .thread { isolation: isolate; }
.christmas-season .thread-empty, .christmas-season .thread-content { position: relative; z-index: 1; }
.christmas-season .messages { background-color: transparent !important; }
@keyframes holiday-fall {
  from { transform: translate3d(0, -8vh, 0) rotate(0deg); }
  to { transform: translate3d(var(--flake-drift), 112vh, 0) rotate(260deg); }
}
@keyframes holiday-sway { 50% { transform: translateY(-7px) rotate(5deg); } }
@keyframes holiday-twinkle { to { filter: brightness(1.35); opacity: .72; } }
@media (max-width: 760px) {
  .holiday-login-layer .holiday-emoji-1 { left: 2%; }
  .holiday-login-layer .holiday-emoji-2 { right: 2%; }
  .holiday-login-layer .holiday-emoji-3 { right: 12%; bottom: 6%; }
}
@media (prefers-reduced-motion: reduce) {
  .christmas-season .holiday-flake,
  .christmas-season .holiday-emoji,
  .christmas-season .holiday-lights,
  .christmas-season .topbar::after { animation: none !important; }
  .christmas-season .holiday-flake { opacity: .35; }
}

/* Mobile login restored to the compact reference composition. */
.hero-floating-sticker-link-mobile { display: none; }
@media (min-width: 761px) {
  .hero-emoji-four, .hero-emoji-five { display: none; }
}
@media (max-width: 760px) {
  body.login-active:not(.witchee-assist-active) { min-width: 0; }
  body.login-active:not(.witchee-assist-active) #login-view {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--surface);
  }
  body.login-active:not(.witchee-assist-active) #login-view > .login-hero {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 100%;
    height: min(75vw, 300px);
    min-height: 180px;
    max-height: 300px;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: radial-gradient(ellipse at 52% 44%, #17445f 0%, #0d304c 39%, transparent 72%), linear-gradient(135deg, #06162a 0%, #092844 54%, #06172a 100%);
    box-shadow: none;
    pointer-events: auto;
  }
  body.login-active:not(.witchee-assist-active) #login-view > .login-hero::after {
    position: absolute;
    z-index: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: 24%;
    background: linear-gradient(180deg, transparent 0%, var(--surface) 100%);
    content: "";
    pointer-events: none;
  }
  body.login-active:not(.witchee-assist-active) #login-view .login-people {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transform-origin: center;
    animation: login-mobile-art-float 6.2s ease-in-out infinite;
  }
  body.login-active:not(.witchee-assist-active) #login-view > .login-card {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - min(75vw, 300px));
    min-height: calc(100svh - min(75vw, 300px));
    min-height: calc(100dvh - min(75vw, 300px));
    margin: 0;
    padding: clamp(8px, 3.5vw, 15px) clamp(14px, 5.5vw, 24px) calc(8px + env(safe-area-inset-bottom));
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body.login-active:not(.witchee-assist-active) #login-view .login-brand {
    position: relative;
    top: auto;
    left: auto;
    z-index: 2;
    align-self: flex-start;
    gap: clamp(5px, 2vw, 9px);
    margin: 0 0 clamp(13px, 5.5vw, 23px);
    font-size: clamp(11px, 4.5vw, 18px);
    line-height: 1;
  }
  body.login-active:not(.witchee-assist-active) #login-view .brand-mark-image.login-logo-mark {
    width: clamp(22px, 8vw, 38px);
    height: clamp(22px, 8vw, 38px);
    flex: 0 0 clamp(22px, 8vw, 38px);
    border-radius: clamp(6px, 2.5vw, 10px);
  }
  body.login-active:not(.witchee-assist-active) #login-view .login-brand .brand-wordmark {
    font-size: clamp(11px, 4.5vw, 18px);
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-eyebrow {
    max-width: 100%;
    margin: 0 0 clamp(7px, 3.5vw, 14px);
    font-size: clamp(8px, 3.4vw, 13px);
    letter-spacing: .1em;
    line-height: 1.25;
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-title {
    max-width: 100%;
    margin: 0 0 clamp(5px, 2vw, 8px);
    font-size: clamp(16px, 6.7vw, 27px);
    line-height: 1.15;
  }
  body.login-active:not(.witchee-assist-active) #login-view .login-card > .muted {
    max-width: 100%;
    margin: 0 0 clamp(9px, 4vw, 16px);
    font-size: clamp(9px, 3.5vw, 14px);
    line-height: 1.25;
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-form {
    gap: clamp(3px, 1.2vw, 6px);
    margin: 0;
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-credentials {
    display: grid;
    gap: clamp(2px, .8vw, 4px);
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-form label {
    margin: 0;
    font-size: clamp(8px, 3.3vw, 13px);
    line-height: 1.15;
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-form input {
    min-height: clamp(24px, 10vw, 40px);
    padding: 4px clamp(8px, 3.5vw, 14px);
    border-radius: clamp(6px, 2.5vw, 10px);
    font-size: clamp(10px, 4vw, 16px);
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-form .primary-button,
  body.login-active:not(.witchee-assist-active) #login-view #login-form .login-secondary {
    min-height: clamp(24px, 10vw, 40px);
    padding: 4px clamp(8px, 3vw, 12px);
    border-radius: clamp(6px, 2.5vw, 10px);
    font-size: clamp(9px, 3.6vw, 14px);
    line-height: 1.15;
  }
  body.login-active:not(.witchee-assist-active) #login-view #login-error {
    min-height: 0;
    font-size: clamp(8px, 3.2vw, 12px);
  }
  body.login-active:not(.witchee-assist-active) #login-view .register-prompt {
    gap: clamp(5px, 2.5vw, 10px);
    margin-top: clamp(24px, 13vw, 52px);
    padding-top: clamp(10px, 4.5vw, 18px);
    font-size: clamp(8px, 3.4vw, 13px);
  }
  body.login-active:not(.witchee-assist-active) #login-view #register-open-button {
    min-height: clamp(22px, 9vw, 36px);
    padding: 4px clamp(7px, 3vw, 12px);
    border-radius: clamp(6px, 2.5vw, 10px);
    font-size: clamp(9px, 3.5vw, 14px);
  }
  body.login-active:not(.witchee-assist-active) #login-view .recovery-box {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    margin-top: clamp(6px, 2.8vw, 11px);
    font-size: clamp(8px, 3.4vw, 13px);
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-emoji {
    z-index: 3;
    display: block;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    filter: drop-shadow(0 2px 4px #123b5d50);
    line-height: 1;
    animation: float-emoji 4.8s ease-in-out infinite;
    pointer-events: none;
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-emoji-one {
    top: 34%; left: 3%; font-size: clamp(20px, 8.8vw, 36px);
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-emoji-two {
    top: 10%; left: 5%; font-size: clamp(22px, 10vw, 40px); animation-delay: -1.5s;
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-emoji-three {
    top: auto; right: 4%; bottom: 6%; left: auto; font-size: clamp(18px, 8vw, 33px); animation-delay: -2.2s;
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-emoji-four,
  body.login-active:not(.witchee-assist-active) #login-view .hero-emoji-five { display: none; }
  body.login-active:not(.witchee-assist-active) #login-view .hero-floating-sticker-link {
    display: none;
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-service-logo-t {
    top: 56%;
    left: 2%;
    width: clamp(24px, 8vw, 34px);
    height: clamp(24px, 8vw, 34px);
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-service-logo-location {
    top: 52%;
    right: 8%;
    bottom: auto;
    left: auto;
    width: clamp(46px, 14vw, 58px);
    height: clamp(46px, 14vw, 58px);
    filter: drop-shadow(0 2px 5px #1a5d88a8);
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-tas-sticker {
    position: absolute;
    z-index: 5;
    display: block;
    width: clamp(30px, 12vw, 48px);
    height: clamp(30px, 12vw, 48px);
    animation: float-sticker 5.8s ease-in-out infinite;
    filter: drop-shadow(0 3px 7px #123b5d65);
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-tas-sticker-center {
    top: 33%;
    left: calc(50% - clamp(15px, 6vw, 24px));
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-tas-sticker-float {
    top: 6%;
    right: 7%;
    width: clamp(25px, 9vw, 38px);
    height: clamp(25px, 9vw, 38px);
    animation-delay: -2.8s;
  }
  body.login-active:not(.witchee-assist-active) #login-view .hero-tas-sticker .hero-floating-sticker {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  @keyframes login-mobile-art-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.01); }
  }
}
@media (prefers-reduced-motion: reduce) {
  body.login-active:not(.witchee-assist-active) #login-view .login-people { animation: none !important; }
}
/* Keep the desktop sign-in card completely inside short browser viewports. */
@media (min-width: 761px) and (max-height: 760px) {
  html, body { height: 100%; min-height: 0; }
  body.login-active {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  body.login-active #login-view {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    box-sizing: border-box;
    overflow: hidden;
    gap: clamp(18px, 3.5vw, 48px);
    padding: clamp(12px, 2.5vh, 22px) clamp(18px, 3vw, 42px);
  }
  body.login-active #login-view > .login-hero {
    height: min(78vh, calc(100dvh - 32px));
    min-height: 0;
  }
  body.login-active #login-view > .login-card {
    min-height: 0;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: clamp(16px, 2.6vh, 26px) clamp(20px, 2.5vw, 32px);
  }
  body.login-active #login-view .login-brand { margin-bottom: clamp(10px, 2vh, 16px); }
  body.login-active #login-view #login-eyebrow { margin-bottom: clamp(6px, 1.4vh, 10px); }
  body.login-active #login-view #login-title {
    margin-bottom: clamp(3px, .7vh, 5px);
    font-size: clamp(24px, 4vh, 29px);
  }
  body.login-active #login-view .login-card > .muted { margin-bottom: clamp(8px, 1.7vh, 13px); }
  body.login-active #login-view #login-form { gap: clamp(4px, .9vh, 6px); }
  body.login-active #login-view #login-credentials { gap: clamp(1px, .4vh, 3px); }
  body.login-active #login-view #login-form label { margin-top: 2px; font-size: 13px; line-height: 1.15; }
  body.login-active #login-view #login-form input {
    min-height: clamp(34px, 5.2vh, 38px);
    padding: 6px 10px;
  }
  body.login-active #login-view #login-form .primary-button,
  body.login-active #login-view #login-form .login-secondary {
    min-height: clamp(36px, 5.7vh, 40px);
    padding: 5px 10px;
  }
  body.login-active #login-view .register-prompt {
    gap: 6px;
    margin-top: clamp(10px, 1.8vh, 14px);
    padding-top: clamp(8px, 1.5vh, 11px);
  }
  body.login-active #login-view #register-open-button { min-height: 34px; }
  body.login-active #login-view .recovery-box { margin-top: 8px; font-size: 12px; }
}
/* Let the desktop page background continue behind the centered login layout. */
@media (min-width: 761px) {
  body.login-active {
    background: radial-gradient(ellipse at 8% 15%, var(--login-glow) 0%, transparent 42%), var(--surface);
  }
  body.login-active #login-view { background: transparent; }
}

body.home-custom-dark #login-view .login-card { color: #eaf4fb; }
body.home-custom-dark #login-view .login-card .stack-form label { color: #c5d7e5; }
body.home-custom-dark #login-view .login-card > .muted,
body.home-custom-dark #login-view .login-card .muted { color: #a9bdcc; }
body.home-custom-dark #login-view .login-card .register-prompt { color: #b6c9d7; }

/* Chat interaction polish requested for the compact mobile messenger layout. */
@media (max-width: 760px) {
  .mobile-tabs,
  .app-view.thread-mode .mobile-tabs,
  .app-view.admin-mode .mobile-tabs { display: none !important; }
  #app-view.home-chat-mode:not(.thread-mode):not(.admin-mode) .mobile-tabs {
    position: fixed; z-index: 30; right: 10px; bottom: max(8px, env(safe-area-inset-bottom)); left: 10px;
    width: auto; height: 66px; padding: 5px; display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; overflow: hidden;
    border: 1px solid #a4d5f055; border-radius: 22px; background: #102333c9; color: #e7f2f8;
    box-shadow: 0 12px 38px #0007, inset 0 1px 0 #ffffff35, inset 0 -1px 0 #7bd1ff20;
    -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  }
  #app-view.home-chat-mode .mobile-tabs::before,
  #app-view.home-chat-mode .mobile-tabs::after { position: absolute; z-index: 0; pointer-events: none; content: ""; }
  #app-view.home-chat-mode .mobile-tabs::before {
    inset: 0; border-radius: inherit;
    background: linear-gradient(164deg, #ffffff35 0%, #ffffff12 14%, transparent 42%, #85dcff08 70%, #ffffff15 100%);
  }
  #app-view.home-chat-mode .mobile-tabs::after { top: 1px; left: 12%; width: 76%; height: 1px; background: linear-gradient(90deg, transparent, #e8fbff9c, transparent); filter: blur(.3px); }
  #app-view.home-chat-mode .mobile-tabs > button { position: relative; z-index: 1; min-width: 0; }
  #app-view.home-chat-mode .mobile-profile-tab { display: grid; place-items: center; padding: 0; }
  #app-view.home-chat-mode .mobile-profile-avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .group-create { position: relative; z-index: 12; margin: 8px; padding: 12px; border: 1px solid #6ccafa45; border-radius: 16px; background: #102333e8; box-shadow: 0 10px 24px #0005, inset 0 1px #ffffff18; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  .group-create-heading { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 8px; color: var(--ink); }
  .group-create-heading .icon-button { width: 32px; height: 32px; border-radius: 9px; }
  .camera-button { display: grid !important; }
  .composer .icon-button, .composer .attach-button { display: grid; place-items: center; width: 38px; height: 40px; flex: 0 0 38px; padding: 0; border: 0 !important; border-radius: 8px !important; background: transparent !important; box-shadow: none !important; color: #bdd3df !important; }
  .composer .icon-button:hover, .composer .attach-button:hover { background: #ffffff10 !important; color: #62c6ff !important; }
  .composer .ui-icon { width: 22px; height: 22px; }
  .composer .voice-button.recording { color: #ff6d79 !important; animation: record-pulse 1.2s ease-in-out infinite; }
  .composer .camera-button { cursor: pointer; }
  .reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 10px 5px; padding: 8px 11px; border: 1px solid #83d5ff3d; border-left: 3px solid #39b7fa; border-radius: 12px; background: #13334abf; color: var(--ink); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .reply-preview > div { min-width: 0; display: grid; gap: 2px; }
  .reply-preview strong { color: #75caff; font-size: 11px; }
  .reply-preview span { overflow: hidden; color: #c4d5df; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
}

.message::before, .message::after { display: none !important; content: none !important; }
.message-attachment[hidden], .message-bubble[hidden], .mobile-tabs[hidden] { display: none !important; }
.message { position: relative; align-items: flex-start; gap: 4px; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.message.own { align-items: flex-end; }
.message-bubble { width: fit-content; max-width: 100%; padding: 8px 12px; border: 1px solid #344757; border-radius: 16px 16px 16px 6px; background: #26313c; color: #e8f1f7; }
.message.own .message-bubble { border-color: #24557a; border-radius: 16px 16px 6px 16px; background: #15344b; }
.message-body { width: auto; max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; overflow-wrap: anywhere; }
.message-footer { min-height: 12px; margin-top: 4px; padding: 0; color: #9db1c1; font-size: 10px; }
.group-sender-avatar { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; overflow: hidden; border: 1px solid #8da7b7; border-radius: 50%; font-size: 7px; line-height: 1; }
.group-sender-avatar[hidden] { display: none !important; }
.message.group-incoming .message-footer { justify-content: flex-start; }
.message.group-incoming .message-footer .group-sender-avatar { order: 0; }
.message.group-incoming .message-footer time { order: 1; margin-left: 0; }
.message-status { font-weight: 750; letter-spacing: -2px; }
.message-attachment:not(.visual-media) { position: relative; width: fit-content; max-width: 100%; padding: 8px 11px; border: 1px solid #344757; border-radius: 15px 15px 15px 6px; background: #26313c; overflow-wrap: anywhere; }
.message.own .message-attachment:not(.visual-media) { border-color: #24557a; border-radius: 15px 15px 6px 15px; background: #15344b; }
.message-attachment.visual-media { position: relative; display: grid; gap: 7px; width: fit-content; max-width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; }
.message-media-item { position: relative; width: fit-content; max-width: 100%; }
.attachment-image-open { max-width: 100%; }
.message-image, .message-video { display: block; max-width: min(460px, 70vw); max-height: min(60vh, 620px); border-radius: 15px; object-fit: contain; }
.message-video { background: #080e14; }
.attachment-footer { position: absolute; right: 8px; bottom: 8px; min-height: auto; margin: 0; padding: 4px 7px; border: 1px solid #ffffff20; border-radius: 999px; background: #06121bc9; color: #edf7fd; text-shadow: 0 1px 3px #000; -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); }
.message-reply-quote { display: grid; gap: 2px; margin: 0 0 6px; padding: 4px 8px; border-left: 2px solid #4bb9f7; border-radius: 4px; background: #ffffff0b; }
.message-reply-quote strong { color: #82cefa; font-size: 10px; }
.message-reply-quote span { max-width: 100%; color: #c7d7e2; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-media-item .media-forward-button { position: absolute; top: 9px; right: 9px; z-index: 2; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid #ffffff48; border-radius: 50%; background: #102434b8; color: white; box-shadow: 0 4px 16px #0006; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.message-media-item .media-forward-button .ui-icon { width: 19px; height: 19px; }
.message-pinned .message-bubble::after { content: "Fijado"; display: block; margin-top: 4px; color: #84d0ff; font-size: 9px; }
.message-reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 1px; }
.reaction-chip, .message-reaction-picker button { min-width: 35px; min-height: 30px; padding: 3px 8px; border: 1px solid #88c9e64a; border-radius: 999px; background: #102b3bbd; color: var(--ink); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.reaction-chip.mine { border-color: #4fc4ff; background: #125073ce; }
.message-action-content { display: grid; gap: 12px; }
.message-reaction-picker { display: flex; justify-content: space-between; gap: 6px; padding: 8px; border: 1px solid #ffffff24; border-radius: 18px; background: #cdeeff14; box-shadow: inset 0 1px #ffffff22; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.message-reaction-picker button { width: 42px; height: 42px; padding: 0; background: #ffffff14; font-size: 20px; }
.message-action-excerpt { margin: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .icon-button, .composer .attach-button { border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: #bdd3df; }
.composer .icon-button:hover, .composer .attach-button:hover { background: #ffffff10; color: #62c6ff; }
.composer .voice-button { background: transparent; color: #bdd3df; }
.composer .voice-button:hover { background: #ffffff10; color: #62c6ff; }
.forward-destinations { display: grid; max-height: min(48dvh, 360px); gap: 6px; overflow: auto; }
.forward-destination { min-height: 42px; padding: 9px 12px; border: 1px solid #ffffff20; border-radius: 12px; background: #ffffff0b; color: var(--ink); text-align: left; }
.forward-destination:hover { border-color: #53baf3; background: #55bdf31a; }
.action-dialog { border-color: #93c9e54f; background: #102433ed; box-shadow: 0 24px 80px #0009, inset 0 1px #ffffff23; -webkit-backdrop-filter: blur(22px) saturate(165%); backdrop-filter: blur(22px) saturate(165%); }
.action-dialog::backdrop { background: #02080db5; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.action-dialog .dialog-heading { background: linear-gradient(110deg, #ffffff15, transparent 70%); }

@media (max-width: 760px) {
  .message { max-width: 88%; }
  .message.media-message { max-width: 91%; }
  .message-bubble { padding: 8px 11px; }
  .message-image, .message-video { max-width: min(360px, 78vw); max-height: min(54vh, 520px); }
  .action-dialog { width: min(420px, calc(100vw - 28px)); max-width: calc(100vw - 28px); }
}

/* Final cascade for media fixes and the bottom composer. */
.holiday-lights { height: 24px; background: none !important; }
.holiday-bulb { position: absolute; top: var(--bulb-y); left: var(--bulb-x); width: 8px; height: 13px; border: 1px solid #ffffff75; border-radius: 50% 50% 45% 45%; background: hsl(var(--bulb-hue) 96% 62%); box-shadow: 0 0 7px 2px hsl(var(--bulb-hue) 96% 62% / .72); animation: holiday-bulb-color 18s linear var(--bulb-delay) infinite; }
.holiday-bulb::before { position: absolute; top: -4px; left: 2px; width: 3px; height: 4px; border-radius: 2px 2px 0 0; background: #9fb3bb; content: ""; }
.holiday-thread-layer .holiday-bulb { transform: scale(.78); transform-origin: top center; }
.christmas-season .topbar::after { height: 17px; background-position: 8px 2px, 25px 10px, 42px 3px, 59px 11px; background-size: 68px 17px; animation: holiday-color-shift 22s linear infinite; }
.message-media-item { display: grid; justify-items: end; gap: 2px; }
.message-media-visual { position: relative; display: block; width: fit-content; max-width: 100%; line-height: 0; }
.attachment-footer { position: absolute; right: 9px; bottom: 8px; display: flex; gap: 5px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #f4fbff; text-shadow: 0 1px 3px #000, 0 0 7px #000; -webkit-backdrop-filter: none; backdrop-filter: none; line-height: 1.2; }
.message-media-item .media-forward-button { position: static; justify-self: end; display: grid; place-items: center; width: 34px; height: 30px; padding: 0; border: 1px solid #a7d8f23f; border-radius: 10px; background: #10243480; color: #e9f7ff; box-shadow: none; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.message-image, .attachment-image-open { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: pan-y; }
.message-image { pointer-events: none; }
.message-video { -webkit-touch-callout: none; }
@media (max-width: 760px) {
  .thread { padding-bottom: 0 !important; }
  .thread-mode .thread-content { padding-bottom: 0; }
  .thread-mode .composer { margin-bottom: 0; padding-bottom: max(7px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .holiday-bulb, .christmas-season .topbar::after, .story-progress-segment.current::after { animation: none !important; }
}

/* Final visual fixes for the settings drawer, call dates, and chat previews. */
#settings-dialog.settings-drawer[open] { position: fixed; z-index: 35; inset: 42px 0 0 auto; display: flex; flex-direction: column; width: min(390px, 100vw); height: calc(100dvh - 42px); max-height: none; margin: 0; overflow: auto; border: 1px solid var(--line); border-right: 0; border-bottom: 0; border-radius: 18px 0 0 0; background: var(--panel); box-shadow: -18px 0 44px #07152133; }
#settings-dialog.settings-drawer::backdrop { display: none; }
.settings-drawer-header { position: sticky; top: 0; z-index: 2; justify-content: space-between; min-height: 64px; background: var(--panel); }
.settings-drawer-header h2 { margin: 0; font-size: 17px; }
.settings-drawer-header .eyebrow { margin: 0 0 3px; }
#settings-dialog .settings-group > summary { min-height: 58px; padding: 9px 16px; }
#settings-dialog .settings-group-content { padding: 8px 16px 16px; }
#settings-dialog .settings-shortcuts { gap: 0; }
#settings-dialog .settings-shortcuts .panel-row { min-height: 43px; padding: 6px 0; border-bottom: 1px solid var(--line); text-align: left; }
.settings-check { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; }
.settings-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.contact-call-history-item { display: flex; align-items: center; gap: 9px; }
.contact-call-history-item .contact-open { flex: 1; }
.contact-history-copy { display: grid; min-width: 0; gap: 3px; text-align: left; }
.contact-history-copy strong { display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.contact-history-copy > span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.contact-call-date { flex: 0 0 auto; align-self: flex-start; margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.call-contacts-heading { padding-top: 12px; border-top: 1px solid var(--line); }
.message.system { align-self: center; max-width: min(88%, 580px); }
.message.system .message-bubble { padding: 5px 11px; border: 1px solid #ffffff0f; border-radius: 999px; background: #193247aa; box-shadow: none; text-align: center; }
.message.system .message-body { color: var(--muted); font-size: 11px; line-height: 1.4; }
.message.system .message-footer { display: none; }
.conversation-preview { display: block; width: 100%; min-width: 0; max-width: 100%; }
.holiday-lights { top: 0; right: 0; left: 0; width: 100%; height: 28px; border: 0; background: none !important; }
.holiday-lights::before { position: absolute; inset: 0 0 auto; height: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 24' preserveAspectRatio='none'%3E%3Cpath d='M0 4 C90 25 180 25 300 4 S510 -10 600 4 S810 25 900 4 S1110 -10 1200 4' fill='none' stroke='%23168550' stroke-width='2'/%3E%3C/svg%3E") center top / 100% 22px no-repeat; content: ""; }
.holiday-bulb { transform: translateX(-50%); }
.holiday-thread-layer .holiday-lights { right: 0; left: 0; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
#new-group-button[hidden] { display: none !important; }
body.settings-open .mobile-tabs { visibility: hidden; }
@media (max-width: 760px) {
  #settings-dialog.settings-drawer[open] { inset: 0 0 0 auto; width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .settings-drawer-header { min-height: 56px; padding-top: env(safe-area-inset-top); }
  .holiday-lights { height: 24px; }
  .holiday-lights::before { height: 20px; }
}

/* Last cascade: global TAS wallpaper, call controls and clickable group members. */
body { position: relative; isolation: isolate; background: #071521; }
body > #login-view, body > #app-view { position: relative; z-index: 2; }
#app-view, #chat-view, .chat-layout { background: transparent !important; }
#app-view .topbar, #app-view .mobile-tabs, #app-view .thread-header, #app-view .composer, #app-view .contact-panel-header, #app-view .message-search-bar { background-color: rgba(7, 22, 34, .78) !important; }
#app-view .sidebar, #app-view .thread, #app-view .contact-panel, #app-view .admin-layout, #app-view .admin-card { background-color: rgba(7, 21, 33, .54) !important; }
#app-view .messages:not(.has-chat-wallpaper) { background: transparent !important; }
#app-view .conversation-item, #app-view .contact-item, #app-view .contact-profile, #app-view .contact-panel-section, #app-view .group-info-summary { background-color: rgba(9, 25, 38, .44) !important; }
#app-view .conversation-item.active { background-color: rgba(21, 66, 94, .72) !important; }
#app-view .admin-user { background-color: rgba(12, 31, 45, .70) !important; }
#app-view #settings-dialog.settings-drawer[open], #app-view .app-dialog, #app-view .action-dialog { background-color: rgba(9, 27, 41, .82) !important; -webkit-backdrop-filter: blur(18px) saturate(145%); backdrop-filter: blur(18px) saturate(145%); }
.holiday-global-layer { position: fixed; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.holiday-global-layer .holiday-flake { opacity: .72; }
button.group-current-member { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.group-current-member:hover, button.group-current-member:focus-visible { border-radius: 10px; outline: 1px solid #61c5ff75; background: rgba(58, 158, 216, .13); }
.call-panel { padding: 0 !important; overflow: hidden; background: rgba(4, 17, 28, .50) !important; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.call-videos { margin: 0 !important; border-radius: 0 !important; background: #03080e; }
.call-footer { position: absolute; z-index: 6; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; display: flex; justify-content: center; padding: 0 12px; pointer-events: none; }
.call-controls { justify-content: center; gap: clamp(8px, 2vw, 15px); pointer-events: auto; }
.call-control-button { position: relative; isolation: isolate; min-width: 72px; min-height: 62px; overflow: hidden; padding: 8px 11px; border: 1px solid #e4f7ff6b; border-radius: 17px; background: linear-gradient(145deg, #f3fbff55 0%, #b4e8ff20 42%, #102b3aaa 100%); color: #f3fbff; box-shadow: inset 0 1px 0 #ffffff91, inset 0 -1px 0 #ffffff14, 0 10px 28px #0006; -webkit-backdrop-filter: blur(18px) saturate(175%); backdrop-filter: blur(18px) saturate(175%); text-shadow: 0 1px 4px #071521b5; }
.call-control-button::before { position: absolute; z-index: -1; top: 1px; right: 16%; left: 16%; height: 1px; background: linear-gradient(90deg, transparent, #fff, transparent); content: ""; opacity: .82; }
.call-control-button .ui-icon { width: 23px; height: 23px; filter: drop-shadow(0 1px 2px #001); }
.call-control-button[aria-pressed="true"] { border-color: #b6e4f9a3; background: linear-gradient(145deg, #ffffff50, #344f63c9); }
.call-control-button.call-hangup { min-width: 76px; border-color: #ff9aabb5; background: linear-gradient(145deg, #ff829088, #a30625e8); }
.call-control-button.call-hangup:hover { background: linear-gradient(145deg, #ffa1aa, #d51f32); }
.call-status-copy { display: none !important; }
.local-video-tile, .call-videos #remote-video { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; cursor: grab; }
.local-video-tile:active, .call-videos #remote-video:active { cursor: grabbing; }
.local-video-tile.camera-off { background: radial-gradient(circle at 50% 35%, #29475d, #071521 78%); }
.local-video-tile.camera-off video { visibility: hidden; }
.local-camera-off-label { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; color: #edf8ff; font-size: 12px; text-align: center; text-shadow: 0 2px 6px #000; }
.local-camera-off-label[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
@media (max-width: 760px) {
  .call-panel { padding: 0 !important; }
  .call-footer { bottom: max(14px, env(safe-area-inset-bottom)); padding: 0 9px; }
  .call-controls { gap: 8px; }
  .call-control-button { min-width: 66px; min-height: 60px; padding: 7px 8px; border-radius: 16px; }
  .call-control-button.call-hangup { min-width: 68px; }
  .local-video-tile { top: 14px; right: 14px; }
  .call-video-swapped .call-videos #remote-video { top: 14px; right: 14px; }
}
.incoming-call { background: rgba(3, 10, 17, .58) !important; -webkit-backdrop-filter: blur(18px) saturate(125%); backdrop-filter: blur(18px) saturate(125%); }
.incoming-call-card { border: 0; border-radius: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Keep native date controls inside narrow profile and registration forms. */
.stack-form,
.settings-group-content,
#settings-dialog .stack-form { min-width: 0; }
.stack-form > input,
.stack-form > select,
.stack-form > div,
.settings-group-content > input,
.settings-group-content > select { min-width: 0; max-width: 100%; }
#register-form input[type="date"],
#birth-date-setup-form input[type="date"],
#settings-dialog #profile-birth-date {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.topbar .brand { gap: 0; }

/* The TAS wallpaper belongs to an opened conversation, below its header. */
#app-view .chat-layout.conversation-open .thread { position: relative; isolation: isolate; background: transparent !important; }
#app-view .chat-layout.conversation-open .thread::before { position: absolute; z-index: 0; inset: 0; background-image: linear-gradient(rgba(7, 21, 33, .60), rgba(7, 21, 33, .60)), var(--tas-chat-background-image, url("tas-chat-background.png?v=20261201i")); background-position: center; background-size: cover; background-repeat: no-repeat; content: ""; pointer-events: none; }
#app-view .chat-layout.conversation-open .thread > :not(.holiday-global-layer) { position: relative; z-index: 2; }
#app-view .chat-layout.conversation-open .thread-content { background: transparent !important; }
#app-view .chat-layout.conversation-open .thread-header,
#app-view .chat-layout.conversation-open .composer { background-color: rgba(7, 22, 34, .64) !important; }
#app-view .chat-layout.conversation-open .messages:not(.has-chat-wallpaper) { background: transparent !important; }
.holiday-global-layer { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.chat-layout:not(.conversation-open) .holiday-global-layer { display: none; }

/* Fill the local camera preview edge to edge, overriding generic video sizing. */
#local-video-tile { box-sizing: border-box; background: #03080e; }
#local-video-tile > #local-video { position: absolute !important; inset: 0 !important; display: block !important; width: 100% !important; height: 100% !important; min-width: 100% !important; min-height: 100% !important; max-width: none !important; max-height: none !important; border: 0 !important; border-radius: 0 !important; object-fit: cover !important; object-position: center !important; }
#local-video-tile.camera-off > #local-video { visibility: hidden !important; }
.call-video-swapped #local-video-tile > #local-video { transform: none !important; }

/* Keep native date controls within their single-column form tracks on iPhone. */
.stack-form { width: 100%; grid-template-columns: minmax(0, 1fr); }
.stack-form > *, .settings-group-content > * { min-width: 0; max-width: 100%; }
input[type="date"] {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  padding-inline: 8px;
  overflow: hidden;
  font-size: 16px;
}
input[type="date"]::-webkit-date-and-time-value { min-inline-size: 0; text-align: start; }
input[type="date"]::-webkit-calendar-picker-indicator { max-inline-size: 18px; margin: 0; padding: 0; }

/* Avatars stay circular and crop tall uploads without stretching them. */
.avatar { isolation: isolate; }
.avatar > img { position: absolute; z-index: 0; inset: 0; display: block; width: 100%; height: 100%; min-width: 100%; min-height: 100%; max-width: none; max-height: none; border-radius: 50%; object-fit: cover; object-position: center; pointer-events: none; }
.presence-dot { z-index: 2; }
.profile-avatar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.profile-avatar-actions > button { min-width: 0; }

/* Story navigation uses screen taps; keep the media and footer unselectable. */
.story-viewer-nav { display: none !important; }
.story-viewer-media { position: relative; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.story-viewer-media img, .story-viewer-media video { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.story-viewer-views { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 42px; padding: 5px 2px 0; }
.story-viewer-views[hidden] { display: none !important; }
.story-viewer-view-count { flex: 0 0 auto; color: #e8f4fd; font-size: 12px; font-weight: 700; }
.story-viewer-viewers { display: flex; min-width: 0; align-items: center; gap: 7px; overflow-x: auto; }
.story-viewer-viewer-avatar { position: relative; flex: 0 0 27px; width: 27px; height: 27px; font-size: 9px; }
.story-viewer-viewer-liked { position: absolute; z-index: 3; right: -3px; bottom: -3px; display: grid; width: 13px; height: 13px; place-items: center; border: 1px solid #07121e; border-radius: 50%; background: #e94774; color: white; font-size: 9px; line-height: 1; }
.story-viewer-like-heart { position: absolute; z-index: 4; top: 50%; left: 50%; color: #ff5884; font-size: clamp(72px, 22vw, 128px); opacity: 0; pointer-events: none; transform: translate(-50%, -40%) scale(.25) rotate(-18deg); text-shadow: 0 8px 35px #0009; }
.story-viewer-like-heart.animate { animation: story-like-pop .72s cubic-bezier(.16,.88,.32,1.3) both; }
@keyframes story-like-pop { 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(8deg); } 68% { opacity: 1; transform: translate(-50%, -54%) scale(.92) rotate(-4deg); } 100% { opacity: 0; transform: translate(-50%, -70%) scale(.68) rotate(0); } }

/* Calls and stories occupy the available screen without a stale bottom bar. */
@media (max-width: 760px) {
  body[data-mobile-section="calls"] #app-view .mobile-tabs,
  body[data-mobile-section="status"] #app-view .mobile-tabs { display: none !important; }
  body.section-status #chat-view { display: flex !important; flex: 1 1 auto; min-height: 0; overflow: hidden; }
  body.section-status #chat-view .chat-layout { display: flex !important; flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; }
  body.section-status #chat-view .sidebar { display: flex; flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; max-height: none; overflow: hidden; }
  body.section-status #chat-view .contact-list { min-height: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .profile-avatar-actions { grid-template-columns: minmax(0, 1fr); }
}

.call-ringtone-settings { display: grid; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.call-ringtone-settings h3, .call-ringtone-settings p { margin: 0; }
.call-ringtone-settings h3 { font-size: 15px; }
.call-ringtone-settings audio { display: block; width: min(420px, 100%); }
.call-ringtone-settings audio[hidden] { display: none !important; }
.call-ringtone-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.call-ringtone-actions button { min-height: 38px; }
.call-ringtone-settings input[type="file"] { max-width: 100%; }

/* Seasonal event controls and interaction refinements. */
.seasonal-events-settings { display: grid; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.seasonal-events-settings h3, .seasonal-events-settings p { margin: 0; }
.seasonal-event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.seasonal-event-row { display: grid; min-width: 0; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.seasonal-event-row legend { padding: 0 5px; color: var(--ink); font-size: 13px; font-weight: 750; }
.seasonal-event-row label { margin-top: 2px; color: var(--muted); font-size: 11px; }
.seasonal-event-row .settings-check { color: var(--ink); }
.seasonal-event-row input[type="date"], .seasonal-event-row select { width: 100%; min-width: 0; min-height: 36px; }
@media (max-width: 540px) { .seasonal-event-grid { grid-template-columns: minmax(0, 1fr); } }

/* The account lists use larger portraits while the tab avatar and thread header stay compact. */
.conversation-list .conversation-item > .avatar { width: 50px; height: 50px; flex-basis: 50px; }
.contact-list .contact-item .avatar { width: 43px; height: 43px; flex-basis: 43px; }
.contact-list .story-contact-item > .avatar { width: 55px; height: 55px; flex-basis: 55px; }
.conversation-list .conversation-item { min-height: 62px; }
.contact-list .contact-item { min-height: 61px; }
.contact-list .story-contact-item { min-height: 75px; }

.contact-call-history-item .call-history-open { display: flex; flex: 0 0 auto; align-items: center; padding: 0; border: 0; background: transparent; }
.contact-call-history-item .contact-history-copy { flex: 1 1 auto; gap: 4px; }
.contact-call-history-item .contact-history-copy strong { font-size: 13px; }
.call-history-info { display: block; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--muted); text-align: left; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.call-history-info:hover { color: var(--ink); }
.call-history-missed { color: #ff626f !important; }
.call-details-content { display: grid; gap: 8px; padding: 4px 2px 8px; }
.call-details-content p, .call-details-content strong { margin: 0; }
.call-details-content strong { color: var(--ink); font-size: 16px; }
.call-details-status { color: var(--muted); }
.call-info-button .ui-icon { width: 18px; height: 18px; }

.message, .message-bubble, .message-body, .message-reaction-picker { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.message-bubble, .message-body { touch-action: pan-y; }
.action-dialog.message-context-menu { border-color: #b7e5ff55; background: #10243380 !important; box-shadow: 0 20px 60px #0005, inset 0 1px #ffffff30; -webkit-backdrop-filter: blur(20px) saturate(165%); backdrop-filter: blur(20px) saturate(165%); }
.action-dialog.message-context-menu::backdrop { background: #02080d38 !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.action-dialog.message-context-menu .dialog-actions { display: flex !important; flex-direction: column; align-items: stretch; gap: 0; padding: 2px 14px 14px; }
.action-dialog.message-context-menu .dialog-actions > button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 10px 12px; border: 0; border-bottom: 1px solid #ffffff20; border-radius: 0; background: transparent; color: var(--ink); text-align: left; box-shadow: none; }
.action-dialog.message-context-menu .dialog-actions > button:last-child { border-bottom: 0; }
.action-dialog.message-context-menu .dialog-actions > button:hover { background: #ffffff17; }
.action-dialog.message-context-menu .dialog-actions > .danger-button { color: #ff7685; }
.message-reaction-picker { justify-content: space-around; gap: 5px; padding: 8px; border-color: #ffffff38; border-radius: 999px; background: #18262bb3; box-shadow: inset 0 1px #ffffff32; }
.message-reaction-picker button { flex: 0 0 40px; width: 40px; height: 40px; font-size: 21px; }
.action-list-icon { display: grid; flex: 0 0 26px; place-items: center; margin-right: 12px; color: currentColor; }
.action-list-icon .ui-icon { width: 21px; height: 21px; }
.voice-button { touch-action: none; }

.recording-indicator { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid #ffffff35; border-radius: 18px; background: #172a2dcc; color: var(--ink); box-shadow: inset 0 1px #ffffff18; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.recording-waveform .wave-bar { animation: none !important; transition: height 70ms linear; }
.recording-help { flex: 0 1 auto; color: var(--muted); font-size: 10px; font-weight: 500; white-space: nowrap; }
.recording-actions { display: flex; flex: 0 0 auto; gap: 5px; margin-left: auto; }
.recording-actions button { min-height: 30px; padding: 4px 8px; border: 1px solid #ffffff2a; border-radius: 9px; background: #ffffff12; color: var(--ink); font-size: 10px; }
.recording-actions button[data-voice-action="cancel"] { color: #ff8a95; }
.holiday-event-layer .holiday-emoji { opacity: .76; }
.holiday-thread-layer.holiday-event-layer .holiday-emoji { opacity: .24; }
.valentines-season .holiday-valentines-layer .holiday-emoji { filter: drop-shadow(0 3px 8px #ee5b9b80); }
.africa-day-season .holiday-africa-layer .holiday-emoji { filter: drop-shadow(0 3px 8px #e6b63c75); }

/* Compact action sheets: keep chat context and forwarding dialogs away from full-screen height. */
.action-dialog { width: min(420px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: min(72dvh, 620px); margin: auto; padding: 0; overflow: hidden; }
.action-dialog[open] { display: flex; flex-direction: column; }
.action-dialog .dialog-heading { flex: 0 0 auto; padding: 12px 16px; }
.action-dialog .dialog-heading .eyebrow { margin-bottom: 2px; font-size: 10px; }
.action-dialog .dialog-heading h2 { font-size: 18px; }
.action-dialog .dialog-section { flex: 0 1 auto; min-height: 0; padding: 10px 12px; overflow: auto; }
.action-dialog .dialog-actions { display: flex; flex: 0 1 auto; flex-direction: column; align-items: stretch; max-height: min(42dvh, 350px); padding: 0 10px 8px; overflow: auto; }
.action-dialog .dialog-actions > button { flex: 0 0 auto; min-height: 40px; padding: 8px 10px; }
.action-dialog.message-context-menu .dialog-heading { padding: 10px 14px; }
.action-dialog.message-context-menu .dialog-section { padding: 8px 10px; }
.action-dialog.message-context-menu .dialog-actions { max-height: min(38dvh, 320px); padding: 0 8px 8px; }
.action-dialog.message-context-menu .dialog-actions > button { min-height: 40px; padding: 7px 10px; }
.action-dialog .forward-destinations { max-height: min(44dvh, 360px); }
.message-reaction-picker { justify-content: space-around; align-items: center; gap: 5px; padding: 6px; }
.message-reaction-picker button { flex: 0 0 38px; width: 38px; height: 38px; font-size: 20px; touch-action: manipulation; }
.message-reactions-more { border-color: #83c8eb69 !important; background: #d7efff20 !important; color: #dff5ff !important; font-size: 25px !important; font-weight: 400; line-height: 1; }
.message-tone-picker { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 7px; border-radius: 18px; }
.message-tone-label { flex: 1 0 100%; color: var(--muted); text-align: center; font-size: 11px; }
.message-tone-picker button { flex: 0 0 38px; width: 38px; height: 38px; font-size: 20px; }
.message-tone-picker .message-tone-back { border-color: transparent; background: transparent; font-size: 28px; }
.message-emoji-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); max-height: min(48dvh, 390px); gap: 5px; overflow: auto; }
.message-emoji-grid > button { min-width: 0; min-height: 40px; padding: 3px; border: 1px solid #ffffff20; border-radius: 10px; background: #ffffff0c; color: var(--ink); font-size: 21px; touch-action: manipulation; }
.message-emoji-grid > button:hover { border-color: #53baf3; background: #55bdf31a; }
@media (max-width: 760px) {
  .action-dialog { max-height: min(72dvh, 620px); }
  .action-dialog.message-context-menu .dialog-actions { max-height: min(39dvh, 330px); }
  .message-emoji-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .conversation-list .conversation-item > .avatar { width: 50px; height: 50px; flex-basis: 50px; }
  .contact-list .contact-item .avatar { width: 43px; height: 43px; flex-basis: 43px; }
  .contact-list .story-contact-item > .avatar { width: 55px; height: 55px; flex-basis: 55px; }
  .contact-call-history-item { gap: 7px; }
  .contact-call-history-item .contact-call-date { max-width: 76px; }
  .recording-indicator { gap: 6px; padding-right: 7px; padding-left: 8px; }
  .recording-help { white-space: normal; }
  .recording-waveform { min-width: 48px; }
}
.contact-call-date { max-width: 108px; white-space: pre-line; text-align: right; line-height: 1.3; }

/* Voice recording occupies the message field itself, keeping every composer control on one row. */
.composer-main-field { position: relative; display: flex; flex: 1 1 auto; align-items: center; min-width: 0; }
.composer-main-field #message-input { width: 100%; min-width: 0; }
.composer-main-field .voice-status { display: none; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; }
.composer-main-field .voice-status.recording { display: flex; min-height: 40px; }
.composer.is-recording #message-input { display: none; }
.composer.is-recording .composer-main-field { min-width: 0; }
.composer.is-recording .voice-button { color: #fff !important; }
.recording-indicator { width: 100%; min-width: 0; min-height: 40px; gap: 7px; padding: 5px 9px; overflow: hidden; border: 1px solid #ffffff3d; border-radius: 16px; background: rgba(15, 34, 47, .78); color: var(--ink); box-shadow: inset 0 1px #ffffff20; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.recording-indicator > span, .recording-indicator > time { flex: 0 0 auto; }
.recording-indicator .recording-waveform { flex: 1 1 70px; min-width: 24px; max-width: 100px; height: 24px; }
.recording-indicator .recording-help { color: var(--muted); font-size: 10px; white-space: nowrap; }
.recording-lock-hint { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 1px; color: #c9e8f7; }
.recording-lock-icon { width: 16px; height: 16px; }
.recording-lock-arrow { font-size: 14px; line-height: 1; }
.recording-actions[hidden] { display: none !important; }
.recording-actions { gap: 4px; }
.recording-actions button { min-height: 28px; padding: 3px 7px; font-size: 10px; }

/* Incoming and outgoing audio calls share the same centered, translucent glass layer. */
.call-panel,
.incoming-call { background: rgba(4, 17, 28, .58) !important; -webkit-backdrop-filter: blur(18px) saturate(125%); backdrop-filter: blur(18px) saturate(125%); }
.incoming-call { display: grid; place-items: center; padding: 18px; }
.incoming-call-card { width: min(390px, 100%); align-items: center; justify-self: center; text-align: center; }
.incoming-call-card .large-avatar { width: clamp(120px, 24vw, 190px); height: clamp(120px, 24vw, 190px); flex-basis: auto; font-size: clamp(30px, 5vw, 46px); }
.incoming-call-card h2 { font-size: clamp(22px, 4vw, 32px); }
.call-audio-stage { align-items: center; justify-content: center; text-align: center; }
.incoming-call-card,
.call-panel:not(.video-call-active) .call-audio-stage { transform: translateY(calc(0px - var(--tas-app-topbar-height, 56px) / 2)); }

@media (max-width: 760px) {
  .composer-main-field .voice-status.recording { min-height: 38px; }
  .recording-indicator { gap: 5px; min-height: 38px; padding: 4px 6px; border-radius: 15px; }
  .recording-indicator .recording-waveform { min-width: 18px; max-width: 56px; }
  .recording-actions button { min-height: 26px; padding: 3px 5px; font-size: 9px; }
}
@media (max-width: 420px) {
  .recording-indicator { gap: 4px; padding-right: 4px; padding-left: 5px; }
  .recording-indicator .recording-help,
  .recording-indicator > .recording-label { display: none; }
  .recording-indicator .recording-waveform { min-width: 15px; max-width: 40px; }
  .recording-indicator time { font-size: 10px; }
  .recording-lock-icon { width: 14px; height: 14px; }
  .recording-lock-arrow { font-size: 12px; }
  .recording-actions { gap: 2px; }
  .recording-actions button { padding: 2px 4px; font-size: 8px; }
}

#register-form .registration-field-group { display: grid; min-width: 0; gap: 7px; }
#register-form .registration-field-group > label,
#register-form .registration-section-title { margin: 0; color: var(--ink); font-size: 13px; font-weight: 700; }
#register-form .register-name-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
#register-form .register-birth-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#register-form .register-name-fields input,
#register-form .register-birth-fields select,
#register-form .registration-field-group > select,
#register-form #register-contact { min-width: 0; width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); }
#register-form .registration-field-group input::placeholder { color: var(--muted); opacity: 1; }
#register-form .register-birth-fields select:invalid,
#register-form .registration-field-group > select:invalid { color: var(--muted); }
#register-form .registration-contact-note { margin: 0; font-size: 11px; line-height: 1.4; }
html[data-theme-resolved="dark"] #register-form .register-name-fields input,
html[data-theme-resolved="dark"] #register-form .register-birth-fields select,
html[data-theme-resolved="dark"] #register-form .registration-field-group > select,
html[data-theme-resolved="dark"] #register-form #register-contact { background: #0c1722; color: var(--ink); }

@media (max-width: 380px) {
  #register-form .register-name-fields,
  #register-form .register-birth-fields { gap: 6px; }
  #register-form .register-name-fields input,
  #register-form .register-birth-fields select { padding-right: 7px; padding-left: 8px; font-size: 12px; }
}
#profile-form .registration-field-group { display: grid; min-width: 0; gap: 7px; }
#profile-form .registration-field-group > label { margin: 0; color: var(--ink); font-size: 13px; font-weight: 700; }
#profile-form .register-name-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; min-width: 0; }
#profile-form .register-birth-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; }
#profile-form .register-name-fields input,
#profile-form .register-birth-fields select,
#profile-form .registration-field-group > select { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); }
#profile-form .register-name-fields input::placeholder { color: var(--muted); opacity: 1; }
html[data-theme-resolved="dark"] #profile-form .register-name-fields input,
html[data-theme-resolved="dark"] #profile-form .register-birth-fields select,
html[data-theme-resolved="dark"] #profile-form .registration-field-group > select { background: #0c1722; color: var(--ink); }
@media (max-width: 420px) {
  #profile-form .register-name-fields,
  #profile-form .register-birth-fields { gap: 6px; }
  #profile-form .register-name-fields input,
  #profile-form .register-birth-fields select { padding-right: 7px; padding-left: 8px; font-size: 12px; }
}

/* Account settings dashboard and stable media layout. */
#settings-dialog.settings-drawer[open] {
  position: fixed;
  z-index: 35;
  inset: max(50px, calc(env(safe-area-inset-top) + 10px)) 50% auto auto;
  display: flex;
  flex-direction: column;
  width: min(1020px, calc(100vw - 36px));
  height: min(820px, calc(100dvh - 76px));
  max-height: none;
  margin: 0;
  overflow: hidden;
  transform: translateX(50%);
  border: 1px solid #85bfd044;
  border-radius: 20px;
  background: rgba(8, 27, 40, .96);
  box-shadow: 0 24px 80px #0009;
}
#settings-dialog.settings-drawer::backdrop { display: block; background: #020b14aa; backdrop-filter: blur(7px); }
#settings-dialog .settings-drawer-header { flex: 0 0 auto; padding: 14px 20px; border-bottom: 1px solid var(--line); }
#settings-dialog .settings-drawer-header h2 { font-size: 21px; }
#settings-dialog .settings-workspace { display: grid; flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr); overflow: hidden; }
#settings-dialog .settings-nav { display: flex; flex-direction: column; gap: 5px; min-height: 0; padding: 14px 10px; overflow-y: auto; border-right: 1px solid var(--line); background: #0718248c; }
#settings-dialog .settings-nav-item { display: grid; gap: 4px; min-width: 0; padding: 11px 12px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
#settings-dialog .settings-nav-item strong { font-size: 13px; font-weight: 700; }
#settings-dialog .settings-nav-item small { color: var(--muted); font-size: 10px; line-height: 1.35; }
#settings-dialog .settings-nav-item:hover { background: #ffffff0a; }
#settings-dialog .settings-nav-item.is-active { border-color: #31b9eb55; background: #078bd51c; color: #58ceff; }
#settings-dialog .settings-content-area { min-width: 0; min-height: 0; padding: 20px clamp(16px, 3vw, 32px) 28px; overflow: auto; overscroll-behavior: contain; }
#settings-dialog .settings-page-heading { margin: 0 0 18px; padding: 0 0 15px; border-bottom: 1px solid var(--line); }
#settings-dialog .settings-page-heading h3 { margin: 0 0 5px; color: var(--ink); font-size: 20px; }
#settings-dialog .settings-page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
#settings-dialog .settings-sections > .settings-group { margin: 0; border: 0; }
#settings-dialog .settings-sections > .settings-group:not(.is-active) { display: none !important; }
#settings-dialog .settings-sections > .settings-group > summary { display: none; }
#settings-dialog.profile-settings-mode .settings-nav-item:not(.is-profile-quick) { display: none; }
#settings-dialog .settings-sections > .settings-group > .settings-group-content { padding: 0; }
#settings-dialog .settings-sections .settings-group-content { max-width: 760px; }
#settings-dialog .stack-form { gap: 11px; }
.messages[aria-busy="true"] { visibility: hidden !important; scroll-behavior: auto !important; }
.messages { scroll-behavior: auto !important; }
#local-video-tile > #local-video { transform: scaleX(-1) !important; }
.call-panel.call-video-swapped #local-video-tile > #local-video { transform: scaleX(-1) !important; }

@media (max-width: 760px) {
  #settings-dialog.settings-drawer[open] { inset: 0; width: 100vw; height: 100dvh; border: 0; border-radius: 0; transform: none; }
  #settings-dialog .settings-drawer-header { min-height: 58px; padding: max(12px, env(safe-area-inset-top)) 15px 12px; }
  #settings-dialog .settings-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #settings-dialog .settings-nav { flex-direction: row; gap: 7px; padding: 9px 10px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); }
  #settings-dialog .settings-nav-item { flex: 0 0 auto; min-width: max-content; padding: 9px 12px; }
  #settings-dialog .settings-nav-item small { display: none; }
  #settings-dialog .settings-content-area { padding: 16px 15px max(24px, env(safe-area-inset-bottom)); }
  #settings-dialog .settings-page-heading { margin-bottom: 14px; }
}

/* Admin panel follows the compact TAS Chat page layout from the supplied screenshot. */
#admin-view.admin-layout { padding: 20px 34px 32px; }
#admin-view .admin-header { align-items: center; margin-bottom: 16px; padding: 0 0 13px; border-bottom: 1px solid var(--line); }
#admin-view .admin-header .eyebrow { color: #58ceff; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
#admin-view .admin-header h1 { margin: 3px 0 5px; font-size: 22px; }
#admin-view .admin-grid { grid-template-columns: minmax(220px, 236px) minmax(0, 1fr); align-items: stretch; gap: 12px; }
#admin-view .admin-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 0; background: rgba(8, 24, 37, .88) !important; }
#admin-view .admin-card h2 { margin: 0 0 12px; }
#admin-view .admin-card > p { font-size: 11px; }
#admin-view .user-management { height: 334px; }
#admin-view .user-management > .admin-user-list { margin-top: 10px; max-height: 270px; }
#admin-view .user-management .admin-user { gap: 6px; padding: 7px; border-radius: 8px; }
#admin-view .user-management .admin-user .quiet-button,
#admin-view .user-management .admin-user .danger-button,
#admin-view .user-management .admin-user .witchee-admin-button { min-height: 30px; padding: 5px 7px; font-size: 10px; }
#admin-view .user-management .admin-user select { min-height: 30px; font-size: 11px; }
#admin-view .verification-management { min-height: 128px; }
#admin-view .verification-management .admin-user-list { margin-top: 12px; max-height: 300px; }
#admin-view .verification-management { grid-column: 1 / -1; }
#admin-view .witchee-feedback-management { grid-column: 1 / 2; }
#admin-view .site-control-card { grid-column: 1 / -1; }
#admin-view .user-management-heading { align-items: center; }
#admin-view #user-search { width: min(250px, 42%); }
#admin-view .admin-user-list { max-height: min(42vh, 360px); }
#admin-view .verification-management .admin-user-list { max-height: 340px; }
#admin-view .site-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#admin-view [hidden] { display: none !important; }

/* Center the audio call content inside the area below the TAS header. */
.incoming-call-card,
.call-panel:not(.video-call-active) .call-audio-stage { transform: none !important; }
.call-panel:not(.video-call-active) .call-footer { flex-direction: column; justify-content: center; align-items: center; gap: 14px; }
.call-panel:not(.video-call-active) .call-status-copy { text-align: center; }
.call-panel:not(.video-call-active) .call-controls { justify-content: center; width: 100%; }

/* Explicit tile dimensions avoid WebView aspect-ratio letterboxing in the mini camera. */
#local-video-tile {
  width: clamp(94px, 20vw, 178px) !important;
  height: clamp(125px, 26.67vw, 237px) !important;
  aspect-ratio: auto !important;
  background: #08111a !important;
}
#local-video-tile > #local-video {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
}
.call-video-swapped #local-video-tile { width: 100% !important; height: 100% !important; }
.call-video-swapped .call-videos #remote-video {
  width: clamp(94px, 20vw, 178px) !important;
  height: clamp(125px, 26.67vw, 237px) !important;
  aspect-ratio: auto !important;
}

@media (max-width: 760px) {
  #admin-view.admin-layout { padding: 16px 12px max(24px, env(safe-area-inset-bottom)); }
  #admin-view .admin-header { align-items: flex-start; }
  #admin-view .admin-grid { grid-template-columns: minmax(0, 1fr); }
  #admin-view .user-management { height: auto; min-height: 0; }
  #admin-view .user-management > .admin-user-list { max-height: 48vh; }
  #admin-view .verification-management,
  #admin-view .witchee-feedback-management,
  #admin-view .site-control-card { grid-column: 1; }
  #admin-view #user-search { width: 100%; }
  #admin-view .site-asset-grid { grid-template-columns: minmax(0, 1fr); }
  .call-panel:not(.video-call-active) .call-footer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

/* Account settings must cover the entire mobile viewport, including iPhone WebViews. */
@media (max-width: 760px) {
  #settings-dialog.settings-drawer[open] {
    position: fixed !important;
    inset: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
  }
  #settings-dialog .settings-workspace,
  #settings-dialog .settings-content-area,
  #settings-dialog .settings-nav { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
}

/* TAS Chat admin dashboard: a real workspace with retained account tools. */
#app-view.admin-mode > .topbar { flex: 0 0 58px; min-height: 58px; }
#app-view.admin-mode > .mobile-tabs { display: none !important; }
#admin-view.admin-layout {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #07131e !important;
  color: #e6eef5;
}
#admin-view.admin-layout[hidden] { display: none !important; }
#admin-view #admin-shell {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 238px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #07131e;
}
#admin-view .admin-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 19px 13px 14px;
  border-right: 1px solid #223747;
  background: #091a28;
}
#admin-view .admin-sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 9px 24px; }
#admin-view .admin-brand-mark { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid #137fb8; border-radius: 12px; background: linear-gradient(145deg, #068cc9, #113c64); color: #f0fbff; font-size: 19px; font-weight: 850; }
#admin-view .admin-sidebar-brand strong, #admin-view .admin-sidebar-brand small { display: block; }
#admin-view .admin-sidebar-brand strong { color: #edf5fb; font-size: 15px; letter-spacing: .025em; }
#admin-view .admin-sidebar-brand small { margin-top: 3px; color: #7691a5; font-size: 9px; font-weight: 750; letter-spacing: .15em; }
#admin-view .admin-nav-label { margin: 0 10px 9px; color: #718ba0; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
#admin-view .admin-nav { display: grid; gap: 5px; }
#admin-view .admin-nav-item, #admin-view .admin-back-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #a9bdcb;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
#admin-view .admin-nav-item:hover, #admin-view .admin-back-button:hover { background: #ffffff08; color: #f2f8fc; }
#admin-view .admin-nav-item.active { border-color: #168bd34a; background: #078bd51c; color: #6bcfff; }
#admin-view .admin-nav-icon { display: grid; width: 20px; flex: 0 0 20px; place-items: center; color: #7f9bb0; font-size: 16px; }
#admin-view .admin-nav-item.active .admin-nav-icon { color: #48c2ff; }
#admin-view .admin-nav-badge { display: grid; min-width: 19px; height: 19px; margin-left: auto; padding: 0 5px; place-items: center; border-radius: 999px; background: #d94352; color: #fff; font-size: 10px; font-weight: 800; }
#admin-view .admin-sidebar-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid #203645; }
#admin-view .admin-back-button { color: #89a5b8; }
#admin-view .admin-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
#admin-view .admin-toolbar {
  display: flex;
  flex: 0 0 66px;
  align-items: center;
  gap: 15px;
  min-width: 0;
  padding: 0 25px;
  border-bottom: 1px solid #203645;
  background: #091824;
}
#admin-view .admin-sidebar-toggle { display: none; }
#admin-view .admin-search { display: flex; align-items: center; gap: 9px; width: min(460px, 52vw); min-width: 150px; height: 38px; padding: 0 12px; border: 1px solid #263d4c; border-radius: 9px; background: #0c1c29; color: #7894a7; }
#admin-view .admin-search > span { font-size: 20px; line-height: 1; }
#admin-view #admin-global-search { width: 100%; min-width: 0; height: 34px; padding: 0; border: 0; outline: 0; background: transparent; color: #e7f1f8; font-size: 12px; box-shadow: none; }
#admin-view #admin-global-search::placeholder { color: #7d94a4; }
#admin-view .admin-notifications-button { position: relative; display: grid; width: 37px; height: 37px; margin-left: auto; place-items: center; border: 1px solid #263d4c; border-radius: 9px; background: #0e2230; color: #b7cbd7; font-size: 16px; cursor: pointer; }
#admin-view .admin-notification-dot { position: absolute; top: -5px; right: -5px; display: grid; min-width: 17px; height: 17px; padding: 0 4px; place-items: center; border: 2px solid #091824; border-radius: 99px; background: #de4551; color: white; font-size: 9px; font-weight: 800; }
#admin-view .admin-profile { display: flex; align-items: center; gap: 9px; min-width: 0; padding-left: 4px; }
#admin-view .admin-profile-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid #496375; border-radius: 50%; background: #183143; color: #dceaf2; font-size: 13px; font-weight: 750; }
#admin-view .admin-profile strong, #admin-view .admin-profile small { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#admin-view .admin-profile strong { color: #e8f1f6; font-size: 11px; }
#admin-view .admin-profile small { margin-top: 3px; color: #8299a9; font-size: 9px; }
#admin-view .admin-pages { flex: 1 1 auto; min-width: 0; min-height: 0; padding: 25px clamp(18px, 3vw, 42px) 36px; overflow: auto; overscroll-behavior: contain; }
#admin-view .admin-page { width: min(1450px, 100%); margin: 0 auto; }
#admin-view .admin-page[hidden] { display: none !important; }
#admin-view .admin-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 22px; }
#admin-view .admin-page-heading h1 { margin: 3px 0 5px; color: #edf4f8; font-size: clamp(22px, 2.2vw, 28px); letter-spacing: -.025em; }
#admin-view .admin-page-heading p { margin: 0; }
#admin-view .admin-page-heading .eyebrow { color: #48bcf4; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
#admin-view .admin-page-heading .muted { color: #91a7b5; font-size: 12px; }
#admin-view .admin-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
#admin-view .admin-metric-card { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 10px; min-width: 0; min-height: 129px; padding: 17px 15px 12px; border: 1px solid #263c4b; border-radius: 11px; background: linear-gradient(145deg, #102333, #0b1c29) !important; box-shadow: 0 8px 20px #00000012; }
#admin-view .admin-metric-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: #1689d522; color: #55c6ff; font-size: 17px; font-weight: 800; }
#admin-view .metric-active .admin-metric-icon { background: #18a87824; color: #49d7a4; }
#admin-view .metric-verification .admin-metric-icon { background: #e8a43c22; color: #f3b95a; }
#admin-view .metric-witchee .admin-metric-icon { background: #9e6bee22; color: #c29aff; }
#admin-view .admin-metric-card > div > span, #admin-view .admin-metric-card small { display: block; color: #94aab8; font-size: 10px; line-height: 1.4; }
#admin-view .admin-metric-card > div > strong { display: block; margin: 6px 0 2px; color: #edf5fa; font-size: 25px; line-height: 1; }
#admin-view .admin-metric-card > button { grid-column: 2; justify-self: start; margin-top: -1px; padding: 2px 0; border: 0; background: transparent; color: #a58cf5; font-size: 9px; cursor: pointer; }
#admin-view .admin-metric-card > button span { margin-left: 4px; }
#admin-view .admin-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(255px, .9fr); gap: 14px; margin-bottom: 15px; }
#admin-view .admin-panel-card, #admin-view .admin-card { min-width: 0; padding: 17px; border: 1px solid #253b4a !important; border-radius: 11px; background: #0a1a27 !important; color: #e2edf4; }
#admin-view .admin-panel-card h2, #admin-view .admin-card h2 { margin: 0 0 5px; color: #e6eff5; font-size: 14px; }
#admin-view .admin-panel-card p, #admin-view .admin-card > p { margin: 0; color: #8fa6b5; font-size: 10px; line-height: 1.5; }
#admin-view .admin-card { padding: 19px; }
#admin-view .admin-card > h2 { margin-bottom: 13px; }
#admin-view .admin-card > .muted { margin: -7px 0 13px; }
#admin-view .admin-card input:not([type="checkbox"]):not([type="range"]):not([type="color"]), #admin-view .admin-card select, #admin-view .admin-card textarea, #admin-view .admin-search { border-color: #2a4353; background-color: #0b1b28; color: #e7eff5; }
#admin-view .admin-card input::placeholder { color: #718a9a; }
#admin-view .admin-card .muted { color: #8fa6b5; }
#admin-view .admin-card .admin-user { border-color: #293f4f; border-radius: 9px; background: #0c1c29; }
#admin-view .admin-card .admin-user-name strong { color: #e5eef4; font-size: 11px; }
#admin-view .admin-card .admin-user-name span { color: #8fa6b5; font-size: 9px; }
#admin-view .admin-card .admin-user select { background-color: #0b1b28; color: #dce8ef; }
#admin-view .admin-card .quiet-button, #admin-view .admin-card .danger-button, #admin-view .admin-card .witchee-admin-button { border-radius: 7px; }
#admin-view .admin-card .quiet-button { border-color: #294354; background: #122a3a; color: #d9e8f1; }
#admin-view .admin-card .quiet-button:hover { background: #18374a; }
#admin-view .admin-card .primary-button, #admin-view .admin-page-heading .primary-button { border-radius: 8px; background: #087fca; color: #fff; }
#admin-view .admin-card .primary-button:hover, #admin-view .admin-page-heading .primary-button:hover { background: #0b91df; }
#admin-view .admin-card .danger-button { background: #b92b3b; color: #fff; }
#admin-view .admin-card .admin-grid { grid-template-columns: minmax(230px, .72fr) minmax(0, 2fr); align-items: start; gap: 14px; }
#admin-view .admin-card .user-management { height: min(610px, calc(100dvh - 200px)); }
#admin-view .admin-card .user-management > .admin-user-list { max-height: calc(100% - 55px); }
#admin-view .admin-card .admin-user-list { max-height: min(55vh, 570px); overflow: auto; }
#admin-view .user-management-heading { align-items: center; }
#admin-view .user-management-heading h2 { margin: 0; }
#admin-view .user-management-heading input { max-width: 250px; }
#admin-view .admin-activity-card, #admin-view .admin-queue-card { min-height: 264px; }
#admin-view .admin-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
#admin-view .admin-period-select select { min-height: 31px; padding: 5px 25px 5px 9px; border: 1px solid #2a4353; border-radius: 7px; background: #0c1d2a; color: #b9ccd7; font-size: 10px; }
#admin-view .admin-activity-chart { display: grid; grid-template-columns: repeat(14, minmax(17px, 1fr)); align-items: end; gap: 8px; min-height: 165px; margin: 13px 0 0; padding: 10px 3px 0; overflow-x: auto; }
#admin-view .admin-chart-column { display: grid; grid-template-rows: 14px 1fr 15px; align-items: end; gap: 4px; min-width: 16px; height: 146px; text-align: center; }
#admin-view .admin-chart-count { overflow: hidden; color: #96acba; font-size: 8px; line-height: 1; }
#admin-view .admin-chart-track { display: flex; height: 100%; align-items: end; justify-content: center; overflow: hidden; border-radius: 4px 4px 0 0; background: #102533; }
#admin-view .admin-chart-track i { display: block; width: min(17px, 72%); min-height: 2px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #45c8ff, #1176c0); box-shadow: 0 0 12px #22a8ea44; }
#admin-view .admin-chart-column small { color: #748d9e; font-size: 8px; white-space: nowrap; }
#admin-view .admin-chart-legend { display: flex; align-items: center; gap: 6px; color: #8ca4b3; font-size: 9px; }
#admin-view .admin-chart-legend i, #admin-view .admin-live-label i { width: 7px; height: 7px; border-radius: 50%; background: #13ad78; }
#admin-view .admin-queue-card .admin-card-heading { margin-bottom: 15px; }
#admin-view .admin-queue-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) max-content; align-items: center; gap: 10px; width: 100%; min-height: 61px; padding: 9px 2px; border: 0; border-top: 1px solid #203746; background: transparent; color: #dce8ef; text-align: left; cursor: pointer; }
#admin-view .admin-queue-row:hover { background: #ffffff06; }
#admin-view .queue-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; font-size: 13px; font-weight: 800; }
#admin-view .queue-blue { background: #1689d522; color: #55c6ff; }
#admin-view .queue-purple { background: #9e6bee22; color: #c29aff; }
#admin-view .admin-queue-row strong, #admin-view .admin-queue-row small { display: block; }
#admin-view .admin-queue-row strong { font-size: 10px; }
#admin-view .admin-queue-row small { margin-top: 3px; color: #879eac; font-size: 9px; }
#admin-view .admin-queue-row > b { min-width: 28px; padding: 5px 7px; border-radius: 7px; background: #142a39; color: #e8f1f6; font-size: 11px; text-align: center; }
#admin-view .admin-recent-card { padding-bottom: 9px; }
#admin-view .admin-card-heading { margin-bottom: 14px; }
#admin-view .admin-live-label { display: flex; align-items: center; gap: 6px; color: #8ba3b1; font-size: 9px; white-space: nowrap; }
#admin-view .admin-audit-table { width: 100%; overflow-x: auto; }
#admin-view .admin-audit-row { display: grid; grid-template-columns: minmax(130px, 1.15fr) minmax(110px, 1fr) minmax(110px, 1fr) minmax(125px, .9fr); align-items: center; gap: 12px; min-height: 38px; padding: 7px 5px; border-top: 1px solid #203746; color: #a8bdca; font-size: 10px; }
#admin-view .admin-audit-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#admin-view .admin-audit-row strong { color: #dce8ef; font-size: 10px; }
#admin-view .admin-audit-head { min-height: 30px; border: 0; color: #738c9c; font-size: 9px; }
#admin-view .admin-witchee-requests-list { display: grid; gap: 8px; margin: 12px 0; }
#admin-view .admin-witchee-request-row { display: grid; grid-template-columns: minmax(150px, 1fr) max-content max-content max-content; align-items: center; gap: 12px; padding: 10px; border: 1px solid #293f4f; border-radius: 9px; background: #0c1c29; }
#admin-view .admin-witchee-request-row strong, #admin-view .admin-witchee-request-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#admin-view .admin-witchee-request-row strong { color: #e5eef4; font-size: 11px; }
#admin-view .admin-witchee-request-row small, #admin-view .admin-witchee-request-row time { margin-top: 3px; color: #8fa6b5; font-size: 9px; }
#admin-view .admin-request-status { padding: 5px 8px; border-radius: 999px; background: #8a652122; color: #f2c56b; font-size: 9px; font-weight: 750; white-space: nowrap; }
#admin-view .admin-request-status.status-reviewing { background: #1173b322; color: #65c5ff; }
#admin-view .admin-request-status.status-verified { background: #13835a22; color: #56d8a6; }
#admin-view .admin-witchee-requests { margin-top: 15px; }
#admin-view .admin-card .admin-user-list .empty-note, #admin-view .admin-card .empty-note { color: #8fa6b5; }
#admin-view .admin-card .site-control-card { background: transparent !important; }
#admin-view .site-control-card { padding: 20px; }
#admin-view .site-control-card .site-asset-control { border-color: #293f4f; border-radius: 9px; background: #0b1b28; }
#admin-view .site-control-card .site-asset-control > strong { color: #e0edf4; }
#admin-view .admin-page .verification-management { min-height: 200px; }
#admin-view .admin-page .witchee-feedback-management { margin-bottom: 15px; }
#admin-view .admin-page .witchee-feedback-management .witchee-feedback-item { border-color: #293f4f; background: #0c1c29; }
#admin-view .admin-page .admin-grid { display: grid; }

@media (max-width: 900px) {
  #admin-view #admin-shell { grid-template-columns: 206px minmax(0, 1fr); }
  #admin-view .admin-sidebar { padding-right: 10px; padding-left: 10px; }
  #admin-view .admin-pages { padding-right: 20px; padding-left: 20px; }
  #admin-view .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #admin-view .admin-dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(220px, .9fr); }
}
@media (max-width: 680px) {
  #app-view.admin-mode > .topbar { flex-basis: 54px; min-height: 54px; }
  #app-view.admin-mode > .topbar .desktop-section-button { display: none; }
  #admin-view #admin-shell { display: block; }
  #admin-view .admin-sidebar { position: fixed; z-index: 61; inset: 54px auto 0 0; width: min(285px, 84vw); padding-top: 18px; box-shadow: 12px 0 35px #0007; transform: translateX(-105%); transition: transform .18s ease; }
  #admin-view #admin-shell.mobile-nav-open .admin-sidebar { transform: translateX(0); }
  #admin-view #admin-shell.mobile-nav-open::before { position: fixed; z-index: 60; inset: 54px 0 0; background: #020a10a8; content: ""; }
  #admin-view .admin-main { width: 100%; height: 100%; }
  #admin-view .admin-toolbar { flex-basis: 57px; gap: 9px; padding: 0 12px; }
  #admin-view .admin-sidebar-toggle { display: grid; width: 35px; height: 35px; flex: 0 0 35px; place-items: center; border: 1px solid #2a4353; border-radius: 8px; background: #102433; color: #d4e4ed; font-size: 17px; cursor: pointer; }
  #admin-view .admin-search { width: auto; min-width: 0; flex: 1 1 auto; height: 36px; padding: 0 9px; }
  #admin-view .admin-profile { padding-left: 0; }
  #admin-view .admin-profile > span:last-child { display: none; }
  #admin-view .admin-profile-avatar { width: 32px; height: 32px; flex-basis: 32px; }
  #admin-view .admin-pages { padding: 18px 13px max(24px, env(safe-area-inset-bottom)); }
  #admin-view .admin-page-heading { align-items: flex-start; margin-bottom: 16px; }
  #admin-view .admin-page-heading h1 { font-size: 22px; }
  #admin-view .admin-page-heading .muted { max-width: 38ch; font-size: 11px; }
  #admin-view .admin-page-heading > .primary-button { min-height: 34px; padding: 7px 9px; font-size: 10px; white-space: nowrap; }
  #admin-view .admin-metrics { gap: 9px; margin-bottom: 11px; }
  #admin-view .admin-metric-card { grid-template-columns: 30px minmax(0, 1fr); gap: 7px; min-height: 111px; padding: 12px 9px 9px; }
  #admin-view .admin-metric-icon { width: 29px; height: 29px; border-radius: 9px; font-size: 14px; }
  #admin-view .admin-metric-card > div > span { font-size: 9px; }
  #admin-view .admin-metric-card > div > strong { font-size: 21px; }
  #admin-view .admin-metric-card small { font-size: 8px; }
  #admin-view .admin-metric-card > button { font-size: 8px; }
  #admin-view .admin-dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
  #admin-view .admin-activity-card, #admin-view .admin-queue-card { min-height: auto; }
  #admin-view .admin-activity-chart { grid-template-columns: repeat(14, minmax(17px, 1fr)); min-height: 135px; }
  #admin-view .admin-chart-column { height: 120px; }
  #admin-view .admin-queue-card { padding-bottom: 9px; }
  #admin-view .admin-recent-card { padding: 13px 10px 8px; }
  #admin-view .admin-card { padding: 14px; }
  #admin-view .admin-card .admin-grid { grid-template-columns: minmax(0, 1fr); }
  #admin-view .admin-card .user-management { height: auto; min-height: 0; }
  #admin-view .admin-card .admin-user-list { max-height: none; }
  #admin-view .user-management-heading { align-items: stretch; flex-direction: column; }
  #admin-view .user-management-heading input { width: 100%; max-width: none; }
  #admin-view .admin-audit-table { margin-right: -4px; }
  #admin-view .admin-audit-row { grid-template-columns: minmax(105px, 1fr) minmax(100px, 1fr) minmax(110px, 1fr) minmax(100px, 1fr); min-width: 430px; gap: 8px; }
  #admin-view .admin-witchee-request-row { grid-template-columns: minmax(0, 1fr) max-content; gap: 7px; }
  #admin-view .admin-witchee-request-row time { grid-column: 1; }
  #admin-view .admin-witchee-request-row .quiet-button { grid-column: 2; grid-row: 1 / span 2; }
  #admin-view .site-control-card { padding: 14px; }
}
@media (max-width: 380px) {
  #admin-view .admin-profile { display: none; }
  #admin-view .admin-metric-card { grid-template-columns: 1fr; }
  #admin-view .admin-metric-card > button { grid-column: 1; }
}

/* Calls: keep the caller framed in the center and make iPhone status visible. */
.incoming-call-card .avatar img,
.call-peer-avatar img,
.call-videos #remote-video {
  object-position: center center !important;
}
.incoming-call-card .avatar img,
.call-peer-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.call-videos #remote-video {
  object-fit: cover !important;
  background: #071521 !important;
}
.call-video-status {
  position: absolute;
  z-index: 4;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  max-width: min(80vw, 360px);
  gap: 3px;
  padding: 9px 15px;
  border: 1px solid #ffffff35;
  border-radius: 999px;
  background: #061521b8;
  color: #f2f8fc;
  text-align: center;
  box-shadow: 0 5px 22px #0005;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  pointer-events: none;
}
.call-video-status strong,
.call-video-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-video-status span { color: #c1d5e0; font-size: 11px; }
.call-remote-audio {
  position: fixed !important;
  z-index: -1 !important;
  left: -2px !important;
  bottom: 0 !important;
  width: 1px !important;
  height: 1px !important;
  opacity: .01 !important;
  pointer-events: none !important;
}
.call-peer-avatar { position: relative; overflow: hidden; flex: 0 0 auto; border-radius: 50%; }
.incoming-call-card { justify-self: center; margin-inline: auto; }

@media (max-height: 620px) {
  .incoming-call-card { gap: 8px; padding-block: 12px; }
  .incoming-call-card .large-avatar { width: 88px; height: 88px; }
  .incoming-call-actions { margin-top: 8px; }
}
