/* Shared HamGap identity and layout constraints. Loaded after the base components. */
html { width: 100%; overflow-x: clip; }
body { font-size: 16px; -webkit-text-size-adjust: 100%; }
body:has(#chatApp) { height: 100dvh; overflow: hidden; }
button, label, select, input, textarea { -webkit-tap-highlight-color: transparent; }
button, select { font-family: inherit; }
input, textarea, select { font-size: 16px !important; }
input::placeholder, textarea::placeholder { color: #61718a !important; opacity: 1; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, select:focus-visible { outline-color: #2563eb; }
.ambient { display: none; }
.eyebrow { color: #52617a; letter-spacing: 0; font-size: 14px; }
.brand { color: #173a8a; }
.brand-light { color: #fff; }
.button { min-height: 46px; border-radius: 13px; font-size: 15px; }
.button-primary { color: #fff; background: #2563eb; box-shadow: 0 6px 16px #2563eb26; }
.button-primary:hover { background: #1d4ed8; box-shadow: 0 8px 20px #2563eb35; }
.button-outline { border-color: #c8d7ee; color: #173a8a; background: #fff; }
.button-outline:hover, .icon-button:hover { background: #e8efff; }
.button-quiet { color: #173a8a; background: #e8efff; }
.button-danger { color: #fff; background: #c52a3a; box-shadow: 0 5px 14px #c52a3a1a; }
.button-danger:hover { background: #a31c2b; }
.icon-button { width: 42px; height: 42px; flex: 0 0 42px; color: #294a7b; }
.round-button { background: #2563eb; box-shadow: 0 6px 16px #2563eb26; }
.auth-visual { min-height: 0; background: linear-gradient(155deg, #edf6ff, #f8fbff 72%, #e8f4ff); color: #172b4d; }
.auth-visual::before, .auth-visual::after { border-color: #2563eb14; }
.auth-visual .eyebrow, .visual-copy p, .visual-note { color: #425776; }
.visual-copy h1 em { color: #2563eb; }
.brand-light { color: #173a8a; }
.auth-layout, .auth-panel { background: #fff; }
.auth-tabs { background: #edf2fb; }
.auth-tab { color: #52617a; font-size: 15px; }
.auth-form label, .settings-form label { color: #273d5e; font-size: 15px; }
.auth-form input, .settings-form input:not([type=checkbox]) { border-color: #cdd9eb; min-height: 49px; }
.auth-privacy, .auth-footer, .local-link, .back-home { color: #52617a; font-size: 14px; }
.form-message { font-size: 14px; }
.form-message.error, .danger-text { color: #b42335; }
.form-message.success { color: #067647; }
.visual-copy { width: 100%; max-width: 620px; margin: auto; padding-block: 30px; }
.visual-copy h1 { font-size: clamp(36px, 3.2vw, 48px); line-height: 1.4; }
.visual-copy p { max-width: 500px; font-size: 15px; line-height: 2; }
.room-art { width: min(100%, 590px); height: clamp(190px, 36vh, 360px); margin: 12px auto 4px; border-radius: 0; object-fit: contain; mix-blend-mode: multiply; mask-image: radial-gradient(ellipse at center, #000 54%, transparent 100%); filter: none; animation: none; }
.visual-note { font-size: 14px; }
.auth-heading h2 { font-size: 25px; }
.auth-heading p, .auth-form label { font-size: 14px; }
.auth-privacy { font-size: 14px; }
.auth-footer.privacy-link { width: auto; padding: 24px 0 0; border: 0; background: transparent; text-align: center; cursor: pointer; }
.auth-footer.privacy-link:hover { color: #1d4ed8; }
.app-shell { width: 100%; max-width: 100%; isolation: isolate; background: #f3f7ff; }
.sidebar { border-color: #dbe4f0; background: #fff; }
.profile-strip { background: #f3f7ff; border-color: #dbe4f0; }
.profile-copy strong, .friend-copy strong, .chat-person strong { color: #172b4d; font-size: 16px; }
.profile-copy span, .friend-copy small, .friend-empty small, .search-empty, .requests-title, .sidebar-bottom { color: #52617a; font-size: 14px; }
.friend-empty strong { color: #273d5e; font-size: 15px; }
.friend-item { min-height: 72px; }
.friend-item.is-selected { background: #e7efff; box-shadow: inset -3px 0 #2563eb; }
.friend-item:hover { background: #f0f5ff; }
.avatar { border-radius: 50%; background: #e8efff; }
.search-box { min-height: 47px; color: #52617a; background: #f3f7ff; border-color: #dbe4f0; }
.online-dot, .presence-dot.is-online { background: #12a66d; }
.admin-pill { color: #173a8a; background: #e0eaff; font-size: 13px; }
.sidebar-bottom { line-height: 1.8; }
.topbar { gap: 12px; flex-shrink: 0; border-color: #dbe4f0; }
.topbar-title { min-width: 0; overflow-wrap: anywhere; }
.topbar-title strong { color: #273d5e; font-size: 15px; }
.topbar-title .eyebrow { color: #52617a; font-size: 14px; }
.topbar-actions { flex-shrink: 0; gap: 6px; }
.logout-button { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding-inline: 12px; }
.logout-button svg { width: 21px; height: 21px; }
.admin-nav { min-height: 42px; font-size: 14px; }
.admin-nav span { color: #2563eb; }
.welcome-view { min-width: 0; width: 100%; margin: 0 auto; }
.welcome-copy h1 { color: #172b4d; }
.welcome-copy h1 em { color: #2563eb; }
.welcome-copy p { color: #52617a; font-size: 15px; }
.welcome-art-wrap { min-width: 0; }
.welcome-art-wrap > img { border-radius: 30px; filter: none; }
.floating-note { color: #273d5e; background: #fff; border-color: #dbe4f0; font-size: 14px; }
.note-avatar.peach, .note-avatar.green { background: #e8efff; color: #1d4ed8; }
.welcome-stats { border-color: #dbe4f0; }
.welcome-stats strong { color: #273d5e; font-size: 15px; }
.welcome-stats span { color: #52617a; font-size: 14px; }
.chat-view, .chat-header, .message-scroll, .message-list, .composer { min-width: 0; direction: rtl; }
.chat-person, .chat-person > div { min-width: 0; }
.chat-person strong { overflow-wrap: anywhere; }
.chat-person span { color: #52617a; font-size: 14px; }
.chat-header { gap: 10px; flex-shrink: 0; border-color: #dbe4f0; }
.chat-menu-wrap { position: relative; flex-shrink: 0; }
.chat-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 5; width: 230px; padding: 6px; border: 1px solid #dbe4f0; border-radius: 15px; background: #fff; box-shadow: 0 16px 40px #172b4d26; }
.chat-menu button { display: block; width: 100%; padding: 14px 12px; border: 0; border-radius: 9px; background: #fff; text-align: start; font-size: 15px; cursor: pointer; }
.chat-menu button:hover { color: #b42335; background: #fff0f2; }
.message-scroll { overscroll-behavior: contain; }
.message-day { color: #52617a; background: #e7efff; font-size: 13px; }
.message-row { align-items: flex-end; gap: 8px; }
.message-row.is-mine { justify-content: flex-start; flex-direction: row; }
.message-row.is-theirs { justify-content: flex-start; flex-direction: row-reverse; }
.message-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; margin-bottom: 3px; box-shadow: none; }
.message-bubble { position: relative; max-width: min(calc(100% - 45px), 520px); min-width: 75px; text-align: start; border: 1px solid transparent; }
.is-mine .message-bubble { color: #fff; background: #2563eb; border-radius: 18px 18px 5px 18px; }
.is-theirs .message-bubble { color: #172b4d; background: #fff; border-color: #dbe4f0; border-radius: 18px 18px 18px 5px; }
.message-bubble p { font-size: 14px; line-height: 1.8; text-align: start; unicode-bidi: plaintext; }
.message-meta { direction: ltr; opacity: 1; color: #52617a; font-size: 12px; }
.is-mine .message-meta { color: #e3edff; }
.read-state { display: inline-block; min-width: 16px; font-family: Arial, sans-serif; font-size: 16px; letter-spacing: -4px; padding-inline-end: 4px; }
.read-state.is-read { color: #9df2ff; }
.message-bubble video, .message-bubble audio { width: 100%; max-width: 320px; }
.message-file { min-width: 0; }
.message-file strong { font-size: 14px; }
.message-file small { font-size: 13px; opacity: 1; }
.composer { border-color: #cdd9eb; flex-shrink: 0; align-items: center; }
.composer textarea { font-size: 14px !important; text-align: start; }
.attach-button, .send-button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; }
.attach-button { color: #1d4ed8; background: #e8efff; }
.send-button { color: #fff; background: #2563eb; }
.send-button:hover { background: #1d4ed8; }
.chat-footnote { font-size: 13px; color: #52617a; }
.message-options { position: relative; display: inline-flex; align-items: center; margin-inline-start: 2px; direction: rtl; }
.message-menu-toggle { width: 34px; height: 24px; padding: 0; border: 0; border-radius: 8px; color: #62728b; background: transparent; font: 700 13px/1 Arial,sans-serif; cursor: pointer; }
.message-menu-toggle:hover, .message-menu-toggle[aria-expanded="true"] { color: #173a8a; background: #e8efff; }
.message-menu { position: absolute; bottom: calc(100% + 4px); inset-inline-start: 0; z-index: 8; width: 152px; padding: 5px; border: 1px solid #dbe4f0; border-radius: 12px; background: #fff; box-shadow: 0 12px 28px #172b4d25; }
.message-menu button { width: 100%; padding: 10px; border: 0; border-radius: 8px; color: #b42335; background: transparent; text-align: start; font-size: 14px; cursor: pointer; }
.message-menu button:hover { background: #fff0f2; }
.settings-view, .admin-view { width: 100%; max-width: 100%; }
.settings-card { border-color: #dbe4f0; background: #fff; }
.settings-card p, .dialog-card p, .tools-card > p { color: #52617a; font-size: 15px; }
.settings-card h2 { color: #172b4d; font-size: 17px; }
.settings-form small { color: #52617a; font-size: 13px; }
.switch-row { font-size: 15px !important; }
.switch-row input:checked + .switch { background: #2563eb; }
.switch-row input:focus-visible + .switch { outline: 3px solid #2563eb; outline-offset: 4px; }
.tools-page { background: #f3f7ff; }
.tools-card { background: #fff; border-color: #dbe4f0; }
.admin-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary-card { border-color: #dbe4f0; }
.summary-card span { color: #52617a; font-size: 14px; }
.summary-card strong { color: #1d4ed8; }
.admin-tabs { background: #e7efff; }
.admin-tab { color: #52617a; min-height: 42px; font-size: 15px; }
.admin-content { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; border-color: #dbe4f0; background: #fff; }
.admin-row, .session-row { color: #273d5e; font-size: 14px; border-color: #dbe4f0; }
.admin-header { background: #f3f7ff; color: #52617a; font-size: 14px; }
.admin-person { min-width: 0; flex-wrap: wrap; color: #172b4d; }
.admin-person > span { overflow-wrap: anywhere; }
.text-button { display: inline-block; color: #1d4ed8; font-size: 14px; text-align: start; }
.danger-text { color: #b42335; }
.account-status { font-size: 13px; }
.account-status.is-active { color: #05603a; background: #dff7ec; }
.account-status.is-disabled { color: #b42335; background: #ffe7eb; }
.admin-actions small { color: #52617a; font-size: 14px; }
.admin-message-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border-color: #dbe4f0; }
.admin-message-heading { width: 100%; color: #172b4d; font-size: 15px; flex-wrap: wrap; }
.admin-message-heading time, .admin-message-card small, .session-row time, .session-row code { color: #52617a; font-size: 13px; }
.admin-message-card p { width: 100%; margin: 0; color: #172b4d; font-size: 16px; }
.admin-file-link { color: #1d4ed8; font-size: 14px; overflow-wrap: anywhere; }
.admin-message-card.is-deleted { background: #fff8f9; border-inline-start: 3px solid #db5262; }
.deleted-badge { color: #a31c2b; background: #ffe8ec; padding: 5px 8px; border-radius: 8px; font-size: 13px; }
.admin-message-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; border-bottom: 1px solid #dbe4f0; }
.admin-message-filters label { display: grid; gap: 8px; color: #273d5e; font-size: 14px; min-width: 0; }
.admin-message-filters select { width: 100%; min-width: 0; min-height: 46px; padding: 8px; border: 1px solid #cdd9eb; border-radius: 10px; color: #172b4d; background: #fff; }
.admin-message-filters .filter-checkbox { display: flex; align-items: center; }
.filter-checkbox input { accent-color: #2563eb; width: 18px; height: 18px; flex-shrink: 0; }
.admin-cleanup { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #dbe4f0; background: #f5f8ff; }
.admin-cleanup p { margin: 0; font-size: 14px; line-height: 1.9; }
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; font-size: 14px; }
.admin-pagination .button { padding-inline: 12px; }
.dialog-card { color: #172b4d; background: #fff; border-color: #dbe4f0; max-height: calc(100dvh - 32px); overflow: auto; }
.dialog-card::backdrop { background: #0f234c80; backdrop-filter: blur(5px); }
.privacy-info-dialog { width: min(480px, calc(100% - 32px)); }
.privacy-info-dialog > form:last-child { display: flex; justify-content: flex-start; margin-top: 20px; }
.confirmation-dialog { width: min(440px, calc(100% - 32px)); padding: 28px; }
.confirmation-symbol { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 17px; color: #2563eb; background: #e8efff; font-size: 26px; font-weight: 800; }
.is-danger .confirmation-symbol { color: #b42335; background: #ffe7eb; }
.confirmation-dialog h2 { font-size: 21px; margin: 18px 0 10px; }
.confirmation-dialog p { white-space: pre-line; overflow-wrap: anywhere; }
.confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.confirmation-actions .button { padding-inline: 10px; }
.confirmation-actions.is-choice { grid-template-columns: 1fr 1fr; }
.confirmation-actions.is-choice .choice-cancel { grid-column: 1 / -1; }
.confirmation-field { display: grid; gap: 9px; margin-top: 18px; font-size: 15px; }
.confirmation-field input { width: 100%; padding: 12px; border: 1px solid #cdd9eb; border-radius: 10px; direction: ltr; }
.confirmation-field small { color: #52617a; font-size: 13px; }
.toast-message { inset-inline-start: auto; left: 50%; color: #fff; background: #172f6d; font-size: 15px; }
@media (max-width: 1100px) {
  .admin-table { display: grid; gap: 12px; min-width: 0; padding: 12px; }
  .admin-row.admin-header { display: none; }
  .admin-row.admin-user-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 16px; border: 1px solid #dbe4f0; border-radius: 14px; background: #fff; font-size: 15px; }
  .admin-user-card .admin-person, .admin-user-card .admin-actions { grid-column: 1 / -1; }
  .admin-user-card [data-label] { display: grid; gap: 5px; }
  .admin-user-card [data-label]::before { content: attr(data-label); color: #52617a; font-size: 13px; font-weight: 400; }
  .admin-user-card .admin-actions { gap: 14px; padding-top: 10px; border-top: 1px solid #dbe4f0; }
  .admin-user-card .text-button { font-size: 14px; }
}
@media (max-width: 900px) {
  .auth-visual { height: 100%; padding: 26px; }
  .visual-copy h1 { font-size: clamp(34px, 4vw, 44px); }
  .room-art { height: clamp(190px, 33vh, 300px); }
  .app-shell { display: block; height: 100dvh; min-height: 0; }
  .sidebar { display: flex; position: fixed; z-index: 1001; top: 0; right: 0; bottom: 0; left: auto; width: min(88vw, 360px); max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 22px 18px; overflow: hidden; visibility: hidden; pointer-events: none; transform: translate3d(100%,0,0); transition: transform .25s ease, visibility .25s; box-shadow: -20px 0 60px #172b4d26; }
  .sidebar.is-open { visibility: visible; pointer-events: auto; transform: translate3d(0,0,0); }
  .mobile-shade { display: block; position: fixed; z-index: 1000; inset: 0; background: #0f234c66; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .mobile-shade.is-visible { opacity: 1; pointer-events: auto; }
  .mobile-close, .menu-toggle { display: inline-grid; }
  .main-panel { width: 100%; max-width: 100%; height: 100%; padding: 0 18px max(12px, env(safe-area-inset-bottom)); }
  .topbar { min-height: 76px; gap: 8px; }
  .topbar-title { flex: 1; }
  .topbar-title strong { font-size: 14px; }
  .topbar-title .eyebrow { font-size: 13px; }
  .topbar-actions { flex-shrink: 0; }
  .top-settings { display: none; }
  .menu-toggle { margin: 0; width: 40px; flex-basis: 40px; }
  .welcome-view { display: flex; flex: 1; flex-direction: column; justify-content: center; align-items: stretch; gap: 8px; overflow-y: auto; padding: 24px 0; }
  .welcome-copy { padding: 0; }
  .welcome-copy h1 { margin: 12px 0; font-size: clamp(28px, 6.6vw, 40px); line-height: 1.65; }
  .welcome-copy p { max-width: 100%; font-size: 15px; margin-bottom: 18px; }
  .welcome-art-wrap { min-height: 190px; max-height: 270px; flex: 0 0 auto; }
  .welcome-art-wrap > img { width: min(64%, 265px); max-height: 265px; object-fit: contain; }
  .floating-note { padding: 8px 10px; font-size: 13px; }
  .note-a { inset-inline-start: 0; top: 20%; }
  .note-b { inset-inline-end: 0; bottom: 12%; }
  .welcome-stats { margin-top: 12px; gap: 12px; }
  .welcome-stats strong { font-size: 13px; }
  .welcome-stats span { font-size: 12px; max-width: none; line-height: 1.8; }
  .chat-header { min-height: 76px; }
  .message-scroll { padding-block: 18px; }
  .settings-view, .admin-view { padding-top: 22px; }
  .settings-grid { grid-template-columns: 1fr; }
  .password-card { max-width: none; }
  .admin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary-card { padding: 14px; }
  .summary-card span { font-size: 14px; }
  .admin-content { overflow-x: hidden; }
  .admin-tab { flex: 1; padding-inline: 8px; font-size: 14px; }
  .session-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; font-size: 14px; }
  .session-row code { overflow-wrap: anywhere; }
  .session-row time { grid-column: auto; }
}
@media (max-width: 700px) {
  .auth-layout { display: flex; height: 100dvh; min-height: 0; flex-direction: column; }
  .auth-visual { height: clamp(138px, 21dvh, 178px); min-height: 138px; max-height: 178px; flex: 0 0 auto; padding: 14px 20px; }
  .auth-panel { min-height: 0; flex: 1 1 auto; padding: 10px 20px 13px; overflow-y: auto; }
}
@media (max-width: 480px) {
  .main-panel { padding-inline: 12px; }
  .topbar-title strong { display: none; }
  .topbar-actions { gap: 5px; }
  .admin-nav, .logout-button { min-height: 40px; padding-inline: 9px; font-size: 13px; }
  .admin-nav span { display: none; }
  .logout-button svg { width: 18px; }
  .welcome-art-wrap { max-height: 215px; min-height: 180px; }
  .welcome-art-wrap > img { max-height: 210px; }
  .floating-note { max-width: 67%; font-size: 12px; }
  .welcome-stats { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .welcome-stats div { display: flex; gap: 8px; align-items: center; }
  .welcome-stats strong, .welcome-stats span { font-size: 13px; }
  .auth-layout { height: 100dvh; min-height: 0; }
  .auth-visual { height: clamp(138px, 21dvh, 178px); min-height: 138px; max-height: 178px; flex: 0 0 auto; padding: 14px 20px; }
  .visual-copy { padding: 0; }
  .visual-copy h1 { margin: 5px 0; font-size: clamp(23px, 6vw, 27px); line-height: 1.38; }
  .visual-copy p { font-size: 13px; line-height: 1.7; }
  .auth-heading { margin-bottom: 13px; }
  .auth-heading p { font-size: 14px; }
  .auth-heading h2 { font-size: 22px; }
  .auth-panel { min-height: 0; padding: 10px 20px 13px; overflow-y: auto; }
  .auth-mobile-brand { margin-bottom: 12px; }
  .auth-tabs { margin-bottom: 13px; }
  .auth-form { gap: 9px; }
  .auth-form label { gap: 5px; }
  .auth-form input { min-height: 42px; }
  .auth-privacy { margin-top: 12px; padding-top: 9px; }
  .auth-footer.privacy-link { margin-top: 12px; padding-top: 0; }
  .chat-person .avatar { width: 40px; height: 40px; flex-basis: 40px; }
  .chat-person strong { font-size: 16px; }
  .chat-person span { font-size: 13px; }
  .chat-menu-wrap > .button { padding-inline: 10px; font-size: 13px; }
  .message-bubble { padding: 10px 12px 8px; }
  .message-bubble p { font-size: 14px; }
  .message-avatar { width: 28px; height: 28px; flex-basis: 28px; }
  .composer { gap: 6px; padding: 7px; }
  .attach-button, .send-button { width: 42px; height: 42px; flex-basis: 42px; }
  .composer textarea { font-size: 14px !important; }
  .chat-footnote { font-size: 12px; }
  .admin-message-filters { grid-template-columns: 1fr; padding: 14px; }
  .admin-cleanup { padding: 14px; }
  .admin-cleanup .button { width: 100%; }
  .admin-message-heading { display: grid; gap: 7px; }
  .confirmation-dialog { padding: 22px; }
  .confirmation-actions { grid-template-columns: 1fr; }
  .confirmation-actions .button { min-height: 48px; }
}

.typing-status { display: none; color: #2363d7; font-size: 13px; line-height: 1.5; }
.typing-status.is-visible { display: block; animation: typing-appear .18s ease-out both; }
@keyframes typing-appear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.welcome-art-wrap { min-height: 0; max-height: none; overflow: visible; }
.welcome-art-wrap > img { display: block; width: min(100%, 440px); height: clamp(250px, 42vh, 380px); border: 8px solid #fff; border-radius: 30px; object-fit: cover; object-position: center 50%; box-shadow: 0 24px 58px rgba(20,47,99,.16); }

@media (max-width: 900px) {
  .welcome-art-wrap { width: 100%; min-height: 0; max-height: none; }
  .welcome-art-wrap > img { width: min(100%, 440px); height: clamp(215px, 32vh, 280px); }
}
@media (max-width: 480px) {
  .welcome-art-wrap { min-height: 0; max-height: none; }
  .welcome-art-wrap > img { width: min(100%, 390px); height: clamp(190px, 29vh, 235px); border-width: 5px; border-radius: 23px; }
}