/* Authoritative product components. Legacy style.css retains specialized flow geometry.
   Change semantic roles in tokens.css; change component behavior here. */
body { background:var(--canvas); color:var(--ink); font-size:var(--font-body); line-height:1.5; }
:root { --font-display:'Manrope','DM Sans',sans-serif; }
h1,h2,h3,p { overflow-wrap:anywhere; }
button,a,input,textarea,select,summary { -webkit-tap-highlight-color:transparent; }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px; box-shadow:none; }
button:focus:not(:focus-visible),a:focus:not(:focus-visible) { outline:none; }
.button,.button.small,.button.send { min-height:var(--control-height); border-radius:var(--radius-control); padding:12px 16px; font-size:15px; line-height:1.35; font-weight:650; gap:8px; box-shadow:none; transition:background var(--motion-fast),border-color var(--motion-fast); }
.button.primary { color:#16200d; background:var(--accent); border:1px solid transparent; box-shadow:none; }
.button.primary:hover { background:var(--accent-hover); }
.button.secondary,.button.send { color:var(--ink); background:var(--surface-raised); border:1px solid var(--line); }
.button.secondary:hover,.button.send:hover { background:#303c33; }
.button.ghost { background:transparent; color:var(--muted); }
.button.danger { background:#3d2621; color:var(--error); border:1px solid #7f5147; }
.button svg { width:20px; height:20px; }
.icon-button,.history-more { min-width:44px; min-height:44px; border-radius:12px; }
.actions-row { gap:12px; align-items:stretch; }
.device-primary-actions { grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); align-items:stretch; }
.sidebar { background:var(--sidebar); border-right:1px solid var(--line); padding:24px 16px 16px; }
.brand-block { grid-template-columns:44px minmax(0,1fr); gap:0 12px; padding:0; margin:0 12px 24px; }
.brand-block .brand-symbol { width:44px; height:44px; }
.brand-block .brand-wordmark { width:112px; height:60px; }
.brand-block .app-version { font-size:12px; line-height:20px; }
.navigation-compact .brand-block { margin-bottom:16px; }
.navigation-compact .brand-block .brand-symbol { width:36px; height:36px; }
.sidebar .nav-item { min-height:48px; padding:12px; font-size:15px; border-radius:12px; margin:4px 0; }
.sidebar .nav-item.active { background:var(--accent-light); color:var(--accent); }
.sidebar-label { letter-spacing:.08em; font-size:12px; margin-top:24px; }
.sidebar-toggle { min-height:44px; font-size:13px; margin-bottom:12px; }
.navigation-compact .sidebar .nav-item { min-height:48px; margin:4px auto; }
.topbar,.layout:not(.chat-focused) .topbar { height:64px; background:var(--canvas); padding:0 32px; }
.content { max-width:1440px; padding:32px; }
.page-title { margin:0 0 24px; }
.page-title h1 { font-size:32px; line-height:1.2; letter-spacing:-1px; margin:0 0 12px; }
.page-title p { font-size:16px; line-height:1.55; max-width:62ch; }
.eyebrow { font-size:12px; letter-spacing:.1em; margin-bottom:12px; }
.section-heading { margin:32px 0 16px; }
.section-heading h2 { font-size:20px; gap:12px; }
.panel,.channel-card,.home-device,.device-card,.settings-panel { background:var(--surface); border-color:var(--line); border-radius:var(--radius-card); box-shadow:none; }
.device-card,.settings-stack .settings-panel,.settings-panel { padding:24px; }
.device-grid,.channel-grid,.home-device-grid,.settings-stack,.settings-stack .settings-grid { gap:24px; }
.settings-panel h3,.device-card h3 { font-size:21px; line-height:1.3; margin:0 0 12px; }
.device-card h3 { margin-top:16px; }
.settings-panel p,.device-card p { font-size:15px; line-height:1.6; color:var(--muted); margin-bottom:16px; }
.detail-line { padding:16px 0; gap:16px; font-size:15px; }
.detail-line strong { max-width:65%; overflow-wrap:anywhere; }
.home-header-shell .home-header { min-height:180px; padding:24px; background:radial-gradient(ellipse at 75% 50%,#d5ff5f0c,transparent 65%),var(--surface); }
.hero.home-header h1 { font-size:32px; line-height:1.2; }
.hero.home-header p { font-size:16px; line-height:1.5; }
.file-row,.transfer-row,.activity-row { padding:20px; gap:16px; }
.file-name,.history-file-name,.history-text-title { font-size:16px; line-height:1.5; }
.file-sub,.file-size,.history-meta,.activity-row time { font-size:13px; color:var(--muted); }
.badge { display:inline-flex; align-items:center; padding:2px 7px; font-size:11px; font-weight:600; border-radius:4px; background:#26351c; color:#d5ff5f; border:1px solid rgba(213,255,95,0.2); letter-spacing:0.3px; text-transform:uppercase; }
.badge.danger,.transfer-state.failed,.transfer-state.cancelled { color:#ff7d6b; background:#331a17; border-color:rgba(255,125,107,0.25); }
.badge.warn { color:#ffcc66; background:#332b14; border-color:rgba(255,204,102,0.25); }
.badge.delivered { color:#72e58e; background:#1c2b1e; border-color:rgba(114,229,142,0.25); }
.toolbar,.activity-tools { gap:16px; margin-bottom:16px; }
.search,.activity-search { min-height:48px; background:var(--surface); border-color:var(--line); border-radius:12px; }
.search input,.activity-search input { font-size:16px; color:var(--ink); }
.preference-segments,.activity-periods {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  padding: 4px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.preference-segments button,.activity-periods button {
  min-height: 44px;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
.footer { margin-top:32px; padding-top:20px; font-size:12px; color:var(--muted); }
/* Conversation: content determines bubble width; file cards have a known readable bound. */
.chat-focused .topbar { height:48px; min-height:48px; }
.chat-focused .content.chat-content { padding:16px; }
.chat-workspace { background:var(--canvas); border-radius:20px; grid-template-columns:330px minmax(0,1fr) !important; }
.chat-contacts { background:var(--surface); padding:20px 14px; border-right:1px solid var(--line); width:330px !important; min-width:330px !important; box-sizing:border-box !important; }
.chat-contacts-heading { padding:0 8px; gap:8px; }
.chat-contacts-heading h1 { font-size:24px; }
.chat-local-note { padding:0 8px; font-size:13px; line-height:1.5; }
.chat-contact { display:flex; align-items:center; min-height:76px; padding:12px; gap:12px; border:1px solid transparent; border-radius:12px; margin:4px 0; background:transparent; }
.chat-contact.active { background:var(--accent-light); border-color:#596d35; }
.chat-contact>span:nth-child(2) { min-width:0; flex:1; }
.chat-contact strong { display:block; font-size:15px; line-height:1.35; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-contact small { display:block; font-size:13px; line-height:1.4; margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-avatar { width:40px; height:40px; border-radius:12px; background:var(--surface-raised); color:var(--accent); }
.chat-thread-heading { min-height:80px; padding:12px 20px; background:var(--surface); }
.chat-destination-picker h2 { font-size:19px; letter-spacing:-.4px; }
.chat-destination>p { font-size:12px; margin:4px 0 0 48px; }
.chat-header-actions>.button { min-height:44px; padding:10px 12px; }
.chat-stream { padding:24px clamp(16px,3vw,48px); gap:12px; background:var(--canvas); }
.chat-bubble,.chat-bubble.outgoing,.chat-bubble.incoming { width:fit-content; max-width:90%; min-width:80px; padding:12px 16px; border-radius:16px; background:var(--surface-raised); border:1px solid var(--line); }
.chat-bubble.outgoing { background:var(--outgoing); border-color:var(--outgoing-line); color:var(--outgoing-ink); border-bottom-right-radius:5px; margin-inline-start:10%; margin-inline-end:0; align-self:flex-end; }
.chat-bubble.incoming { border-bottom-left-radius:5px; margin-inline-start:0; margin-inline-end:10%; align-self:flex-start; }
.chat-bubble.file-message { width:auto; max-width:min(520px,90%); }
.chat-bubble.sticky { background:#383222; border-color:#8b7746; }
.chat-bubble-author { font-size:12px; color:var(--muted); margin-bottom:8px; }
.chat-bubble-author:empty { display:none; }
.chat-message-text { font-size:16px; line-height:1.55; margin:0; white-space:pre-wrap; }
.chat-bubble .chat-file { display:flex; align-items:flex-start; gap:12px; min-width:0; }
.chat-file>svg { width:24px; height:24px; margin-top:3px; flex:none; }
.chat-file>div { min-width:0; }
.chat-file-name,.chat-file strong { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; font-size:16px; line-height:1.45; text-align:left; padding:0; }
.chat-file-name:hover { text-decoration:underline; text-underline-offset:3px; }
.chat-file small { display:block; font-size:13px; margin-top:4px; color:inherit; opacity:.8; }
.chat-image-open {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 140px;
  max-height: 220px;
  margin-top: 10px;
  padding: 0;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  contain: paint layout;
}
.chat-image-open .chat-image-skeleton {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(110deg, var(--surface) 20%, rgba(209, 255, 85, 0.05) 45%, var(--surface) 70%);
  background-size: 240% 100%;
  animation: via-link-loading 1.5s linear infinite;
  z-index: 1;
  transition: opacity 0.25s ease;
  color: var(--muted);
}
.chat-image-open .chat-image-skeleton svg {
  width: 28px;
  height: 28px;
  opacity: 0.4;
}
.chat-image-open.has-loaded .chat-image-skeleton {
  opacity: 0;
  pointer-events: none;
}
.chat-image-open img {
  display: block;
  width: 100%;
  height: 180px;
  max-height: 180px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
  position: relative;
  z-index: 2;
}
.chat-image-open.has-loaded img {
  opacity: 1;
}

/* Link Preview Skeleton Card */
.link-preview-skeleton {
  width: min(380px, 85%);
  box-sizing: border-box;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.skeleton-shimmer {
  background: linear-gradient(110deg, var(--surface-raised) 20%, rgba(209, 255, 85, 0.08) 45%, var(--surface-raised) 70%);
  background-size: 240% 100%;
  animation: via-link-loading 1.5s linear infinite;
}
.link-preview-skeleton .skeleton-media {
  width: 100%;
  height: 140px;
}
.link-preview-skeleton .skeleton-copy {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.link-preview-skeleton .skeleton-site {
  width: 90px;
  height: 14px;
  border-radius: 4px;
}
.link-preview-skeleton .skeleton-title {
  width: 80%;
  height: 18px;
  border-radius: 4px;
}
.link-preview-skeleton .skeleton-desc {
  width: 95%;
  height: 14px;
  border-radius: 4px;
}
.chat-bubble-time { margin-top:12px; display:flex; justify-content:space-between; gap:12px; font-size:12px; color:var(--muted); }
.chat-state { display:inline-flex; align-items:center; gap:5px; font-weight:550; }
.chat-state.failed,.chat-state.cancelled,.chat-state.expired { color:var(--error); }
.chat-state.completed,.chat-state.read { color:var(--success); }
.chat-state svg { width:14px; height:14px; }
.chat-file-notice { margin:10px 0 0; font-size:13px; color:var(--warning); line-height:1.5; }
.chat-text-actions { margin-top:8px; text-align:right; }
.chat-text-actions>.button { min-height:36px; padding:6px 8px; font-size:12px; }
.chat-text-actions>.button svg { width:16px; height:16px; }
.chat-bubble:has(.link-preview-slot) { width:min(380px,85%); }
.link-preview-card { border-color:var(--line); background:var(--canvas); }
.link-preview-copy>strong { font-size:17px; }
.link-preview-copy>.link-preview-description { font-size:14px; -webkit-line-clamp:2; }
.link-preview-media { height:152px; }
.chat-composer { padding:12px 20px; background:var(--surface); border-top:1px solid var(--line); }
.chat-compose-row { display:grid; grid-template-columns:48px 44px minmax(0,1fr) auto; gap:8px; align-items:end; }
.chat-compose-row textarea { min-height:48px; height:48px; max-height:120px; padding:12px 16px; border-radius:16px; border:1px solid var(--line); background:var(--canvas); color:var(--ink); font-size:16px; line-height:22px; box-shadow:none; }
.chat-compose-row textarea:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(213, 255, 95, 0.25) !important;
}
.chat-compose-row>.button,.chat-compose-icon.button { height:48px; min-height:48px; padding:12px; }
.chat-compose-row>button[type=submit] { padding-inline:20px; }
.chat-compose-row .button.secondary { background:transparent; }
.modal { background:var(--surface); border-color:var(--line); border-radius:var(--radius-dialog); padding:24px; box-shadow:0 24px 80px #0008; }
.modal-backdrop {
  z-index: 1000 !important;
  background: rgba(8, 12, 9, 0.94) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}
.modal.fixed-actions-dialog,
.modal.share-picker-dialog,
.modal.totp-setup-dialog {
  display: flex !important;
  flex-direction: column !important;
  max-height: min(840px, calc(100dvh - 36px)) !important;
  min-height: min(280px, calc(100dvh - 36px));
  overflow: hidden !important;
}

/* PROFILE FLAT DIALOG (660px WIDE, UNCLIPPED, HARMONIOUS) */
.modal.profile-flat-dialog {
  width: min(660px, calc(100vw - 32px)) !important;
  max-width: 660px !important;
  max-height: min(860px, calc(100dvh - 40px)) !important;
  padding: 24px 28px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: var(--surface, #141814) !important;
}
.profile-flat-dialog .modal-header {
  padding: 0 0 16px 0 !important;
  margin-bottom: 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.profile-flat-dialog .modal-header-text {
  display: flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}
.profile-flat-dialog .modal-header h2 {
  font-size: 20px !important;
  font-weight: 700 !important;
  letter-spacing: -0.4px !important;
  color: var(--ink, #edf5e7) !important;
  margin: 0 !important;
}
.profile-flat-dialog .modal-subtitle {
  font-size: 12.5px !important;
  color: var(--muted, #859a7a) !important;
  margin: 0 !important;
}
.profile-flat-dialog .modal-scroll-body {
  padding-right: 0 !important;
}
.profile-flat-dialog input {
  outline: none !important;
  box-sizing: border-box !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
}
.profile-flat-dialog input:focus,
.profile-flat-dialog input:focus-visible {
  outline: none !important;
  border-color: var(--accent, #d5ff5f) !important;
  box-shadow: 0 0 0 1.5px var(--accent, #d5ff5f) !important;
  background: rgba(213, 255, 95, 0.03) !important;
}
.profile-flat-dialog .modal-actions,
.modal.profile-flat-dialog #modal-form > .modal-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  margin-top: 16px !important;
  padding-top: 16px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: transparent !important;
}
.profile-flat-dialog .modal-actions > * {
  min-height: 44px !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  border-radius: 12px !important;
  margin: 0 !important;
  white-space: nowrap !important;
}
.profile-flat-dialog .modal-actions > button[data-action="close-modal"] {
  flex: 0 1 140px !important;
  width: auto !important;
  min-width: 110px !important;
}
.profile-flat-dialog .modal-actions > button[type="submit"] {
  flex: 1 1 auto !important;
  width: auto !important;
}
.profile-flat-dialog #edit-preview-avatar svg,
.avatar-badge svg {
  width: 10px !important;
  height: 10px !important;
  display: block !important;
}

/* PASSPORT MINI CARD IN PROFILE HEADER */
.passport-mini-card {
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  transition: all 0.15s ease !important;
}
.passport-mini-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(213, 255, 95, 0.3) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}
.passport-mini-card:active {
  transform: translateY(0);
}

/* STATUS CHIPS - VIBRANT & HIGH CONTRAST */
.status-chip {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 9px !important;
  border-radius: 999px !important;
  letter-spacing: 0.03em !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
}
.status-chip.active {
  background: rgba(213, 255, 95, 0.18) !important;
  color: #d5ff5f !important;
  border: 1px solid rgba(213, 255, 95, 0.4) !important;
}
.status-chip.blue {
  background: rgba(56, 189, 248, 0.18) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
}
.status-chip.muted {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d1d5db !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

/* BUTTON FLAT */
.button-flat {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--ink-secondary, #c5d4be) !important;
  font-family: inherit !important;
  font-size: 12.5px !important;
  font-weight: 550 !important;
  padding: 7px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}
.button-flat:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: var(--ink, #edf5e7) !important;
}
.button-flat.accent {
  border-color: rgba(213, 255, 95, 0.25) !important;
  color: var(--accent, #d5ff5f) !important;
}
.button-flat.accent:hover {
  background: rgba(213, 255, 95, 0.08) !important;
  border-color: var(--accent, #d5ff5f) !important;
}
.button-flat.danger {
  border-color: rgba(239, 68, 68, 0.25) !important;
  color: #ef4444 !important;
}
.button-flat.danger:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: #ef4444 !important;
}
.fixed-actions-dialog > .modal-header,
.share-picker-dialog > .modal-header,
.totp-setup-dialog .modal-header,
.fixed-actions-dialog > p,
.share-picker-dialog > p,
.totp-setup-dialog > p {
  flex: none !important;
}
.fixed-actions-dialog #modal-form,
.share-picker-dialog #modal-form,
.totp-setup-dialog #modal-form {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.fixed-actions-dialog .modal-scroll-body,
.share-picker-dialog .modal-scroll-body,
.totp-setup-dialog .modal-scroll-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 6px !important;
  padding-bottom: 8px !important;
  scrollbar-width: thin !important;
  scrollbar-color: var(--line) transparent !important;
}
.fixed-actions-dialog .modal-scroll-body::-webkit-scrollbar,
.share-picker-dialog .modal-scroll-body::-webkit-scrollbar,
.totp-setup-dialog .modal-scroll-body::-webkit-scrollbar {
  width: 6px !important;
}
.fixed-actions-dialog .modal-scroll-body::-webkit-scrollbar-track,
.share-picker-dialog .modal-scroll-body::-webkit-scrollbar-track,
.totp-setup-dialog .modal-scroll-body::-webkit-scrollbar-track {
  background: transparent !important;
}
.fixed-actions-dialog .modal-scroll-body::-webkit-scrollbar-thumb,
.share-picker-dialog .modal-scroll-body::-webkit-scrollbar-thumb,
.totp-setup-dialog .modal-scroll-body::-webkit-scrollbar-thumb {
  background: var(--line) !important;
  border-radius: 6px !important;
}
.fixed-actions-dialog #modal-form > .modal-actions,
.share-picker-dialog .modal-actions,
.totp-setup-dialog .modal-actions {
  flex: none !important;
  margin-top: 10px !important;
  padding-top: 12px !important;
  border-top: 1px solid var(--line) !important;
  background: var(--surface) !important;
}
.share-picker-dialog .share-input-zone {
  padding: 18px 16px !important;
  gap: 8px !important;
}
.share-picker-dialog .share-input-symbol {
  width: 40px !important;
  height: 40px !important;
}
.share-picker-dialog .share-input-symbol svg {
  width: 22px !important;
  height: 22px !important;
}
.share-picker-dialog .share-input-zone h3 {
  font-size: 19px !important;
  margin: 0 !important;
}
.share-picker-dialog .share-input-zone p {
  font-size: 14px !important;
}
.share-picker-dialog .share-input-zone small {
  font-size: 12px !important;
}
.share-picker-dialog .share-input-policy {
  margin: 10px 0 !important;
  font-size: 13px !important;
  gap: 8px !important;
}

/* Full Width Panel & Biometric Authorization Pattern (Design System 2026) */
.full-width-panel {
  width: min(640px, calc(100vw - 28px)) !important;
  max-width: 640px !important;
  border-radius: var(--radius-dialog) !important;
  background: var(--surface) !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  .modal.system-auth-dialog,
  .modal.totp-setup-dialog,
  .modal.fixed-actions-dialog,
  .full-width-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
  }
}

.auth-fallback-fullwidth {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 4px 0;
}
.auth-biometry-highlight {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(213, 255, 95, 0.08);
  border: 1px solid rgba(213, 255, 95, 0.22);
  border-radius: 16px;
}
.auth-highlight-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: rgba(213, 255, 95, 0.16);
  color: var(--accent);
  border-radius: 12px;
  flex-shrink: 0;
}
.auth-highlight-icon svg {
  width: 26px;
  height: 26px;
}
.auth-biometry-highlight strong {
  display: block;
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 4px;
}
.auth-biometry-highlight p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}
.auth-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.auth-actions-stack .button.primary {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  justify-content: center;
  background: var(--accent);
  color: #101410;
}
.auth-actions-stack .button.secondary,
.auth-actions-stack .button.ghost {
  width: 100%;
  min-height: 42px;
  font-size: 13px;
  border-radius: var(--radius-pill);
  justify-content: center;
}

/* TOTP Setup Dialog - Clean, Aligned, Full Width, No Mamushka */
.modal.totp-setup-dialog {
  width: min(540px, calc(100vw - 28px)) !important;
  padding: 24px !important;
}

/* Channel Create Dialog - Sleek, Clear & Modern */
.modal.channel-create-dialog {
  width: min(500px, calc(100vw - 28px)) !important;
  max-width: 500px !important;
  padding: 24px !important;
}
.channel-create-dialog .modal-header {
  margin-bottom: 6px !important;
}
.channel-create-dialog .modal-subtitle {
  font-size: 13.5px !important;
  color: var(--muted) !important;
  line-height: 1.45 !important;
  margin: 0 0 12px !important;
}
.channel-create-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}
.channel-create-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.channel-create-form label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  margin: 0 !important;
}
.channel-create-form input,
.channel-create-form select {
  width: 100% !important;
  min-height: 44px !important;
  border-radius: 12px !important;
  border: 1px solid var(--line) !important;
  background: var(--canvas) !important;
  color: var(--ink) !important;
  padding: 10px 14px !important;
  font-size: 15px !important;
  outline: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.channel-create-form input:focus,
.channel-create-form select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent) !important;
}
.totp-setup-dialog .modal-header {
  flex: none !important;
  margin-bottom: 4px !important;
}
.totp-setup-dialog .modal-header h2 {
  font-size: 22px !important;
}
.totp-setup-dialog > p {
  flex: none !important;
  margin-bottom: 14px !important;
  font-size: 13.5px !important;
  line-height: 1.45 !important;
  color: var(--muted) !important;
}
.totp-setup-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.totp-unified-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-sizing: border-box;
}
.totp-qr-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
  line-height: 1.4;
}
.totp-biometry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(213, 255, 95, 0.08);
  border: 1px solid rgba(213, 255, 95, 0.22);
}
.totp-biometry-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.totp-biometry-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(213, 255, 95, 0.15);
  color: var(--accent);
  flex-shrink: 0;
}
.totp-biometry-icon svg {
  width: 16px;
  height: 16px;
}
.totp-biometry-info strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}
.totp-biometry-info small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}
.totp-qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.totp-qr-wrap,
.totp-qr-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  margin: 0 auto;
  width: 120px;
  height: 120px;
}
.totp-qr-img {
  display: block;
  width: 104px;
  height: 104px;
  object-fit: contain;
}
.totp-secret-block {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.totp-secret-label,
.totp-secret-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.totp-secret-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 6px 4px 12px;
}
.totp-secret-val,
.totp-secret-code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.05em;
  user-select: all;
}
.totp-copy-btn {
  flex-shrink: 0;
  min-height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}
.totp-backup-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-val-action {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}
.channel-invite-card {
  padding: 20px 24px;
  margin-bottom: 16px;
  border-radius: 14px;
}
.channel-invite-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.channel-invite-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.channel-invite-members {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.totp-copy-btn svg {
  width: 14px;
  height: 14px;
}
.totp-backup-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}
.totp-backup-hint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.totp-code-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.totp-input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
/* OTP INPUT: SLEEK VERTICAL DIGIT CARDS (TALLER THAN WIDE) */
.otp-input,
.totp-setup-dialog .otp-input,
.auth-dialog .otp-input {
  position: relative !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 10px auto 16px auto !important;
}
.otp-input input,
.totp-setup-dialog .otp-input input,
.auth-dialog .otp-input input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  z-index: 2 !important;
  cursor: text !important;
}
.otp-input span,
.totp-setup-dialog .otp-input span,
.auth-dialog .otp-input span {
  box-sizing: border-box !important;
  width: 48px !important;
  height: 64px !important;
  min-width: 44px !important;
  min-height: 58px !important;
  max-width: 52px !important;
  max-height: 68px !important;
  aspect-ratio: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  color: var(--ink, #edf5e7) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}
.otp-input span.current,
.totp-setup-dialog .otp-input span.current,
.auth-dialog .otp-input span.current {
  border: 1.5px solid var(--accent, #d5ff5f) !important;
  background: rgba(213, 255, 95, 0.04) !important;
  box-shadow: 0 0 0 3px rgba(213, 255, 95, 0.18), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1px) !important;
}
.totp-setup-dialog .modal-actions {
  flex: none !important;
  display: flex !important;
  gap: 10px !important;
  margin-top: 10px !important;
  padding-top: 12px !important;
  border-top: 1px solid var(--line) !important;
  background: var(--surface) !important;
}
.totp-setup-dialog .modal-actions > * {
  min-height: 44px !important;
  font-size: 15px !important;
}
.totp-setup-dialog .modal-actions > button[data-action="close-modal"] {
  flex: 1 1 35% !important;
}
.totp-setup-dialog .modal-actions > button[type="submit"] {
  flex: 1 1 65% !important;
}

/* System Auth Dialog (Touch ID) */
.modal.system-auth-dialog {
  width: min(460px, calc(100vw - 28px)) !important;
  padding: 28px 24px 20px !important;
  text-align: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}
.system-auth-dialog .modal-header {
  justify-content: center !important;
  width: 100% !important;
  margin-bottom: 8px !important;
}
.system-auth-dialog .modal-header h2 {
  font-size: 24px !important;
  text-align: center !important;
}
.system-auth-dialog > p {
  text-align: center !important;
  font-size: 14px !important;
  color: var(--muted) !important;
  line-height: 1.5 !important;
  max-width: 380px !important;
  margin: 0 auto 20px !important;
}
.system-auth-dialog .auth-emblem {
  position: static !important;
  margin: 0 auto 16px !important;
  width: 64px !important;
  height: 64px !important;
  border-radius: 20px !important;
  background: rgba(213, 255, 95, 0.12) !important;
  border: 1px solid rgba(213, 255, 95, 0.25) !important;
  display: grid !important;
  place-items: center !important;
  color: var(--accent) !important;
}
.system-auth-dialog .auth-emblem svg {
  width: 32px !important;
  height: 32px !important;
}
.system-auth-dialog #modal-form {
  width: 100% !important;
}
.system-auth-dialog .modal-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: 100% !important;
  margin-top: 16px !important;
  padding-top: 16px !important;
  border-top: 1px solid var(--line) !important;
}
.system-auth-dialog .modal-actions > * {
  width: 100% !important;
  min-height: 46px !important;
}
.modal-header { gap:16px; align-items:flex-start; }
.modal-header h2 { font-size:26px; line-height:1.25; margin-bottom:12px; }
.modal>p { font-size:16px; line-height:1.6; margin-bottom:20px; }
.modal .modal-actions { gap:12px; }
.fixed-actions-dialog #modal-form>.modal-actions { background:var(--surface); padding-top:16px; }
.modal input:not([type=checkbox]),.modal textarea { background:var(--canvas); border-color:var(--line); border-radius:12px; min-height:48px; }
.modal select,
.grant-identity select,
.agent-dialog select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  display: block !important;
  width: 100% !important;
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 38px 0 14px !important;
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  color: var(--ink, #eaffce) !important;
  background-color: var(--canvas, #101411) !important;
  border: 1px solid var(--line, #283424) !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c9c86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 16px !important;
  cursor: pointer !important;
  outline: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.modal select:focus,
.grant-identity select:focus,
.agent-dialog select:focus {
  border-color: var(--accent, #d5ff5f) !important;
  box-shadow: 0 0 0 1.5px var(--accent, #d5ff5f) !important;
}

.grant-identity {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 200px !important;
  gap: 16px !important;
  margin-bottom: 20px !important;
  align-items: end !important;
}

.grant-identity label {
  display: block !important;
  margin-bottom: 8px !important;
  font-size: 14px !important;
  font-weight: 550 !important;
  color: var(--ink-secondary, #b8c5ae) !important;
}
.modal .check { font-size:15px; line-height:1.5; min-height:44px; padding:8px 0; }
.modal .hint { font-size:13px; line-height:1.6; }
.otp-inputs,.otp-fields { gap:8px; }
.modal .error,.error { color:var(--error); }
.notice { border-radius:12px; font-size:15px; line-height:1.6; }
@container chat-area (min-width:920px) {
 .chat-content>.chat-workspace.single-thread.layout-auto { grid-template-columns:330px minmax(0,1fr) !important; }
}
@media(max-width:760px) {
 .content { padding:20px 16px; }
 .device-grid,.channel-grid,.home-device-grid { grid-template-columns:1fr; gap:16px; }
 .settings-stack,.settings-stack .settings-grid { gap:16px; }
 .settings-stack .settings-panel,.device-card { padding:20px; }
 .page-title h1,.hero.home-header h1 { font-size:28px; }
 .chat-focused .content.chat-content { padding:0; }
 .chat-workspace { border-radius:0; border-inline:0; }
 .chat-thread-heading { padding:12px; min-height:72px; }
 .chat-header-actions { grid-template-columns:1fr; }
 .chat-header-actions>.button { min-height:40px; font-size:12px; }
 .chat-header-actions>.button:first-child { display:inline-flex; }
 .chat-stream { padding:16px 12px; }
 .chat-bubble,.chat-bubble.file-message,.chat-bubble:has(.link-preview-slot) { max-width:90%; }
 .chat-composer { padding:12px; }
 .chat-compose-row { grid-template-columns:44px minmax(0,1fr) auto; }
 .chat-compose-row>button[type=submit] { padding-inline:12px; }
 .modal { padding:18px; max-width:calc(100vw - 24px); }
 .modal .modal-actions {
   display: grid !important;
   grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
   gap: 10px !important;
 }
 .modal .modal-actions > * {
   grid-column: auto !important;
   width: 100% !important;
   margin: 0 !important;
 }
}
@media(max-width:900px) {
 .layout .sidebar { width:64px; padding:16px 6px; }
 .layout .main { margin-left:64px; }
 .layout .brand-block { display:flex; flex-direction:column; margin:0 0 20px; }
 .layout .brand-block .brand { display:flex; min-height:40px; }
 .layout .brand-block .brand-symbol { width:32px; height:32px; }
 .layout .brand-wordmark,.layout .nav-label,.layout .sidebar-label,.layout .network-pill,
 .layout nav[aria-label=Canales],.layout .device-self>div:last-child,.layout .sidebar-toggle { display:none; }
 .layout .brand-block .app-version { margin:4px 0 0; font-size:10px; }
 .layout .sidebar .nav-item { width:48px; height:48px; margin:4px auto; padding:12px; justify-content:center; }
 .layout .compact-channels { display:flex; }
 .layout .device-self { padding:12px 0 0; justify-content:center; }
 .layout .topbar { padding:0 16px; }
 .layout .topbar .connection { display:none; }
 .chat-destination { flex:1; }
 .chat-destination-picker { gap:8px; }
 .chat-destination-picker h2 { font-size:16px; }
 .chat-destination-picker>.chat-avatar { display:none; }
 .chat-destination>p { margin-left:0; }
 .chat-destination-picker>svg { flex:none; }
}
@media(prefers-reduced-motion:reduce) {
 *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}

/* The sidebar signature uses the same alignment in both navigation widths. */
.brand-block {
  grid-template-columns: 44px auto;
  grid-template-rows: auto auto;
  width: max-content;
  max-width: 100%;
  gap: 2px 9px;
  margin: 0 8px 18px;
}
.brand-block .brand-symbol { grid-row: 1 / span 2; width: 44px; height: 44px; }
.brand-block .brand-wordmark { width: 83px; height: 44px; object-position: left center; }
.brand-block .app-version { align-self: start; font-size: 11px; }
.navigation-compact .brand-block { margin: 0 auto 12px; align-items: center; }
.navigation-compact .brand-block .brand { min-height: 0; }
.navigation-compact .brand-block .brand-symbol { width: 44px; height: 44px; }
.navigation-compact .brand-block .app-version { margin-top: 0; }

.chat-compose-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
.chat-stream { padding-inline: max(18px, calc((100% - 880px) / 2)); gap: 9px; }
.chat-bubble.chat-grouped { margin-top: -4px; }
.chat-bubble:has(.chat-text-actions) { position: relative; }
.chat-bubble .chat-text-actions { position: absolute; inset-block-start: 5px; inset-inline-end: 5px; margin: 0; opacity: 0; pointer-events: none; display: flex; gap: 4px; z-index: 2; }
.chat-bubble .chat-message-text { padding-inline-end: 52px; }
.chat-bubble:hover .chat-text-actions, .chat-bubble:focus-within .chat-text-actions { opacity: 1; pointer-events: auto; }
.chat-text-actions > .button { min-width: 28px; min-height: 28px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
@media (hover: none) { .chat-bubble .chat-text-actions { opacity: 1; pointer-events: auto; } }
.chat-bubble-time { margin-top: 6px; }
.chat-day { align-self: center; margin: 10px 0 4px; }
.chat-day time { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.link-preview-card { background: var(--canvas); }
.link-preview-card:hover { background: var(--canvas); }
.link-preview-actions, .reader-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.link-preview-actions { padding: 0 10px 10px; }
.link-preview-actions [data-action="link-reader"] { margin-inline-end: auto; }
.link-preview-actions .button { min-height: 36px; padding: 6px 8px; font-size: 12px; }
.link-preview-actions .button svg { width: 16px; height: 16px; }
.chat-draft-preview:not([hidden]) { margin-bottom: 10px; }
.chat-draft-preview > p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.chat-draft-preview .link-preview-card { display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.chat-draft-preview .link-preview-copy { min-width: min(210px, 100%); flex: 1; padding: 9px 12px; gap: 4px; }
.chat-draft-preview .link-preview-copy strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-draft-preview .link-preview-actions { padding: 6px; }
.modal.link-reader-dialog { width: calc(100vw - 40px); max-width: none; max-height: calc(100dvh - 40px); }
.link-reader-dialog .modal-header h2, .link-reader-dialog .link-reader-content { overflow-wrap: anywhere; }
.link-reader-content { width: min(100%, 76ch); margin: 20px auto 0; line-height: 1.7; font-size: 18px; }
.link-reader-content > img { display: block; width: 100%; max-height: 52dvh; object-fit: contain; border-radius: 12px; background: var(--canvas); }
.link-reader-content > p { margin: 18px 0; white-space: pre-wrap; }

.image-viewer { position: relative; }
.file-viewer-image {
  display: grid;
  place-items: safe center;
  height: min(60dvh, 720px);
  min-height: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.file-viewer-image img { max-width: none; max-height: none; width: auto; height: auto; }
.file-viewer-image:not(.zoomed) img:not([width]) { max-width: 100%; max-height: 100%; }
.file-viewer-image.zoomed { cursor: grab; }
.file-viewer-image.dragging { cursor: grabbing; }
.image-zoom-controls {
  position: absolute;
  inset-inline-end: 16px;
  inset-block-end: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 5px 16px #0007;
}
.image-zoom-controls button { min-width: 38px; min-height: 38px; border-radius: 8px; padding: 0 8px; }
.image-zoom-controls button:hover:not(:disabled) { background: var(--surface-raised); }
.image-zoom-controls button:disabled { opacity: .4; }

.chat-stream { padding-inline: clamp(10px, 1.2vw, 20px); }
.chat-bubble.incoming { align-self: flex-start; margin-inline-start: 0; margin-inline-end: 10%; max-width: 90%; }
.chat-bubble.outgoing { align-self: flex-end; margin-inline-start: 10%; margin-inline-end: 0; max-width: 90%; }
.chat-bubble:has(.link-preview-slot) { width: auto; max-width: min(540px, 90%); }
.chat-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }
.chat-header-actions > .button { min-width: 0; }
.link-card-placeholder { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.link-card-placeholder svg { width: 16px; height: 16px; }
.link-preview-card .link-preview-media { display: block; padding: 0; height: clamp(120px, 17vh, 180px); }
.link-preview-card .link-preview-media img { object-position: center; }
.link-preview-card .link-preview-media:focus-visible { outline-offset: -3px; }
.link-preview-card .link-preview-copy { padding: 9px 12px; gap: 5px; }
.link-preview-card .link-preview-copy strong { font-size: 15px; }
.link-preview-card .link-preview-description { font-size: 13px; -webkit-line-clamp: 2; }
.link-preview-card .link-preview-site { font-size: 12px; }
.link-preview-card .link-preview-monogram { width: 20px; height: 20px; font-size: 12px; }
.link-preview-card .link-preview-actions { padding: 0 8px 8px; }

.modal-backdrop.link-reader-dialog-backdrop,
.modal-backdrop.file-viewer-dialog-backdrop,
.modal-backdrop.gallery-dialog-backdrop,
.modal-backdrop:has(.link-reader-dialog),
.modal-backdrop:has(.file-viewer-dialog),
.modal-backdrop:has(.gallery-dialog) {
  padding: 0;
  background: rgba(5, 8, 6, 0.92);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  animation: lightboxBackdropFade 0.18s ease-out forwards;
}

@keyframes lightboxBackdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.link-reader-dialog,
.modal.file-viewer-dialog,
.modal.gallery-dialog {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  overflow: hidden;
  box-shadow: none;
  z-index: 100;
  animation: lightboxDialogFade 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes lightboxDialogFade {
  from {
    opacity: 0;
    transform: scale(0.99);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.link-reader-dialog .modal-header,
.file-viewer-dialog .modal-header,
.gallery-dialog .modal-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  min-height: 58px;
  padding: 0 24px;
  margin: 0;
  background: rgba(12, 17, 13, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}
.modal-header .modal-header-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.link-reader-dialog .modal-header h2,
.file-viewer-dialog .modal-header h2,
.gallery-dialog .modal-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-header .modal-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-reader-dialog > p:empty,
.file-viewer-dialog > p:empty,
.gallery-dialog > p:empty { display: none; }
.file-viewer-dialog > p:not(:empty) {
  display: none;
}
.link-reader-dialog #modal-form,
.file-viewer-dialog #modal-form,
.gallery-dialog #modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin: 0;
  gap: 0;
  overflow: hidden;
  position: relative;
}

/* Telegram / WhatsApp Web Lightbox Style */
.telegram-side-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(22, 30, 24, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  z-index: 10020 !important;
  pointer-events: auto !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
}
.telegram-side-arrow:hover:not(:disabled) {
  background: rgba(35, 48, 38, 0.95);
  transform: translateY(-50%) scale(1.08);
  border-color: rgba(213, 255, 95, 0.45);
  color: #d5ff5f;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65);
}
.telegram-side-arrow:active:not(:disabled) {
  transform: translateY(-50%) scale(0.96);
}
.telegram-side-arrow:disabled {
  opacity: 0.22;
  cursor: not-allowed;
  pointer-events: none;
}
.telegram-side-arrow.prev { left: 24px; }
.telegram-side-arrow.next { right: 24px; }
.telegram-side-arrow svg {
  width: 24px;
  height: 24px;
  pointer-events: none !important;
}

.telegram-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 16px 80px 24px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  cursor: default;
}
.telegram-stage .image-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}
.telegram-stage .file-viewer-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  touch-action: pan-x pan-y;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.telegram-stage .file-viewer-image.zoomed {
  overflow: auto;
}
.telegram-stage .file-viewer-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.8));
  user-select: none;
  border-radius: 4px;
  pointer-events: auto;
}
.telegram-stage .file-viewer-pdf {
  width: min(1040px, 94vw);
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #121813;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}
.telegram-stage .file-viewer-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.telegram-stage .file-viewer-markdown,
.telegram-stage .file-viewer-text {
  width: min(880px, 94vw);
  max-height: 100%;
  overflow-y: auto;
  background: rgba(16, 22, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 32px 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  line-height: 1.68;
}

.telegram-lightbox-capsule {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10010;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 23, 18, 0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}
.telegram-lightbox-counter {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  padding-right: 8px;
  padding-left: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}
.telegram-lightbox-counter strong { color: #fff; }
.telegram-lightbox-capsule .button {
  height: 32px;
  min-height: 32px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.telegram-lightbox-capsule .button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.telegram-lightbox-capsule .button.share-accent {
  border-color: rgba(213, 255, 95, 0.35);
  color: #d5ff5f;
}
.telegram-lightbox-capsule .button.share-accent:hover {
  background: rgba(213, 255, 95, 0.15);
}

@media (max-width: 768px) {
  .telegram-side-arrow {
    width: 38px;
    height: 38px;
  }
  .telegram-side-arrow.prev { left: 10px; }
  .telegram-side-arrow.next { right: 10px; }
  .telegram-stage {
    padding: 12px 48px 20px;
  }
  .telegram-lightbox-capsule {
    bottom: 16px;
    max-width: calc(100vw - 32px);
    overflow-x: auto;
  }
}
.reader-actions,
.file-viewer-actions {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  margin: 0;
  gap: 8px;
  background: rgba(14, 20, 15, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.reader-tools { display: flex; flex-wrap: nowrap; gap: 8px; margin-inline-start: auto; align-items: center; }
.gallery-nav { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.gallery-nav .button { min-width: 32px; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 8px; }
.link-reader-content {
  width: 100%;
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  background: transparent;
}
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 460px); height: 100%; min-height: 0; }
.reader-layout.reader-text-only { grid-template-columns: minmax(0, 1fr); }
.reader-media { min-width: 0; min-height: 0; padding: 0; background: transparent; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.reader-media > img, .reader-player > video {
  display: block;
  max-width: 95%;
  max-height: 92%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  margin: auto;
  filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.65));
}
.reader-media > img + img { margin-top: 10px; }
.reader-player { display: grid; place-items: center; min-height: 75px; background: transparent; }
.reader-player:has(iframe) { display: block; }
.reader-player iframe { display: block; width: 100%; min-height: 290px; height: min(62dvh, 600px); border: 0; border-radius: 0; }
.reader-details {
  min-width: 0;
  padding: 24px 30px;
  overflow-y: auto;
  background: rgba(14, 18, 14, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.reader-text-only .reader-details { width: min(100%, 74ch); margin: auto; border-left: none; }
.reader-post p, .reader-comments p { margin: 12px 0; white-space: pre-wrap; font-size: 15px; line-height: 1.62; }
.reader-byline { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.reader-byline small { display: block; color: var(--muted); font-size: 12px; }
.reader-avatar { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-light); color: var(--accent); overflow: hidden; }
.reader-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.reader-comments { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.reader-comments h3 { margin: 0; font-size: 15px; }
.reader-comments article { padding-block: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.reader-comments article p { margin: 3px 0; }
@media (max-width: 850px) {
  .chat-header-actions > .button { font-size: 0; min-width: 36px; min-height: 36px; padding: 8px; }
  .chat-header-actions > .button svg { width: 18px; height: 18px; }
}

.chat-message-text.chat-url-only .message-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

/* Chat composer and galleries keep the shape of their content. */
.chat-compose-row { --composer-control: 48px; grid-template-columns: var(--composer-control) minmax(0, 1fr) auto; }
.chat-compose-row > .button { box-sizing: border-box; height: var(--composer-control); min-height: var(--composer-control); }
.chat-compose-row textarea {
  box-sizing: border-box;
  field-sizing: content;
  height: auto;
  min-height: var(--composer-control);
  max-height: calc(4 * 22px + 26px);
  line-height: 22px;
  padding: 12px 16px;
  overflow-y: auto;
  resize: none;
}
.gallery-grid, .link-reader-content, .reader-media-strip {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.chat-compose-row textarea {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.chat-compose-row textarea::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.link-preview-card .link-preview-media {
  display: grid;
  place-items: center;
  height: auto;
  max-height: 210px;
  background: var(--sidebar);
}
.link-preview-card .link-preview-media img { width: 100%; height: auto; max-height: 210px; object-fit: contain; }

.modal.gallery-dialog { display: flex; flex-direction: column; width: min(1240px, calc(100vw - 40px)); max-width: none; max-height: calc(100dvh - 48px); overflow: hidden; }
.gallery-dialog > p:empty { display: none; }
.gallery-dialog #modal-form { display: flex; flex-direction: column; min-height: 0; }
.gallery-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 16px; }
.gallery-filter-bar .button[aria-pressed="true"] { color: var(--accent); background: var(--accent-light); border-color: var(--accent); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; overflow: auto; padding: 4px; overscroll-behavior: contain; }
.gallery-card { min-width: 0; padding: 0; text-align: left; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); }
.gallery-card:hover, .gallery-card:focus-visible { border-color: var(--accent); }
.gallery-card-media { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; color: var(--accent); background: var(--sidebar); overflow: hidden; }
.gallery-card-media svg { width: 30px; height: 30px; }
.gallery-card-media img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery-card-info { display: grid; gap: 4px; min-width: 0; padding: 11px 12px; }
.gallery-card-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.gallery-card-info small { color: var(--muted); font-size: 12px; }

.reader-media {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.reader-media-stage {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  background: transparent !important;
  contain: size layout !important;
}
.reader-media-stage > .reader-player { width: 100%; height: 100%; }
.reader-stage-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 26, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  z-index: 30 !important;
  pointer-events: auto !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.16s ease;
  padding: 0;
}
.reader-stage-arrow.prev { left: 16px; }
.reader-stage-arrow.next { right: 16px; }
.reader-stage-arrow:hover:not(:disabled) {
  background: rgba(35, 48, 38, 0.95);
  border-color: rgba(213, 255, 95, 0.5);
  color: #d5ff5f;
  transform: translateY(-50%) scale(1.08);
}
.reader-stage-arrow:disabled {
  opacity: 0.18;
  cursor: not-allowed;
  pointer-events: none;
}
.reader-stage-arrow svg {
  width: 22px;
  height: 22px;
  pointer-events: none !important;
}
.media-step-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.14s ease;
}
.media-step-arrow:hover:not(:disabled) {
  background: rgba(213, 255, 95, 0.18);
  border-color: rgba(213, 255, 95, 0.5);
  color: #d5ff5f;
}
.media-step-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}
.media-step-arrow svg {
  width: 18px;
  height: 18px;
}
.reader-media-controls {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}
.reader-media-controls .button { min-width: 40px; padding: 8px; }
.reader-media-strip {
  flex: none;
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 4px 8px 8px;
}
.reader-media-strip button { flex: 0 0 62px; height: 52px; display: grid; place-items: center; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.reader-media-strip button[aria-pressed="true"] { border-color: var(--accent); }
.reader-media-strip button img { width: 100%; height: 100%; object-fit: contain; }

/* A single conversation header keeps the composer and history in view. */
.chat-thread { grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-thread:not(:has(.chat-stream)) { grid-template-rows: minmax(0, 1fr); }
.peer-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #0b0f0b;
  margin-left: 6px;
  vertical-align: middle;
}
.peer-verified-badge svg {
  width: 10px;
  height: 10px;
  stroke: #0b0f0b;
  stroke-width: 3;
}
.chat-focused .topbar { height: 64px; min-height: 64px; gap: 12px; }
.chat-focused .topbar > .chat-destination { min-width: 0; }
.chat-topbar-name { display: grid; min-width: 0; gap: 3px; }
.chat-topbar-name > strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 17px; }
.chat-topbar-name > small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.chat-focused .topbar h1 { font-size: 20px; }
.sharing-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.sharing-tabs [aria-pressed="true"] { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.brand-block {
  grid-template-columns: auto auto;
  align-items: center;
  justify-items: center;
  margin-inline: auto;
  gap: 3px 9px;
}
.brand-block .brand-symbol { grid-row: 1; width: 47px; height: 47px; }
.brand-block .brand-wordmark { width: 67px; height: 43px; object-fit: contain; object-position: center; }
.brand-block .app-version { grid-column: 1 / -1; text-align: center; }
.navigation-compact .brand-block .app-version { display: none; }

.modal.link-reader-dialog { position: relative; }
.link-reader-dialog #modal-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.reader-expand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 8px 12px;
  box-sizing: border-box;
  border-radius: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
}
.reader-expand img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.65));
  transition: opacity 0.2s ease;
}
.reader-expand-label {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(14, 20, 15, 0.75);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
}
.reader-expand-label:hover {
  background: rgba(25, 35, 26, 0.9);
  border-color: rgba(213, 255, 95, 0.4);
  color: #d5ff5f;
  transform: scale(1.04);
}
.reader-expand-label svg { width: 14px; height: 14px; }
.reader-zoom-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 0;
  box-sizing: border-box;
  animation: readerZoomOverlayFade 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes readerZoomOverlayFade {
  from {
    opacity: 0;
    transform: scale(0.99);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.reader-zoom-overlay > header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 52px;
  min-height: 52px;
  padding: 0 20px;
  background: rgba(14, 20, 15, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.reader-zoom-overlay .reader-zoom-stage {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}
.reader-zoom-overlay .image-viewer {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: transparent;
}
.reader-zoom-overlay .file-viewer-image {
  height: 100%;
  width: 100%;
  min-height: 0;
  min-width: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.reader-zoom-overlay .file-viewer-image.zoomed {
  overflow: auto;
}
.reader-zoom-overlay .file-viewer-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 50px rgba(0, 0, 0, 0.75));
  user-select: none;
  pointer-events: auto;
}
.modal.link-reader-dialog:has(.reader-zoom-overlay) { width: 100vw; height: 100dvh; max-height: 100dvh; }
.reader-player {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 0;
  background: transparent !important;
}
.reader-player-screen {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  background: transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  overflow: hidden;
}
.reader-player-screen.has-poster .reader-player-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 96%;
  max-height: 94%;
  object-fit: contain;
  margin: auto;
  background: transparent;
}
.reader-player-screen.has-poster .reader-player-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.6) 100%);
  backdrop-filter: blur(1.5px);
  z-index: 2;
}
.reader-player-overlay {
  display: grid;
  place-items: center;
  z-index: 2;
}
.reader-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #0d140e;
  border: 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 160ms ease;
}
.reader-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.reader-play-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}
.reader-player-screen > video {
  width: 100%;
  height: 100%;
  max-width: 96% !important;
  max-height: 94% !important;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
  margin: auto;
}
.reader-player-screen > iframe {
  width: 100%;
  height: 100%;
  max-width: 96% !important;
  max-height: 94% !important;
  border: 0;
  border-radius: 8px;
  margin: auto;
}
.reader-skeleton {
  border-radius: 12px;
  background: linear-gradient(110deg, var(--surface-raised) 20%, var(--line) 45%, var(--surface-raised) 70%);
  background-size: 230% 100%;
  animation: via-link-loading 1.4s linear infinite;
}
.reader-skeleton-media { min-height: clamp(220px, 48dvh, 570px); }
.reader-skeleton-strip { height: 24px; width: 45%; margin-inline: auto; }
.reader-skeleton-text { height: 52px; margin-block: 16px; }
@media (prefers-reduced-motion: reduce) { .reader-skeleton { animation: none; } }

.chat-thread > .chat-pins { grid-row: 1; }
.chat-thread > .chat-stream { grid-row: 2; }
.chat-thread > .chat-composer { grid-row: 3; }
@media (max-width: 900px) { .layout .brand-block .app-version { display: none; } }

/* Media owns the zoom surface. Toolbars retain their dimensions and position. */
.link-reader-dialog #modal-form,
.file-viewer-dialog #modal-form,
.gallery-dialog #modal-form { flex: 1; overflow: hidden; }
.link-reader-content { flex: 1; }
.reader-layout { height: 100%; min-height: 0; }
.reader-media { min-height: 0; overflow: hidden; }
.reader-media-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; contain: size layout; }
.reader-expand { height: 100%; min-height: 0; }
.reader-details { overflow: auto; min-height: 0; }
.reader-zoom-overlay > header { min-width: 0; }
.reader-zoom-overlay > header strong { font-size: 14px; white-space: nowrap; font-weight: 600; }
.reader-zoom-overlay > header .button { min-width: 0; font-size: 13px; }
.reader-zoom-overlay .image-viewer { min-height: 0; overflow: hidden; height: 100%; width: 100%; position: relative; }
.reader-zoom-overlay .file-viewer-image { height: 100%; width: 100%; }
.file-viewer-dialog #file-viewer-body {
  min-height: 0 !important;
  max-height: none !important;
  flex: 1 1 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  background: transparent !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.file-viewer-dialog .file-viewer-markdown,
.file-viewer-dialog .file-viewer-text {
  min-height: 100% !important;
  width: 100% !important;
  max-width: 920px !important;
  margin: 0 auto !important;
  padding: 32px 36px 140px !important;
  box-sizing: border-box !important;
  background: transparent !important;
  overflow-wrap: break-word !important;
}
.file-viewer-dialog .file-viewer-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 13.5px !important;
  line-height: 1.65 !important;
  color: #e4eee0 !important;
  white-space: pre-wrap !important;
}
.file-viewer-dialog .file-viewer-markdown {
  font-size: 16px !important;
  line-height: 1.75 !important;
  color: #e4eee0 !important;
}
.file-viewer-dialog .file-viewer-markdown h1 {
  font-size: 26px !important;
  font-weight: 700 !important;
  margin: 20px 0 12px !important;
  color: #fff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding-bottom: 8px !important;
}
.file-viewer-dialog .file-viewer-markdown h2 {
  font-size: 21px !important;
  font-weight: 650 !important;
  margin: 24px 0 10px !important;
  color: #fff !important;
}
.file-viewer-dialog .file-viewer-markdown h3 {
  font-size: 17px !important;
  font-weight: 650 !important;
  margin: 18px 0 8px !important;
  color: #fff !important;
}
.file-viewer-dialog .file-viewer-markdown p {
  margin: 10px 0 !important;
  line-height: 1.7 !important;
}
.file-viewer-dialog .file-viewer-markdown ul,
.file-viewer-dialog .file-viewer-markdown ol {
  padding-left: 24px !important;
  margin: 10px 0 !important;
}
.file-viewer-dialog .file-viewer-markdown li {
  margin: 6px 0 !important;
  line-height: 1.65 !important;
}
.file-viewer-dialog #file-viewer-body > .image-viewer,
.file-viewer-dialog #file-viewer-body .file-viewer-image { height: 100%; min-height: 0; background: transparent; display: grid; place-items: center; padding: 20px; box-sizing: border-box !important; }
.file-viewer-dialog .file-viewer-image img { max-width: 95%; max-height: 92%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 24px 50px rgba(0, 0, 0, 0.75)); }
.file-viewer-pdf { width: 100%; height: 100%; flex: 1; min-height: 0; border: 0; background: #101410; }
.file-viewer-image { touch-action: pan-x pan-y; }
.image-zoom-controls { z-index: 3; }
.gallery-grid { flex: 1; min-height: 0; align-content: start; }
.gallery-dialog #modal-form {
  padding: 16px 20px 20px;
  gap: 12px;
}
.gallery-query {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.gallery-search-wrap {
  position: relative;
  flex: 1 1 200px;
  min-width: 140px;
  display: flex;
  align-items: center;
}
.gallery-search-wrap .gallery-search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-search-wrap .gallery-search-icon svg {
  width: 16px;
  height: 16px;
}
.gallery-search-wrap input[type="search"] {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0 12px 0 36px;
  font-size: 13.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 140ms ease, background 140ms ease;
}
.gallery-search-wrap input[type="search"]:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
}
.gallery-period-wrap {
  flex: 0 0 auto;
}
.gallery-period-wrap select {
  height: 38px;
  min-height: 38px;
  padding: 0 32px 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-sizing: border-box;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238c9c86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  cursor: pointer;
  transition: border-color 140ms ease;
}
.gallery-period-wrap select:focus {
  border-color: var(--accent);
}
.gallery-custom {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.gallery-custom input[type="date"] {
  height: 36px;
  padding: 0 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  box-sizing: border-box;
}
.gallery-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
}
.gallery-filter-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}
.gallery-filter-scroll::-webkit-scrollbar {
  display: none;
}
.gallery-filter-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: all 120ms ease;
}
.gallery-filter-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}
.gallery-filter-chip[aria-pressed="true"] {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
}
.gallery-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.gallery-result-count {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.35);
  flex: none;
}
.gallery-view-toggle > button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}
.gallery-view-toggle > button svg {
  width: 14px;
  height: 14px;
}
.gallery-view-toggle > button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 600px) {
  .gallery-dialog #modal-form {
    padding: 12px 14px 16px !important;
    gap: 10px;
  }
  .gallery-query .gallery-search-wrap {
    flex: 1 1 100%;
    width: 100%;
  }
  .gallery-query .gallery-period-wrap {
    flex: 1 1 auto;
  }
}
@media (max-width: 440px) {
  .gallery-view-toggle .view-mode-label {
    display: none;
  }
  .gallery-view-toggle > button {
    padding: 0 6px;
  }
}
.layout.chat-focused .channel-conversation,
.channel-conversation {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: none;
  border-radius: 0;
  background: var(--canvas);
}
.channel-conversation .tabs {
  flex: none;
  margin: 0;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
}
.channel-feed-stream {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
.channel-library {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}
.channel-readonly { padding: 12px 20px; color: var(--muted); border-top: 1px solid var(--line); }
.channel-participant { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; align-items: center; margin: 12px 0; }
.channel-participant .check, .channel-participant select { margin: 0; }
.gallery-custom[hidden] { display: none; }
@media (max-width: 700px) {
  .channel-feed-stream { padding: 12px 8px; gap: 6px; }
  .channel-conversation .tabs { padding: 6px 12px; }
}
.image-zoom-controls [data-zoom="fit"] { width: 76px; min-width: 76px; font-variant-numeric: tabular-nums; }

.channel-archive-status { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.channel-archive-status > div { display: grid; gap: 4px; min-width: 0; }
.channel-archive-status strong { font-size: 14px; }
.channel-archive-status small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.channel-archive-status .button { flex: none; }
@media (max-width: 700px) { .channel-archive-status { padding: 10px 12px; gap: 10px; } }

/* Conversation controls belong to the conversation; global preferences stay global. */
.chat-focused .topbar { padding: 0 24px; height: 64px; min-height: 64px; }
.chat-destination { flex: 1; min-width: 0; }
.chat-destination-picker { display: flex; align-items: center; gap: 10px; min-height: 42px; max-width: 100%; padding: 4px 8px; }
.chat-destination-picker .chat-avatar { width: 34px; height: 34px; min-width: 34px; }
.chat-topbar-name { display: block; min-width: 0; }
.chat-topbar-name strong { display: block; font-size: 17px; font-weight: 650; line-height: 1.3; }
.chat-destination-status { display: inline-flex; flex: none; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.chat-menu-trigger { min-width: 42px; width: 42px; height: 42px; padding: 10px; }
.chat-menu-trigger svg { width: 20px; height: 20px; }
.chat-options-dialog { max-width: 520px; }
.chat-options-menu { display: grid; gap: 4px; }
.chat-options-menu .menu-row { min-height: 68px; padding: 12px; border-radius: 12px; }
.chat-options-menu .menu-row:hover { background: var(--surface-raised); }
.chat-history-feed { display: grid; gap: 12px; }
.settings-searchbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 24px; }
.settings-searchbar .search { flex: 1; min-width: 240px; max-width: 680px; margin: 0; }
.settings-searchbar input { width: 100%; min-height: 46px; }
#settings-search-count { color: var(--muted); font-size: 13px; }
.settings-unified { display: grid; gap: 20px; }
.settings-unified .settings-section { margin: 0; padding: 24px; }
.settings-section[hidden], .settings-search-empty[hidden] { display: none !important; }
.settings-section h2 { font-size: 21px; line-height: 1.3; margin: 0 0 14px; }
.settings-section .settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 0; }
.settings-actions .button { min-height: 44px; min-width: 160px; margin: 0; }
.setting-row, .setting-toggle { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; margin: 0; }
.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-row > div:first-child, .setting-toggle-copy { display: grid; gap: 6px; min-width: 0; }
.setting-row strong, .setting-toggle strong { color: var(--ink); font-size: 16px; font-weight: 600; }
.setting-row small, .setting-toggle small { display: block; color: var(--muted); font-size: 14px; line-height: 1.5; }
.setting-toggle { cursor: pointer; }
.setting-toggle + .setting-toggle { border-top: 1px solid var(--line); }
.toggle-control { position: relative; flex: none; display: inline-flex; width: 46px; height: 28px; }
.toggle-control input { position: absolute; inset: 0; width: 46px; height: 28px; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { width: 46px; height: 28px; border: 1px solid var(--muted); border-radius: 999px; background: var(--canvas); transition: background .16s ease, border-color .16s ease; }
.switch-track::after { content: ''; display: block; width: 20px; height: 20px; margin: 3px; border-radius: 50%; background: var(--muted); transition: transform .16s ease; }
.toggle-control input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.toggle-control input:checked + .switch-track::after { background: #142000; transform: translateX(18px); }
.toggle-control input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 4px; }
.settings-technical { margin: 18px 0 0; border-top: 1px solid var(--line); padding-top: 16px; }
.settings-technical summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.settings-search-empty { margin-top: 20px; padding: 24px; }
@media (max-width: 1040px) {
  .setting-row {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 14px !important;
  }
  .setting-row > .preference-segments {
    display: flex !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
  }
  .setting-row > .preference-segments > button {
    flex: 1 1 0 !important;
    text-align: center !important;
    min-width: 0 !important;
  }
}
@media (max-width: 760px) {
  .chat-focused .topbar { padding: 0 12px; gap: 8px; }
  .chat-focused .top-actions .connection, .chat-focused .top-help, .chat-focused .top-device { display: none; }
  .chat-destination-status { font-size: 11px; padding: 3px 6px; }
  .settings-actions .button { flex: 1 1 180px; }
  .settings-unified .settings-section { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
.quick-menu-divider { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.quick-device-details { margin-bottom: 16px; }
.quick-device-details .detail-line { gap: 16px; }

.coordination-row{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 0;border-top:1px solid var(--border);min-width:0}.coordination-row>div{min-width:0}.coordination-row small{display:block;margin-top:8px}.coordination-row code{display:block;overflow-wrap:anywhere;margin-top:8px}.coordination-row p{white-space:pre-wrap;overflow-wrap:anywhere}

/* Consistent vertical rhythm between consecutive stacked panels and grids (excluding grid items) */
:not(.home-device-grid, .device-grid, .channel-grid, .settings-grid, .settings-unified, .settings-stack, .bottom-grid) > .panel + .panel,
.panel + .device-grid,
.device-grid + .panel,
.channel-grid + .panel,
.panel + .channel-grid,
.incoming-requests,
.incoming-messages {
  margin-top: 20px;
}

.home-device-grid > .home-device,
.device-grid > .panel,
.channel-grid > .panel,
.settings-grid > .panel,
.settings-unified > .panel {
  margin-top: 0;
}

.files-panel + .section-heading,
.panel + .section-heading,
.device-grid + .section-heading,
.channel-grid + .section-heading {
  margin-top: 28px;
}

.panel > .section-heading:first-child,
.settings-panel > .section-heading:first-child {
  margin-top: 0;
}

/* Interactive brand logo & hierarchical breadcrumbs */
button.brand-block {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
  padding: 6px;
  transition: background var(--motion-fast);
}
button.brand-block:hover {
  background: rgba(255, 255, 255, 0.05);
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}
.topbar-chat-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.topbar-chat-nav .chat-destination {
  flex: 1;
  min-width: 0;
}
.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--motion-fast), background var(--motion-fast);
}
.breadcrumb-link svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.breadcrumb-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}
.breadcrumb-link.current,
.breadcrumb-current {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}
.breadcrumb-current {
  padding: 4px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb-sep {
  color: var(--subtle);
  font-size: 13px;
  user-select: none;
  padding: 0 1px;
}

/* Harmonized compact sidebar badge, home device card heights, and headings */
.navigation-compact .sidebar .nav-item {
  position: relative;
}
.navigation-compact .sidebar .nav-item .count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 17px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.home-device-grid {
  align-items: stretch;
}
.home-device {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.home-device .device-destination {
  flex: 1;
}
.home-device.add-device {
  height: 100%;
  justify-content: center;
}
.section-heading > div > span {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

/* Clickable chat file bubbles, image placeholder, and file-viewer action bar */
.chat-file.clickable {
  appearance: none;
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 6px;
  margin: -6px;
  border-radius: 10px;
  transition: background var(--motion-fast);
}
.chat-file.clickable:hover {
  background: rgba(255, 255, 255, 0.06);
}
.chat-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 240px;
  max-width: 100%;
  height: 140px;
  color: var(--muted);
  font-size: 13px;
}
.chat-image-placeholder svg {
  width: 28px;
  height: 28px;
}
.file-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.file-viewer-actions .gallery-nav {
  margin-inline-end: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.file-viewer-actions .gallery-nav span {
  font-size: 13px;
  color: var(--muted);
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}
.image-zoom-controls button {
  min-width: 34px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
}
.image-zoom-controls button:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--accent);
}
.image-zoom-controls button:disabled {
  opacity: 0.45;
  cursor: default;
}
.link-preview-card .link-preview-media {
  width: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
}
.link-preview-copy.clickable {
  cursor: pointer;
}
.link-reader-loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
}

/* Gallery & History scroll, mosaic icon centering, list mode & skeletons */
.modal.gallery-dialog,
.modal.chat-history-dialog {
  display: flex;
  flex-direction: column;
  width: min(1040px, calc(100vw - 40px));
  max-width: none;
  height: auto;
  max-height: min(860px, calc(100dvh - 48px));
  overflow: hidden;
}

.chat-history-dialog #modal-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
}

.gallery-toolbar .gallery-filter-bar {
  padding: 0;
}

.gallery-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--canvas);
}

.gallery-view-toggle > button,
.gallery-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.gallery-view-toggle > button svg,
.gallery-view-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 2;
}

.gallery-view-toggle > button:hover:not([aria-pressed="true"]),
.gallery-view-btn:hover:not([aria-pressed="true"]) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.gallery-view-toggle > button[aria-pressed="true"],
.gallery-view-btn[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--line);
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.gallery-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
  padding: 4px 4px 12px;
}

.gallery-grid.transfers-grid {
  max-height: 62dvh;
  overflow-y: auto;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-height: 212px;
  flex-shrink: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  overflow: hidden;
  padding: 0;
  text-align: left;
  color: var(--ink);
  transition: border-color 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.gallery-card:hover {
  border-color: rgba(213, 255, 95, 0.36);
}

.gallery-card-media {
  position: relative;
  height: 136px;
  flex: 0 0 136px;
  width: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(213, 255, 95, 0.03));
  overflow: hidden;
}

.gallery-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  background: rgba(213, 255, 95, 0.08);
  border: 1px solid rgba(213, 255, 95, 0.16);
  color: var(--accent);
}

.gallery-card-icon svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.gallery-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  min-width: 0;
}

.gallery-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 4px 12px;
}

.gallery-list-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink);
  text-align: left;
  width: 100%;
  flex-shrink: 0;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.gallery-list-row:hover {
  border-color: rgba(213, 255, 95, 0.36);
}

.gallery-list-media {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  overflow: hidden;
  flex: none;
}

.gallery-list-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-list-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.gallery-list-icon svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.gallery-list-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gallery-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-list-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-list-action {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.chat-history-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 12px;
}

.history-feed.transfers-list-scroll {
  max-height: 62dvh;
  overflow-y: auto;
  padding-right: 4px;
}

.gallery-card-skeleton,
.gallery-skeleton-row {
  pointer-events: none;
}

@keyframes gallery-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.gallery-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: gallery-shimmer 1.35s ease-in-out infinite;
}

.gallery-title-skeleton {
  height: 13px;
  width: 72%;
  border-radius: 6px;
}

.gallery-sub-skeleton {
  height: 11px;
  width: 48%;
  border-radius: 5px;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-skeleton {
    animation: none;
  }
}

/* Polish pass: pairing QR, gallery list rhythm and history cards */
.modal:has(.qr-code) { width: min(460px, calc(100vw - 40px)); }
.modal:has(.qr-code) > p { text-align: center; margin-inline: auto; max-width: 360px; }
.modal:has(.qr-code) .modal-header { justify-content: center; position: relative; }
.modal:has(.qr-code) .modal-header > .icon-button { position: absolute; right: -8px; top: -6px; }
.modal:has(.qr-code) #modal-form { display: flex; flex-direction: column; align-items: center; text-align: center; }
.qr-code { display: grid; place-items: center; margin: 4px auto 16px; padding: 12px; border-radius: 18px; background: #fff; box-shadow: 0 10px 30px #0006; }
.qr-code img { display: block; width: 236px; height: 236px; }
.modal:has(.qr-code) #modal-form > p { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--ink); }
.modal:has(.qr-code) #modal-form > p.hint { margin: 0 0 18px; max-width: 340px; font-size: 13px; font-weight: 400; color: var(--muted); }
.modal:has(.qr-code) #modal-form > .button { align-self: stretch; }
.modal:has(.qr-code) #modal-error:empty { display: none; }

/* Gallery toolbar: filters and view toggle share one baseline */
.gallery-toolbar { align-items: center; padding-bottom: 10px; }
.gallery-toolbar .gallery-filter-bar { gap: 6px; }
.gallery-toolbar .gallery-filter-bar .button { min-height: 36px; padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.gallery-view-toggle > button, .gallery-view-btn { height: 32px; min-height: 32px; padding: 0 12px; font-size: 13px; }
.gallery-result-count { margin: 0 0 10px; font-size: 12px; letter-spacing: .2px; }

/* Gallery list rows: legible type scale and centered media */
.gallery-list { gap: 8px; padding: 2px 4px 12px 2px; }
.gallery-list-row { grid-template-columns: 52px minmax(0, 1fr) 20px; gap: 14px; min-height: 76px; padding: 12px 14px; border-radius: 14px; }
.gallery-list-row:hover { background: #29322c; }
.gallery-list-media { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; }
.gallery-list-media .gallery-skeleton { width: 100%; height: 100%; }
.gallery-list-info { gap: 4px; justify-content: center; }
.gallery-list-info .gallery-card-title { font-size: 14px; font-weight: 650; line-height: 1.35; }
.gallery-list-sub { font-size: 13px; line-height: 1.4; }
.gallery-list-info small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.gallery-list-action { display: grid; place-items: center; color: var(--muted); }
.gallery-list-action svg { width: 16px; height: 16px; }
.gallery-list-row:hover .gallery-list-action { color: var(--accent); }
.gallery-skeleton-row { height: 76px; border-radius: 14px; flex-shrink: 0; }

/* Gallery mosaic card text */
.gallery-card-info { gap: 4px; padding: 10px 12px 12px; }
.gallery-card-info strong { font-size: 13px; font-weight: 650; }
.gallery-card-info small { font-size: 12px; }

/* History (chat modal and Compartir > Historial): rows become consistent cards */
.chat-history-feed { gap: 8px; padding: 2px 4px 12px 2px; }
.chat-history-feed .transfer-row,
.history-feed .transfer-row { padding: 14px 16px; }
.chat-history-feed .transfer-row { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); flex-shrink: 0; }
.chat-history-feed .transfer-row:last-child { border-bottom: 1px solid var(--line); }
.chat-history-feed .transfer-head,
.history-feed .transfer-head { align-items: center; flex-wrap: nowrap; gap: 14px; font-size: 15px; }
.chat-history-feed .history-file-name,
.chat-history-feed .history-text-title,
.history-feed .history-file-name,
.history-feed .history-text-title { font-size: 15px; font-weight: 650; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-feed .history-entry-title > strong,
.history-feed .history-entry-title > strong { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-feed .transfer-head small,
.history-feed .transfer-head small { font-size: 12px; margin-top: 4px; }
.chat-history-feed .history-actions,
.history-feed .history-actions { gap: 8px; }
.chat-history-feed .history-actions .button.small,
.history-feed .history-actions .button.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.chat-history-feed .history-more,
.history-feed .history-more { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
.chat-history-feed .history-text-preview,
.history-feed .history-text-preview { margin: 8px 0 0; font-size: 14px; line-height: 1.5; -webkit-line-clamp: 3; color: var(--ink); }
.chat-history-feed .link-preview-slot,
.history-feed .link-preview-slot { max-width: 420px; margin-top: 10px; }
.chat-history-dialog .modal-actions { margin-top: 12px; }
@media (max-width: 800px) {
  .chat-history-feed .transfer-head, .history-feed .transfer-head { flex-wrap: wrap; }
}

/* File bubble download & share quick actions */
.chat-file-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.chat-file-actions:empty {
  display: none;
}
.chat-file-actions .button {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 550;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  transition: all 0.15s ease;
}
.chat-file-actions .button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.22);
}
.chat-bubble.outgoing .chat-file-actions .button {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 255, 255, 0.15);
  color: #edf7ff;
}
.chat-bubble.outgoing .chat-file-actions .button:hover {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.28);
}
.chat-file-actions .button svg {
  width: 13px;
  height: 13px;
  opacity: 0.85;
}

/* Forward & Share dialog */
.forward-dialog {
  max-width: 500px;
}
.forward-lightbox-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 20050 !important;
  background: rgba(0, 0, 0, 0.68) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
  animation: lightboxBackdropFade 0.15s ease-out forwards !important;
}
.forward-lightbox-overlay .forward-dialog {
  position: relative !important;
  width: min(520px, 94vw) !important;
  max-width: 520px !important;
  max-height: min(88dvh, 700px) !important;
  overflow-y: auto !important;
  background: #141a15 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 16px !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85) !important;
  padding: 20px 24px !important;
}
.forward-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.forward-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
  user-select: none;
  box-sizing: border-box;
}
.forward-summary:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.18);
}
.forward-summary:active {
  transform: scale(0.995);
}
.forward-summary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  flex-shrink: 0;
}
.forward-summary-icon svg {
  width: 18px;
  height: 18px;
}
.forward-summary-content {
  flex: 1;
  min-width: 0;
}
.forward-summary strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forward-summary small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.forward-copy-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
  transition: all 0.18s ease;
}
.forward-summary:hover .forward-copy-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.22);
}
.forward-summary.copied {
  border-color: var(--accent, #d5ff5f);
  background: rgba(213, 255, 95, 0.08);
}
.forward-summary.copied .forward-copy-badge {
  background: rgba(213, 255, 95, 0.2);
  border-color: var(--accent, #d5ff5f);
  color: var(--accent, #d5ff5f);
}
.forward-copy-badge svg {
  width: 16px;
  height: 16px;
}
.forward-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px 2px;
}
.forward-peers-grid,
.forward-channels-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.forward-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: var(--ink);
}
.forward-item-card:hover {
  background: rgba(213, 255, 95, 0.08);
  border-color: rgba(213, 255, 95, 0.35);
  transform: translateX(2px);
}
.forward-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  flex-shrink: 0;
}
.forward-item-icon svg {
  width: 16px;
  height: 16px;
}
.forward-item-info {
  flex: 1;
  min-width: 0;
}
.forward-item-info strong {
  display: block;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.forward-item-info small {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}
.peer-online {
  color: var(--success);
}
.peer-offline {
  color: var(--muted);
}
.forward-item-card svg:last-child {
  width: 14px;
  height: 14px;
  color: var(--subtle);
  flex-shrink: 0;
}
.forward-system-btn,
.forward-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

/* Image zoom modal controls */
.reader-zoom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* GitHub repo card in chat */
.link-preview-card.github-preview-card {
  border-left: 3px solid #2ea043;
  background: rgba(20, 27, 20, 0.55);
}
.github-monogram svg {
  width: 14px;
  height: 14px;
}

/* GitHub repo reader & README styling */
.reader-repo-header {
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.reader-repo-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink, #f3f7f2);
  letter-spacing: -0.01em;
}
.reader-repo-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted, #94a3b8);
}
.reader-markdown {
  font-size: 14px;
  line-height: 1.65;
  color: #e2e8f0;
  overflow-wrap: break-word;
}
.reader-markdown h1,
.reader-markdown h2,
.reader-markdown h3,
.reader-markdown h4 {
  color: #f8fafc;
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.reader-markdown h1 { font-size: 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 8px; }
.reader-markdown h2 { font-size: 17px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); padding-bottom: 6px; }
.reader-markdown h3 { font-size: 15px; }
.reader-markdown p { margin: 10px 0; }
.reader-markdown pre {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 14px 0;
}
.reader-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.reader-markdown :not(pre) > code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}
.reader-markdown blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  margin: 14px 0;
  padding: 4px 14px;
  color: #94a3b8;
}
.reader-markdown ul,
.reader-markdown ol {
  padding-left: 24px;
  margin: 10px 0;
}
.reader-markdown li { margin: 4px 0; }
.reader-markdown hr {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 20px 0;
}
.markdown-inline-img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 8px 0;
  display: inline-block;
  vertical-align: middle;
}

/* Chat navigation and thread optimizations */
.chat-participants-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
  border-radius: 8px;
  color: var(--ink);
}
.chat-participants-btn svg {
  width: 15px;
  height: 15px;
  opacity: 0.85;
}
.chat-content > .chat-workspace.single-thread {
  grid-template-columns: minmax(0, 1fr) !important;
}
.chat-workspace.single-thread > .chat-contacts {
  display: none !important;
}

/* Telegram-like compact & narrow chat mode */
.layout.chat-focused .chat-content {
  padding: 0 !important;
}
.layout.chat-focused .chat-workspace {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.layout.chat-focused .chat-thread {
  background: var(--canvas, #101410);
}
.layout.chat-focused .chat-stream {
  padding: 14px 16px;
  gap: 8px;
}

@media (max-width: 860px) {
  .layout.chat-focused .sidebar {
    display: none !important;
  }
  .layout.chat-focused .main {
    margin-left: 0 !important;
  }
  .chat-focused .topbar {
    padding: 0 12px !important;
    height: 52px !important;
    min-height: 52px !important;
  }
  .chat-focused .top-actions .connection {
    display: none !important;
  }
  .chat-focused .chat-stream {
    padding: 10px 8px !important;
    gap: 6px !important;
  }
  .chat-bubble,
  .chat-bubble.outgoing,
  .chat-bubble.incoming {
    max-width: 90% !important;
    padding: 9px 12px !important;
    border-radius: 14px !important;
  }
  .chat-bubble.outgoing {
    margin-inline-start: 10% !important;
    border-bottom-right-radius: 4px !important;
  }
  .chat-bubble.incoming {
    margin-inline-end: 10% !important;
    border-bottom-left-radius: 4px !important;
  }
  .chat-message-text {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }
  .chat-bubble-time {
    margin-top: 4px !important;
    font-size: 11px !important;
  }
  .chat-bubble.file-message {
    width: auto !important;
    max-width: min(340px, 90%) !important;
  }
  .chat-bubble:has(.link-preview-slot) {
    width: auto !important;
    max-width: min(360px, 90%) !important;
  }
  .link-preview-media {
    height: 130px !important;
  }
  .chat-composer {
    padding: 8px 10px !important;
  }
  .chat-compose-row {
    gap: 6px !important;
  }
  .chat-compose-row textarea {
    min-height: 42px !important;
    height: 42px;
    font-size: 15px !important;
    padding: 9px 12px !important;
    border-radius: 12px !important;
  }
  .chat-compose-row > .button,
  .chat-compose-icon.button {
    height: 42px !important;
    min-height: 42px !important;
    padding: 8px 12px !important;
  }

  /* Full-width edge-to-edge modal lightbox on mobile & compact windows */
  .modal-backdrop.link-reader-dialog-backdrop,
  .modal-backdrop.file-viewer-dialog-backdrop,
  .modal-backdrop.gallery-dialog-backdrop,
  .modal-backdrop:has(.link-reader-dialog),
  .modal-backdrop:has(.file-viewer-dialog),
  .modal-backdrop:has(.gallery-dialog) {
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.96) !important;
  }
  .modal.link-reader-dialog,
  .modal.file-viewer-dialog,
  .modal.gallery-dialog {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    padding: 0 !important;
    background: #070907 !important;
    box-shadow: none !important;
    z-index: 100 !important;
  }
  .link-reader-dialog .modal-header,
  .file-viewer-dialog .modal-header,
  .gallery-dialog .modal-header {
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 10px 0 14px !important;
    border-radius: 0 !important;
  }
  .link-reader-dialog .modal-header h2,
  .file-viewer-dialog .modal-header h2,
  .gallery-dialog .modal-header h2 {
    font-size: 14px !important;
  }
  .reader-actions,
  .file-viewer-actions {
    padding: 6px 10px !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    background: rgba(14, 18, 14, 0.98) !important;
  }
  .reader-actions::-webkit-scrollbar,
  .file-viewer-actions::-webkit-scrollbar {
    display: none !important;
  }
  .gallery-nav {
    font-size: 12px !important;
    gap: 4px !important;
  }
  .gallery-nav .button {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
  }
  .gallery-nav span {
    padding: 0 2px !important;
    font-size: 11px !important;
  }
  .reader-tools {
    gap: 6px !important;
    margin-inline-start: auto !important;
    flex: none !important;
    display: inline-flex !important;
    align-items: center !important;
  }
  .reader-tools .button span,
  .file-viewer-actions .button:not(.gallery-nav .button) span,
  .reader-zoom-actions .button span {
    display: none !important;
  }
  .reader-tools .button,
  .file-viewer-actions .button:not(.gallery-nav .button),
  .reader-zoom-actions .button {
    font-size: 0 !important;
    min-width: 34px !important;
    width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    flex: none !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  .reader-tools .button svg,
  .file-viewer-actions .button:not(.gallery-nav .button) svg,
  .reader-zoom-actions .button svg {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
  .reader-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100% !important;
  }
  .reader-media {
    width: 100% !important;
    height: 48dvh !important;
    max-height: 50dvh !important;
    min-height: 220px !important;
    flex: none !important;
  }
  .reader-media-stage {
    min-height: 0 !important;
    height: 100% !important;
  }
  .reader-expand {
    height: 100% !important;
  }
  .reader-expand img {
    max-height: 100% !important;
  }
  .reader-player-screen {
    min-height: 0 !important;
    height: 100% !important;
  }
  .reader-player-screen video {
    max-height: 100% !important;
  }
  .reader-details {
    padding: 14px 12px 36px !important;
    flex: 1 !important;
  }
  .file-viewer-dialog #file-viewer-body {
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 0 !important;
    background: transparent !important;
  }
  .file-viewer-dialog .file-viewer-image {
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
    padding: 12px !important;
  }
  .file-viewer-dialog .file-viewer-image img {
    max-width: 95% !important;
    max-height: 92% !important;
    filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.7)) !important;
  }
  .file-viewer-dialog .file-viewer-video {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
  }
}

/* Telegram-Style Floating Topbar & Fast Dropdown */
.topbar.topbar-chats-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  height: 56px;
  min-height: 56px;
  background: transparent;
}
.chat-top-left-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.chat-home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 24, 22, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--muted);
  cursor: pointer;
  transition: all 140ms ease;
  flex: none;
}
.chat-home-btn:hover {
  color: var(--ink);
  background: rgba(30, 36, 32, 0.9);
  border-color: var(--accent);
}
.chat-home-btn svg {
  width: 17px;
  height: 17px;
}
.chat-peer-anchor {
  position: relative;
  min-width: 0;
}
.chat-peer-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 24, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  cursor: pointer;
  max-width: min(320px, calc(100vw - 160px));
  transition: all 140ms ease;
}
.chat-peer-pill:hover,
.chat-peer-pill[aria-expanded="true"] {
  background: rgba(28, 34, 30, 0.95);
  border-color: var(--accent);
}
.chat-peer-pill-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex: none;
}
.chat-peer-pill-avatar svg {
  width: 16px;
  height: 16px;
}
.chat-peer-pill-status {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #0a0e0b;
}
.chat-peer-pill-status.online {
  background: var(--accent);
}
.chat-peer-pill-status.offline {
  background: #5a645d;
}
.chat-peer-pill-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
  line-height: 1.2;
}
.chat-peer-pill-title {
  font-size: 13.5px;
  font-weight: 650;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.chat-peer-pill-subtitle {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.chat-peer-pill-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: none;
  margin-left: 2px;
  transition: transform 160ms ease;
}
.chat-peer-pill[aria-expanded="true"] .chat-peer-pill-chevron {
  transform: rotate(180deg);
}
.chat-top-actions-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 24, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex: none;
}
.top-pill-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 120ms ease;
}
.top-pill-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}
.top-pill-btn svg {
  width: 17px;
  height: 17px;
}
.top-pill-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 1px;
}

/* Unified Topbar & Nav Pills */
.topbar {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  padding: 0 16px !important;
  min-height: 56px !important;
  height: auto !important;
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 20 !important;
}
.chat-top-main-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  width: 100% !important;
  min-height: 56px !important;
}
.top-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 24, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  box-sizing: border-box;
}
.top-nav-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
}
.top-nav-pill-icon svg { width: 17px; height: 17px; }
.top-nav-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  margin-left: -2px;
  transition: all 120ms ease;
}
.top-nav-back-btn:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.top-nav-back-btn svg { width: 16px; height: 16px; }
.top-nav-pill-title { font-size: 13.5px; font-weight: 650; color: #fff; white-space: nowrap; }
.top-nav-crumb-btn { background: transparent; border: none; color: var(--muted); font-size: 13px; padding: 0; cursor: pointer; }
.top-nav-crumb-btn:hover { color: #fff; }
.top-pill-subdivider { color: rgba(255, 255, 255, 0.2); font-size: 11px; }

.connection-status-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}
.connection-status-dot .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5a645d;
}
.connection-status-dot.online .dot {
  background: var(--accent);
}

/* Modern circular icon buttons and history actions */
.icon-button, .history-more {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  border-radius: 50% !important;
  border: 1px solid var(--line) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--muted) !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: all 120ms ease !important;
}
.icon-button:hover, .history-more:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}
.icon-button svg, .history-more svg {
  width: 16px !important;
  height: 16px !important;
}

/* Global Hidden Attribute Override */
[hidden] {
  display: none !important;
}

/* Chat Dropdown Menu */
.chat-peer-dropdown[hidden] {
  display: none !important;
}
.chat-peer-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 32px));
  max-height: min(420px, calc(100vh - 120px));
  background: rgba(18, 24, 20, 0.95);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: dropdownIn 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-search-wrap {
  position: relative;
  padding: 10px 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
}
.dropdown-search-wrap svg {
  position: absolute;
  left: 20px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.dropdown-search-wrap input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.dropdown-search-wrap input:focus {
  border-color: var(--accent);
}
.dropdown-items-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  max-height: 280px;
}
.dropdown-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px 4px;
}
.dropdown-peer-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 100ms ease;
  box-sizing: border-box;
}
.dropdown-peer-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.dropdown-peer-item.active {
  background: rgba(var(--accent-rgb, 140, 200, 100), 0.15);
  outline: 1px solid var(--accent);
}
.dropdown-peer-avatar {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.dropdown-peer-avatar svg {
  width: 15px;
  height: 15px;
}
.dropdown-peer-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.dropdown-peer-info strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown-peer-info small {
  font-size: 11px;
  color: var(--muted);
}
.dropdown-peer-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
}
.dropdown-footer {
  padding: 6px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}
.dropdown-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  border-radius: 8px;
  transition: background 100ms ease;
  box-sizing: border-box;
}
.dropdown-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.dropdown-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Chat Feed Search Bar */
.chat-feed-search-bar[hidden] {
  display: none !important;
}
.chat-feed-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 8px 12px 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 22, 19, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: searchSlideIn 150ms ease;
}
@keyframes searchSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-feed-search-bar .feed-search-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: none;
}
.chat-feed-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
}
.chat-feed-search-bar .feed-search-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chat-feed-search-bar .feed-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chat-feed-search-bar .feed-search-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}
.chat-feed-search-bar .feed-search-close svg {
  width: 14px;
  height: 14px;
}

/* Gallery Nav Pill & Controls */
.gallery-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
.gallery-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 120ms ease;
}
.gallery-nav-arrow:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}
.gallery-nav-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}
.gallery-nav-arrow svg {
  width: 15px;
  height: 15px;
}
.gallery-nav-count {
  font-size: 12.5px;
  color: #fff;
  padding: 0 6px;
  white-space: nowrap;
}
.gallery-nav-count small {
  color: var(--muted);
}
/* Media Floating Zoom & Fit Pill Architecture */
.reader-stage-zoom-pill,
.image-zoom-controls {
  position: absolute !important;
  bottom: 24px !important;
  right: 24px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  height: 38px !important;
  padding: 0 5px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: rgba(18, 24, 20, 0.88) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  z-index: 30 !important;
  box-sizing: border-box !important;
}
.reader-stage-zoom-pill .zoom-pill-btn,
.image-zoom-controls button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 28px !important;
  min-width: 34px !important;
  padding: 0 12px !important;
  border-radius: 999px !important;
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 120ms ease !important;
}
.reader-stage-zoom-pill .zoom-pill-btn:hover,
.image-zoom-controls button:hover:not(:disabled) {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.12) !important;
}
.reader-stage-zoom-pill .zoom-pill-btn.active,
.image-zoom-controls button[data-zoom="fit"].active {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
.image-zoom-controls button:disabled {
  opacity: 0.35 !important;
  cursor: default !important;
}

/* Chat-Inspired Frosted Glass Action Pills for Lightboxes & Viewers */
.reader-tools {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-inline-start: auto !important;
}
.button.glass,
.reader-tools .button,
.file-viewer-actions .button,
.reader-zoom-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(20, 24, 22, 0.75) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  color: #fff !important;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer !important;
  transition: all 120ms ease !important;
  box-sizing: border-box !important;
}

@media (max-width: 1060px) {
  .reader-tools .button span,
  .file-viewer-actions .button:not(.gallery-nav .button) span,
  .reader-zoom-actions .button span {
    display: none !important;
  }
  .reader-tools .button,
  .file-viewer-actions .button:not(.gallery-nav .button),
  .reader-zoom-actions .button {
    font-size: 0 !important;
    min-width: 34px !important;
    width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    flex: none !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  .reader-tools .button svg,
  .file-viewer-actions .button:not(.gallery-nav .button) svg,
  .reader-zoom-actions .button svg {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
}
.button.glass:hover,
.reader-tools .button:hover,
.file-viewer-actions .button:hover,
.reader-zoom-actions .button:hover {
  background: rgba(35, 42, 37, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}
.button.glass.share-accent,
.reader-tools .button.share-accent,
.file-viewer-actions .button.share-accent,
.reader-zoom-actions .button.share-accent {
  background: rgba(213, 255, 95, 0.15) !important;
  border-color: rgba(213, 255, 95, 0.4) !important;
  color: var(--accent) !important;
}
.button.glass.share-accent:hover,
.reader-tools .button.share-accent:hover,
.file-viewer-actions .button.share-accent:hover,
.reader-zoom-actions .button.share-accent:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #142000 !important;
}
.button.glass svg,
.reader-tools .button svg,
.file-viewer-actions .button svg,
.reader-zoom-actions .button svg {
  width: 15px !important;
  height: 15px !important;
}

/* Destination Card Architecture for Desktop */
.home-device .device-destination {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}
.home-device .destination-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  flex: none;
}
.home-device .destination-icon-wrap .channel-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.home-device .destination-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #141814;
}
.home-device .destination-dot.online { background: var(--accent); }
.home-device .destination-dot.offline { background: #647065; }
.home-device .destination-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.home-device .destination-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.home-device .destination-name {
  font-size: 17px;
  font-weight: 650;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-device .destination-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.home-device .destination-platform {
  font-size: 13px;
  color: var(--muted);
}
.home-device .destination-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 550;
}
.home-device .destination-hint svg {
  width: 14px;
  height: 14px;
}
.home-device .add-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(213, 255, 95, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-device .add-icon-wrap svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

/* Mobile Bottom Navigation Bar & Mobile Responsive Layout */
.mobile-nav-bar {
  display: none;
}

@media (max-width: 720px) {
  /* Hide sidebar on mobile width across all screens */
  .layout .sidebar {
    display: none !important;
  }
  .layout .main {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .layout:not(.chat-focused) .main {
    padding-bottom: 64px !important;
  }
  .layout:not(.chat-focused) .mobile-nav-bar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(14, 18, 15, 0.94);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 50;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    box-sizing: border-box;
  }
  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 550;
    cursor: pointer;
    position: relative;
    transition: color 120ms ease;
  }
  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
  }
  .mobile-nav-btn.active {
    color: var(--accent);
  }
  .mobile-nav-btn:hover {
    color: var(--ink);
  }
  .mobile-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  
  /* Content adjustments for mobile */
  .content {
    padding: 12px 12px 24px !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  /* Topbar on mobile */
  .topbar {
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 10px !important;
  }
  .top-nav-pill {
    height: 36px !important;
    padding: 0 10px 0 6px !important;
  }
  .top-nav-pill-title {
    font-size: 13px !important;
  }
  .top-nav-back-btn {
    width: 26px !important;
    height: 26px !important;
  }
  .chat-top-actions-pill {
    height: 36px !important;
    padding: 0 2px !important;
  }
  .top-pill-btn {
    width: 30px !important;
    height: 30px !important;
  }

  /* Compact Hero Banner in Home */
  .home-header-shell {
    margin-bottom: 10px !important;
  }
  .hero.home-header {
    min-height: auto !important;
    padding: 14px 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, rgba(213, 255, 95, 0.08) 0%, rgba(20, 26, 20, 0.95) 100%), var(--surface) !important;
    margin-bottom: 0 !important;
  }
  .home-header .hero-copy {
    max-width: 100% !important;
    flex: none !important;
  }
  .home-header .eyebrow {
    display: none !important;
  }
  .home-header h1 {
    font-size: 19px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.4px !important;
    margin: 0 0 4px !important;
  }
  .hero.home-header p {
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: var(--muted) !important;
    margin: 0 !important;
  }
  .home-header > .button {
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    font-size: 13.5px !important;
    font-weight: 650 !important;
    border-radius: 10px !important;
    justify-content: center !important;
    margin-top: 4px !important;
  }

  /* Compact Trust Summary Pill */
  .trust-summary {
    margin: 8px 0 12px !important;
    border-radius: 10px !important;
  }
  .trust-summary summary {
    padding: 7px 12px !important;
    min-height: 34px !important;
    font-size: 11.5px !important;
    gap: 6px !important;
  }
  .trust-summary summary svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Section Headings in Mobile */
  .home-section {
    margin-top: 16px !important;
  }
  .section-heading {
    margin: 14px 0 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .section-heading h2 {
    font-size: 15px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }
  .section-heading h2 small {
    font-size: 11px !important;
    color: var(--muted) !important;
    font-weight: 500 !important;
  }
  .section-heading .text-link {
    font-size: 12px !important;
    color: var(--accent) !important;
  }
  .section-note {
    font-size: 11px !important;
    line-height: 1.35 !important;
    margin: 4px 0 10px !important;
    color: var(--muted) !important;
  }

  /* High-density Mobile Device Grid */
  .home-device-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .home-device {
    min-height: 0 !important;
    height: auto !important;
    border-radius: 12px !important;
    background: rgba(22, 28, 23, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    overflow: hidden !important;
  }
  .home-device:hover {
    background: rgba(30, 38, 31, 0.95) !important;
  }
  .device-destination {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    min-height: 60px !important;
    width: 100% !important;
    text-align: left !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
  }
  .destination-icon-wrap {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    flex: none !important;
  }
  .destination-icon-wrap .channel-icon {
    width: 22px !important;
    height: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .destination-icon-wrap .channel-icon svg {
    width: 18px !important;
    height: 18px !important;
    color: var(--accent) !important;
  }
  .destination-dot {
    position: absolute !important;
    bottom: -1px !important;
    right: -1px !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    border: 1.5px solid #141814 !important;
  }
  .destination-dot.online {
    background: var(--accent) !important;
  }
  .destination-dot.offline {
    background: #647065 !important;
  }
  .destination-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }
  .destination-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .destination-name {
    font-size: 14px !important;
    font-weight: 650 !important;
    color: #fff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
  }
  .destination-status-badge {
    font-size: 10.5px !important;
    padding: 2px 6px !important;
    white-space: nowrap !important;
  }
  .destination-meta-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
    margin-top: 1px !important;
  }
  .destination-platform {
    font-size: 11.5px !important;
    color: var(--muted) !important;
  }
  .destination-hint {
    font-size: 11.5px !important;
    gap: 3px !important;
  }
  .destination-hint svg {
    width: 12px !important;
    height: 12px !important;
  }

  /* Add Device in Mobile */
  .home-device.add-device {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    min-height: 54px !important;
    width: 100% !important;
    border-style: dashed !important;
    border-color: rgba(213, 255, 95, 0.3) !important;
    background: rgba(213, 255, 95, 0.03) !important;
    cursor: pointer !important;
  }
  .home-device.add-device:hover {
    background: rgba(213, 255, 95, 0.08) !important;
    border-color: var(--accent) !important;
  }
  .home-device.add-device .add-icon-wrap {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(213, 255, 95, 0.08) !important;
    border: none !important;
  }
  .home-device.add-device .add-icon-wrap svg {
    width: 18px !important;
    height: 18px !important;
    color: var(--accent) !important;
  }
  .home-device.add-device .destination-name {
    font-size: 13.5px !important;
    color: var(--accent) !important;
  }
  .home-device.add-device .destination-platform {
    font-size: 11.5px !important;
  }
  .add-device-chevron {
    width: 16px !important;
    height: 16px !important;
    color: var(--muted) !important;
    margin-left: auto !important;
  }

  /* Page titles across views on mobile */
  .page-title {
    margin: 0 0 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .page-title .eyebrow {
    display: none !important;
  }
  .page-title h1 {
    font-size: 20px !important;
    line-height: 1.25 !important;
    margin: 0 0 2px !important;
  }
  .page-title p {
    font-size: 12.5px !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    color: var(--muted) !important;
  }
  .page-title .actions-row {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .page-title .actions-row .button {
    flex: 1 !important;
    min-height: 36px !important;
    font-size: 12.5px !important;
    justify-content: center !important;
  }

  /* Devices view (Mis equipos) */
  .connection-address-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 10px 12px !important;
    gap: 8px !important;
    border-radius: 12px !important;
  }
  .connection-address-bar .actions-row {
    width: 100% !important;
    display: flex !important;
    gap: 6px !important;
  }
  .connection-address-bar .actions-row .button {
    flex: 1 !important;
    min-height: 34px !important;
    font-size: 12px !important;
    padding: 0 8px !important;
    justify-content: center !important;
  }
  .device-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .device-card {
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }
  .device-card h3 {
    font-size: 15px !important;
    margin: 6px 0 2px !important;
  }
  .device-card p {
    font-size: 12px !important;
    margin-bottom: 10px !important;
    line-height: 1.35 !important;
  }
  .device-primary-actions {
    display: flex !important;
    gap: 8px !important;
  }
  .device-primary-actions .button {
    flex: 1 !important;
    min-height: 36px !important;
    font-size: 12.5px !important;
    padding: 0 8px !important;
    justify-content: center !important;
  }

  /* Sharing & Transfers view */
  .sharing-tabs {
    display: flex !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
  }
  .sharing-tabs .button {
    flex: 1 !important;
    min-height: 34px !important;
    font-size: 12px !important;
    padding: 0 6px !important;
    justify-content: center !important;
  }
  .share-row {
    padding: 10px 12px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }
  .share-row .share-info {
    flex: 1 1 calc(100% - 60px) !important;
  }
  .share-row .button {
    margin-left: auto !important;
    min-height: 32px !important;
    font-size: 11.5px !important;
    padding: 0 8px !important;
  }

  /* Activity view */
  .activity-row {
    padding: 10px 12px !important;
    gap: 8px !important;
  }
  .activity-row strong {
    font-size: 13px !important;
  }
  .activity-row p {
    font-size: 11.5px !important;
  }
  .activity-row time {
    font-size: 11px !important;
    margin-left: auto !important;
  }

  /* Settings & Security */
  .settings-panel, .settings-unified .settings-section {
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }
  .settings-panel h3 {
    font-size: 15px !important;
    margin-bottom: 6px !important;
  }
  .setting-row {
    padding: 8px 0 !important;
    font-size: 13px !important;
  }
  .detail-line {
    padding: 8px 0 !important;
    font-size: 12.5px !important;
  }
  .files-panel .file-row {
    padding: 8px 10px !important;
  }
}

/* ==========================================================================
   Micro-interactions & Action Feedback Animations (Copy, Success, Toast)
   ========================================================================== */

@keyframes button-action-pop {
  0% { transform: scale(1); }
  35% { transform: scale(0.94); }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes checkmark-pop {
  0% { transform: scale(0.4) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes toast-enter {
  0% { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.96); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes copy-glow-pulse {
  0% { box-shadow: 0 0 0 0 rgba(213, 255, 95, 0.5); }
  40% { box-shadow: 0 0 0 8px rgba(213, 255, 95, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(213, 255, 95, 0); }
}

.button:active,
.icon-button:active {
  transform: scale(0.96);
  transition: transform 0.08s ease;
}

.button.copied,
.button.is-copied {
  background: var(--accent, #d5ff5f) !important;
  color: #12180c !important;
  border-color: var(--accent, #d5ff5f) !important;
  box-shadow: 0 0 18px rgba(213, 255, 95, 0.45) !important;
  animation: button-action-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.button.copied svg,
.button.is-copied svg {
  animation: checkmark-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  stroke: #12180c !important;
}

#toast {
  position: fixed !important;
  bottom: 28px !important;
  left: 50% !important;
  transform: translateX(-50%) translateY(16px) scale(0.96) !important;
  background: rgba(22, 34, 18, 0.94) !important;
  color: #eaffce !important;
  border: 1px solid #5a7d3c !important;
  padding: 13px 22px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 550 !important;
  letter-spacing: -0.01em !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 20px rgba(90, 125, 60, 0.2) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  z-index: 99999 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#toast.visible {
  opacity: 1 !important;
  transform: translateX(-50%) translateY(0) scale(1) !important;
  animation: toast-enter 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

pre#mcp-config.pulse,
.copy-target-pulse {
  animation: copy-glow-pulse 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   MCP Multi-Client Switcher & Quickstart Widget
   ========================================================================== */

.mcp-quickstart-dialog {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.mcp-client-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  background: rgba(14, 18, 14, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  scrollbar-width: none;
}

.mcp-client-tabs::-webkit-scrollbar {
  display: none;
}

.mcp-client-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #9eb096);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.mcp-client-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink, #eaffce);
}

.mcp-client-tab.active {
  background: rgba(213, 255, 95, 0.12);
  color: var(--ink, #eaffce);
  border-color: rgba(213, 255, 95, 0.35);
  box-shadow: 0 0 12px rgba(213, 255, 95, 0.15);
}

.mcp-client-tab small {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted, #9eb096);
}

.mcp-client-tab.active small {
  background: rgba(213, 255, 95, 0.2);
  color: var(--accent, #d5ff5f);
}

.mcp-active-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(20, 28, 20, 0.7);
  border: 1px solid rgba(86, 125, 60, 0.35);
  border-left: 4px solid var(--accent, #d5ff5f);
  border-radius: 12px;
  padding: 16px 18px;
}

.mcp-active-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mcp-active-header p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted, #9eb096);
  line-height: 1.45;
}

.mcp-code-container {
  background: #090e0a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.mcp-code-container pre {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #d6f6ad;
  max-height: 170px;
  overflow: auto;
  user-select: all;
  white-space: pre-wrap;
  word-break: break-all;
}

.mcp-token-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(12, 16, 12, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 14px;
}

.mcp-token-strip-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mcp-token-strip-left strong {
  font-size: 12px;
  color: var(--ink, #eaffce);
}

.mcp-token-strip-left code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted, #9eb096);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

/* ==========================================================================
   MCP Server Master Switch & Status Artifact
   ========================================================================== */

/* MCP Server Panel — Estilo plano y sobrio (paridad web) */
.mcp-server-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface, #141913);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.mcp-server-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mcp-server-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #1c2617;
  color: var(--accent, #d5ff5f);
  border: 1px solid rgba(213, 255, 95, 0.2);
  flex-shrink: 0;
}

.mcp-server-icon.paused {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted, #859a7a);
  border-color: rgba(255, 255, 255, 0.08);
}

.mcp-server-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mcp-server-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mcp-server-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: #edf5e7;
  letter-spacing: -0.2px;
}

.mcp-status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.mcp-status-tag.online {
  background: #26351c;
  color: #d5ff5f;
  border: 1px solid rgba(213, 255, 95, 0.2);
}

.mcp-status-tag.paused {
  background: rgba(255, 255, 255, 0.06);
  color: #9eb096;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mcp-server-desc {
  margin: 0;
  font-size: 13.5px;
  color: #859a7a;
  line-height: 1.5;
}

.mcp-server-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Channel Invitations & Headlines */
.channel-invite-header-pill {
  appearance: none;
  background: #26351c;
  border: 1px solid rgba(213, 255, 95, 0.3);
  color: #d5ff5f;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  vertical-align: middle;
  transition: all 0.16s ease;
}

.channel-invite-header-pill:hover {
  background: #324625;
  border-color: rgba(213, 255, 95, 0.5);
  transform: translateY(-1px);
}

.channel-invite-header-pill svg {
  width: 14px;
  height: 14px;
}

.channel-invite-header-pill .invite-count {
  background: #d5ff5f;
  color: #15200d;
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10.5px;
  font-weight: 750;
}

.sidebar-invite-count {
  appearance: none;
  background: #26351c;
  border: 1px solid rgba(213, 255, 95, 0.3);
  color: #d5ff5f;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 6px;
}

.sidebar-invite-count:hover {
  background: #324625;
  border-color: rgba(213, 255, 95, 0.5);
}

.sidebar-invite-count svg {
  width: 12px;
  height: 12px;
}

.channel-invitations-block {
  margin-bottom: 24px;
  padding: 18px 20px;
  background: var(--surface, #141913);
  border: 1px solid rgba(213, 255, 95, 0.18);
  border-radius: 10px;
}

.channel-invitations-header {
  margin-bottom: 14px;
}

.channel-invitations-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-invitations-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: #edf5e7;
}

.invite-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d5ff5f;
}

.invite-header-icon svg {
  width: 18px;
  height: 18px;
}

.invite-header-badge {
  background: #26351c;
  color: #d5ff5f;
  border: 1px solid rgba(213, 255, 95, 0.25);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.channel-invitations-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: #859a7a;
}

/* Agents Cards & HITL */
.agent-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-card-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
  color: #edf5e7;
}

.agent-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 12px 14px;
}

.agent-detail-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #bac8b1;
}

.agent-detail-row strong {
  color: #859a7a;
  font-weight: 600;
  min-width: 68px;
  flex-shrink: 0;
}

.agent-detail-row span {
  overflow-wrap: anywhere;
}

.agent-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.button.danger {
  background: #331a17;
  color: #ff7d6b;
  border: 1px solid rgba(255, 125, 107, 0.25);
}

.button.danger:hover:not(:disabled) {
  background: #44221e;
  border-color: rgba(255, 125, 107, 0.45);
  color: #ff9485;
}

.button.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hitl-delete-container {
  padding: 4px 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #edf5e7;
}

.hitl-instruction {
  margin-top: 14px;
  background: #1c1413;
  border: 1px solid rgba(255, 125, 107, 0.3);
  border-radius: 8px;
  padding: 14px;
}

.hitl-instruction label {
  display: block;
  font-size: 13px;
  color: #ffb4a8;
  font-weight: 550;
  margin-bottom: 8px;
}

.hitl-instruction code {
  background: #2b1a18;
  color: #ff7d6b;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

#hitl-agent-name {
  width: 100%;
  box-sizing: border-box;
  background: #0f140f;
  border: 1px solid rgba(255, 125, 107, 0.4);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  color: #edf5e7;
  outline: none;
}

#hitl-agent-name:focus {
  border-color: #ff7d6b;
  box-shadow: 0 0 0 2px rgba(255, 125, 107, 0.25);
}

/* ==========================================================================
   MCP Server Master Switch & Status Artifact (Ref: Canonical Agents View)
   ========================================================================== */

.mcp-server-artifact {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: radial-gradient(100% 120% at 0% 0%, rgba(213, 255, 95, 0.08) 0%, rgba(18, 24, 18, 0.75) 100%);
  border: 1px solid rgba(213, 255, 95, 0.22);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mcp-server-artifact:hover {
  border-color: rgba(213, 255, 95, 0.35);
  box-shadow: 0 6px 24px rgba(213, 255, 95, 0.08), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.mcp-server-artifact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mcp-server-artifact-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mcp-server-artifact .mcp-server-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(213, 255, 95, 0.12);
  color: var(--accent, #d5ff5f);
  border: 1px solid rgba(213, 255, 95, 0.25);
  flex-shrink: 0;
}

.mcp-server-artifact .mcp-server-icon.paused {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted, #9eb096);
  border-color: rgba(255, 255, 255, 0.1);
}

.mcp-server-artifact .mcp-server-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mcp-server-artifact .mcp-server-title-row h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink, #eaffce);
  letter-spacing: -0.3px;
}

.mcp-server-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.mcp-server-status-pill.online {
  background: rgba(213, 255, 95, 0.15);
  color: var(--accent, #d5ff5f);
  border: 1px solid rgba(213, 255, 95, 0.35);
  box-shadow: 0 0 10px rgba(213, 255, 95, 0.2);
}

.mcp-server-status-pill.paused {
  background: rgba(255, 180, 50, 0.12);
  color: #ffb84d;
  border: 1px solid rgba(255, 180, 50, 0.3);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-dot-anim 1.8s infinite ease-in-out;
}

@keyframes pulse-dot-anim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.mcp-server-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted, #9eb096);
}

.mcp-server-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mcp-server-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: rgba(10, 14, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
}

.mcp-server-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mcp-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #859a7a);
  font-weight: 600;
}

.mcp-stat-value {
  font-size: 13px;
  color: var(--ink, #eaffce);
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-stat-value code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #d5ff5f;
}

.mcp-stat-value small {
  color: var(--muted, #9eb096);
  font-size: 12px;
  font-weight: 400;
}

/* ==========================================================================
   Responsive Polish: Desktop, Tablet & Mobile (Design System 2026)
   ========================================================================== */

/* 1. Global Compact Controls & Single-Baseline Section Headings */
.button.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13.5px;
  border-radius: 10px;
  gap: 6px;
}

.button.small svg {
  width: 16px;
  height: 16px;
}

.section-heading,
.home-section .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.section-heading h2 {
  min-width: 0;
  flex-wrap: wrap;
}

.section-heading > .button,
.section-heading > .text-link {
  flex-shrink: 0;
  white-space: nowrap;
}

/* 2. Home Device Cards & Add-Device Card (Desktop / Tablet Base) */
.home-device .device-destination {
  min-height: 142px;
  padding: 18px 20px;
  justify-content: space-between;
}

.home-device.add-device {
  min-height: 142px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  gap: 12px;
  border-style: dashed;
  border-color: rgba(213, 255, 95, 0.28);
  background: rgba(213, 255, 95, 0.025);
}

.home-device.add-device:hover {
  border-color: var(--accent);
  background: rgba(213, 255, 95, 0.06);
}

.home-device.add-device .destination-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  width: 100%;
  flex: 0 0 auto;
}

.home-device.add-device .destination-name {
  font-size: 16.5px;
  font-weight: 650;
  color: var(--accent);
  text-align: left;
}

.home-device.add-device .destination-platform {
  font-size: 13px;
  color: var(--muted);
  text-align: left !important;
}

.home-device.add-device .add-device-chevron {
  display: none;
}

/* 3. Files Panel & File Rows (Desktop Base) */
.file-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 186px;
  gap: 16px;
  padding: 11px 20px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--line);
}

.files-panel .file-row,
.file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 88px auto;
  gap: 16px;
  padding: 14px 20px;
  min-height: 76px;
  align-items: center;
}

.files-panel .file-row.selectable,
.file-row.selectable {
  grid-template-columns: 20px 42px minmax(0, 1fr) 88px auto;
}

.file-description {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.file-name {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}

.file-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.file-sub-size {
  display: none;
}

.file-delivery {
  display: flex;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
  margin-top: 4px;
}

.file-delivery .badge {
  flex-shrink: 0;
  font-size: 10.5px;
  padding: 2px 7px;
}

.file-delivery .delivery-meta {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.file-row .file-actions .file-share-btn {
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 999px;
  background: rgba(213, 255, 95, 0.12);
  color: var(--accent);
  border: 1px solid rgba(213, 255, 95, 0.28);
  font-weight: 600;
}

.file-row .file-actions .file-share-btn:hover {
  background: var(--accent);
  color: #121a0d;
  border-color: var(--accent);
}

/* 4. Tablet Refinements (721px - 1024px) & Mid Breakpoints */
@media (min-width: 721px) and (max-width: 1024px) {
  .content {
    padding: 24px 24px 28px !important;
  }
  .home-device-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 14px !important;
  }
  .device-grid,
  .channel-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 16px !important;
  }
  .settings-stack .settings-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .hero.home-header {
    padding: 20px 24px !important;
    min-height: 150px !important;
  }
  .mcp-server-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
  }
}

@media (max-width: 860px) {
  .file-table-head,
  .file-row .file-size {
    display: none !important;
  }
  .file-sub-size {
    display: inline !important;
  }
  .files-panel .file-row,
  .file-row {
    grid-template-columns: 40px minmax(0, 1fr) auto !important;
    gap: 12px !important;
    padding: 13px 16px !important;
    min-height: 68px !important;
  }
  .files-panel .file-row.selectable,
  .file-row.selectable {
    grid-template-columns: 18px 40px minmax(0, 1fr) auto !important;
  }
}

/* 5. Mobile Refinements (<= 720px) */
@media (max-width: 720px) {
  .section-heading,
  .home-section .section-heading {
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .section-heading h2 {
    font-size: 14.5px !important;
    gap: 5px !important;
  }
  .section-heading .button.small {
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }
  .section-heading .button.small svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Add-device card alignment in mobile list */
  .home-device.add-device {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    min-height: 58px !important;
    padding: 10px 12px !important;
    gap: 12px !important;
  }
  .home-device.add-device .destination-body {
    align-items: flex-start !important;
    text-align: left !important;
    flex: 1 !important;
  }
  .home-device.add-device span,
  .home-device.add-device .destination-platform {
    text-align: left !important;
  }
  .home-device.add-device .add-device-chevron {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
  }

  /* File rows on mobile: zero overlap, clean truncation, compact circular buttons */
  .files-panel .file-row,
  .file-row {
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    padding: 11px 12px !important;
    min-height: 64px !important;
  }
  .files-panel .file-row.selectable,
  .file-row.selectable {
    grid-template-columns: 18px 38px minmax(0, 1fr) auto !important;
  }
  .file-symbol {
    width: 38px !important;
    height: 42px !important;
    border-radius: 9px !important;
  }
  .file-symbol svg {
    width: 16px !important;
    height: 16px !important;
  }
  .file-symbol small {
    font-size: 9px !important;
  }
  .file-name {
    font-size: 13.5px !important;
  }
  .file-sub {
    font-size: 11.5px !important;
  }
  .file-delivery {
    gap: 6px !important;
    margin-top: 2px !important;
  }
  .file-delivery .badge {
    font-size: 9.5px !important;
    padding: 1.5px 5px !important;
  }
  .file-delivery .delivery-meta {
    font-size: 11px !important;
  }
  .file-actions {
    gap: 5px !important;
  }
  .file-row .file-actions .file-share-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
  }
  .file-row .file-actions .file-share-btn .share-btn-label {
    display: none !important;
  }
  .file-row .file-actions .file-share-btn svg {
    width: 15px !important;
    height: 15px !important;
    margin: 0 !important;
  }
  .file-actions .icon-button {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }

  /* Agents & MCP */
  .mcp-server-artifact {
    padding: 14px !important;
    gap: 12px !important;
    border-radius: 12px !important;
  }
  .mcp-server-artifact-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .mcp-server-controls {
    display: flex !important;
    width: 100% !important;
    gap: 8px !important;
  }
  .mcp-server-controls .button {
    flex: 1 !important;
    justify-content: center !important;
    min-height: 34px !important;
    font-size: 12px !important;
  }
  .mcp-server-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }

  /* Activity, Channel Library & Settings */
  .activity-tools {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .activity-periods {
    display: flex !important;
    width: 100% !important;
  }
  .activity-periods button {
    flex: 1 !important;
    min-height: 34px !important;
    font-size: 12px !important;
    padding: 0 8px !important;
  }
  .activity-search,
  .channel-library .toolbar .search,
  .settings-searchbar .search {
    max-width: none !important;
    width: 100% !important;
    min-height: 40px !important;
    flex: 1 !important;
  }
  .channel-library .toolbar {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }
  .preference-segments {
    display: flex !important;
    width: 100% !important;
  }
  .preference-segments button {
    flex: 1 !important;
    min-height: 34px !important;
    font-size: 12px !important;
    padding: 0 6px !important;
  }
  .coordination-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 12px 0 !important;
  }
  .channel-card {
    padding: 14px !important;
    min-height: 0 !important;
    border-radius: 12px !important;
    gap: 6px !important;
  }
  .channel-card .card-top {
    margin-bottom: 6px !important;
    align-items: center !important;
  }
  .channel-card .card-top .pill {
    font-size: 11.5px !important;
    padding: 3px 8px !important;
  }
  .channel-card h3 {
    font-size: 15px !important;
    margin: 0 !important;
  }
  .channel-card .channel-audience {
    font-size: 12.5px !important;
    margin: 0 !important;
  }
  .channel-card .card-meta {
    font-size: 12px !important;
    margin-top: 2px !important;
  }
  .activity-feed .activity-row > time {
    margin-left: 48px !important;
    flex-basis: 100% !important;
    font-size: 11.5px !important;
  }
  .incoming-request {
    padding: 12px !important;
    gap: 10px !important;
  }
}

/* ==========================================================================
   Chat Composer (Icon-Only Send, Paperclip Attach, Auto-Grow Multiline) & Peer Pill
   ========================================================================== */

.chat-peer-pill-info {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.chat-peer-pill-title,
.chat-peer-pill-subtitle {
  max-width: 100%;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-compose-row {
  display: grid !important;
  grid-template-columns: 44px minmax(0, 1fr) 44px !important;
  gap: 8px !important;
  align-items: end !important;
}

.chat-compose-row > .chat-compose-icon.button,
.chat-compose-row > .chat-send-icon.button {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border-radius: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: end !important;
  flex-shrink: 0 !important;
}

.chat-compose-row > .chat-compose-icon.button svg,
.chat-compose-row > .chat-send-icon.button svg {
  width: 19px !important;
  height: 19px !important;
  margin: 0 !important;
}

.chat-compose-row textarea {
  min-height: 44px !important;
  height: 44px;
  max-height: 136px !important;
  padding: 10px 14px !important;
  line-height: 22px !important;
  border-radius: 14px !important;
  resize: none !important;
  overflow-y: hidden;
  box-sizing: border-box !important;
}

@media (max-width: 860px) {
  .chat-compose-row {
    grid-template-columns: 42px minmax(0, 1fr) 42px !important;
    gap: 6px !important;
    align-items: end !important;
  }

  .chat-compose-row > .chat-compose-icon.button,
  .chat-compose-row > .chat-send-icon.button {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border-radius: 12px !important;
  }

  .chat-compose-row textarea {
    min-height: 42px !important;
    height: 42px;
    max-height: 130px !important;
    padding: 9px 12px !important;
    line-height: 21px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
  }
}

/* ==========================================================================
   Sidebar Channel Invite Pill, Full-Window Gallery/History & 1-Line Toolbar
   ========================================================================== */

.sidebar-label button.sidebar-invite-count {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  min-width: 20px !important;
  min-height: 20px !important;
  height: 20px !important;
  padding: 0 6px !important;
  margin-left: auto !important;
  margin-right: 6px !important;
  border-radius: 5px !important;
  background: #26351c !important;
  border: 1px solid rgba(213, 255, 95, 0.3) !important;
  color: #d5ff5f !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.sidebar-label button.sidebar-invite-count:hover {
  background: #324625 !important;
  border-color: rgba(213, 255, 95, 0.5) !important;
}

.modal-backdrop.gallery-dialog-backdrop,
.modal-backdrop.chat-history-dialog-backdrop,
.modal-backdrop:has(.gallery-dialog),
.modal-backdrop:has(.chat-history-dialog) {
  padding: 0 !important;
  background: rgba(10, 15, 12, 0.96) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
}

.modal.gallery-dialog,
.modal.chat-history-dialog {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background: var(--canvas, #0d120e) !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 100 !important;
}

.chat-history-dialog .modal-header,
.gallery-dialog .modal-header {
  flex: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 52px !important;
  min-height: 52px !important;
  padding: 0 24px !important;
  margin: 0 !important;
  background: rgba(14, 20, 15, 0.85) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.chat-history-dialog .modal-header h2,
.gallery-dialog .modal-header h2 {
  font-size: 16px !important;
  font-weight: 650 !important;
  color: #fff !important;
  margin: 0 !important;
}

.chat-history-dialog > p:not(:empty) {
  margin: 0 !important;
  padding: 6px 24px 10px !important;
  font-size: 12.5px !important;
  color: var(--muted) !important;
  background: rgba(14, 20, 15, 0.85) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.gallery-dialog #modal-form,
.chat-history-dialog #modal-form {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 1480px !important;
  margin: 0 auto !important;
  padding: 18px 24px 24px !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  overflow: hidden !important;
}

.gallery-query {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  margin: 0 !important;
}

.modal.gallery-dialog .gallery-search-wrap input[type="search"],
.modal.gallery-dialog .gallery-period-wrap select,
.gallery-search-wrap input[type="search"],
.gallery-period-wrap select {
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  box-sizing: border-box !important;
}

.gallery-toolbar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 10px 16px !important;
  width: 100% !important;
  padding: 0 0 4px !important;
  margin: 0 !important;
}

.gallery-filter-scroll {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 1 auto !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.gallery-meta-row {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 14px !important;
  width: auto !important;
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

.gallery-result-count {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 12.5px !important;
  line-height: 1 !important;
  color: var(--muted) !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}

.gallery-view-toggle {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
}

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)) !important;
  gap: 14px !important;
  padding: 4px 2px 16px !important;
}

@media (max-width: 720px) {
  .chat-history-dialog .modal-header,
  .gallery-dialog .modal-header {
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 12px 0 14px !important;
  }

  .chat-history-dialog > p:not(:empty) {
    padding: 6px 14px 8px !important;
  }

  .gallery-dialog #modal-form,
  .chat-history-dialog #modal-form {
    padding: 12px 14px 16px !important;
    gap: 10px !important;
  }

  .gallery-meta-row {
    width: 100% !important;
    justify-content: space-between !important;
    margin-left: 0 !important;
  }
}

/* ==========================================================================
   Vía P2P Identity URI (via://@nick#<pubkey>) & Device Detail Badges
   ========================================================================== */

.detail-val-action {
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.via-identity-pill {
  color: var(--accent, #d5ff5f);
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.via-uri-code {
  display: inline-block;
  max-width: min(360px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--accent, #d5ff5f);
  background: rgba(213, 255, 95, 0.08);
  border: 1px solid rgba(213, 255, 95, 0.22);
  border-radius: 6px;
  padding: 4px 8px;
  vertical-align: middle;
}

/* ==========================================================================
   Part 1 Fullscreen Viewer / Reader Layering & Safeguards
   ========================================================================== */

.modal.link-reader-dialog,
.modal.file-viewer-dialog,
.modal.gallery-dialog,
.modal.chat-history-dialog {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  box-sizing: border-box !important;
}

.file-viewer-dialog .modal-header,
.link-reader-dialog .modal-header,
.gallery-dialog .modal-header,
.chat-history-dialog .modal-header,
.file-viewer-actions,
.reader-actions {
  position: relative;
  z-index: 20;
}

/* ==========================================================================
   Part 2 Next-Gen Welcome Launchpad & Onboarding Wizard
   ========================================================================== */

.via-circle-chip {
  background: rgba(213, 255, 95, 0.08);
  border: 1px solid rgba(213, 255, 95, 0.22);
  color: #d5ff5f;
}

.onboarding-launchpad {
  margin: 16px 0 22px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(213, 255, 95, 0.24);
  background:
    radial-gradient(circle at top right, rgba(213, 255, 95, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(23, 29, 24, 0.96), rgba(16, 20, 16, 0.98));
  display: grid;
  gap: 16px;
}

.launchpad-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.launchpad-copy .eyebrow {
  display: block;
  margin-bottom: 4px;
}

.launchpad-copy h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.launchpad-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.launchpad-passport-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px 6px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 10, 0.65);
}

.launchpad-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.launchpad-step {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.launchpad-step:hover {
  border-color: rgba(213, 255, 95, 0.4);
  background: rgba(213, 255, 95, 0.06);
  transform: translateY(-1px);
}

.launchpad-step.done {
  border-color: rgba(213, 255, 95, 0.25);
  background: rgba(38, 53, 28, 0.35);
}

.launchpad-step-num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent, #d5ff5f);
  font-size: 13px;
  font-weight: 700;
}

.launchpad-step.done .launchpad-step-num {
  background: var(--accent, #d5ff5f);
  color: #101410;
}

.launchpad-step-num svg {
  width: 15px;
  height: 15px;
}

.launchpad-step > div {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.launchpad-step strong {
  font-size: 13.5px;
  font-weight: 650;
}

.launchpad-step small {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launchpad-step > svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: none;
}

.modal.onboarding-wizard-dialog {
  width: min(860px, calc(100vw - 24px));
  max-width: 860px;
  max-height: min(860px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
  overflow: hidden;
}

.modal.onboarding-wizard-dialog > #modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.onboarding-wizard-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 14px;
}

.onboarding-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: none;
}

.onboarding-step-tab {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 120ms ease;
}

.onboarding-step-tab:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.2);
}

.onboarding-step-tab.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.onboarding-wizard-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.onboarding-pane {
  display: grid;
  gap: 16px;
}

.passport-card {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 12px;
}

.passport-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.passport-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  display: grid;
  place-items: center;
  flex: none;
}

.passport-identity {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 140px;
}

.passport-identity strong {
  font-size: 17px;
  color: #fff;
}

.passport-stun-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.passport-stun-badge svg {
  width: 14px;
  height: 14px;
}

.passport-uri-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.passport-uri-row .via-uri-code {
  flex: 1;
  max-width: 100%;
}

.passport-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.passport-hint svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* ==========================================================================
   User Account & Profile Management in Settings
   ========================================================================== */

.user-account-card {
  padding: 20px 22px;
  border-radius: 18px;
  border: 1px solid rgba(213, 255, 95, 0.28);
  background:
    radial-gradient(circle at top right, rgba(213, 255, 95, 0.12), transparent 60%),
    rgba(19, 25, 20, 0.85);
  display: grid;
  gap: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.user-account-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.user-account-avatar {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #d5ff5f, #a0d836);
  color: #0f140f;
  font-weight: 800;
  font-size: 22px;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 4px 18px rgba(213, 255, 95, 0.25);
}

.user-account-avatar .peer-verified-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border: 2px solid #141a15;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.user-account-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
}

.user-account-name-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-account-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.user-account-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(213, 255, 95, 0.1);
  border: 1px solid rgba(213, 255, 95, 0.25);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.user-pill-nick {
  color: #d5ff5f;
  font-weight: 600;
}

.user-pill-tag {
  color: #94a3b8;
  font-size: 11px;
  margin-left: 2px;
}

.user-account-status {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-account-status svg {
  width: 14px;
  height: 14px;
  color: #d5ff5f;
}

.user-account-passport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  flex-wrap: wrap;
}

.user-account-uri-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.user-uri-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  font-weight: 600;
}

.user-account-passport .via-uri-code {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: #e2e8f0;
  background: transparent;
  border: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.user-account-uri-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.user-account-discovery-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: #94a3b8;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.user-account-discovery-note svg {
  width: 16px;
  height: 16px;
  color: #d5ff5f;
  flex: none;
  margin-top: 1px;
}

/* Sidebar user identity button */
.user-self-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: inherit;
  font: inherit;
}

.user-self-btn:hover {
  background: rgba(213, 255, 95, 0.08);
  border-color: rgba(213, 255, 95, 0.3);
}

.user-self-btn .self-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #d5ff5f;
  color: #101410;
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex: none;
}

.user-self-btn .self-verified-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #10b981;
  border: 2px solid #141a15;
}

.user-self-btn .self-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-self-btn .self-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-self-btn .self-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-self-btn svg:last-child {
  width: 14px;
  height: 14px;
  color: #94a3b8;
  flex: none;
  opacity: 0.7;
}

.user-self-btn:hover svg:last-child {
  color: #d5ff5f;
  opacity: 1;
}

.onboarding-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.onboarding-form-full {
  grid-column: 1 / -1;
}

.onboarding-biometry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.onboarding-biometry-copy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.onboarding-biometry-copy svg {
  width: 20px;
  height: 20px;
  color: #d5ff5f;
  flex: none;
}

.onboarding-biometry-copy strong {
  display: block;
  font-size: 14px;
}

.onboarding-biometry-copy small {
  color: var(--muted);
  font-size: 12.5px;
}

.onboarding-circle-bar {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.onboarding-sublabel {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.onboarding-circle-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.onboarding-circle-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}

.onboarding-circle-btn[aria-pressed="true"] {
  background: rgba(213, 255, 95, 0.16);
  border-color: #d5ff5f;
  color: #d5ff5f;
}

.onboarding-circle-rule {
  color: var(--muted);
  font-size: 12.5px;
}

.onboarding-network-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.onboarding-box {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 10px;
  align-content: start;
}

.onboarding-box h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.onboarding-peer-list {
  display: grid;
  gap: 8px;
}

.onboarding-peer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.onboarding-peer-row > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.onboarding-peer-row small {
  color: var(--muted);
  font-size: 12px;
}

.onboarding-radar-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}

.onboarding-radar-empty strong {
  display: block;
  font-size: 13.5px;
}

.onboarding-radar-empty small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.radar-pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d5ff5f;
  box-shadow: 0 0 0 0 rgba(213, 255, 95, 0.55);
  animation: via-radar-pulse 1.8s infinite;
  flex: none;
}

@keyframes via-radar-pulse {
  0% { box-shadow: 0 0 0 0 rgba(213, 255, 95, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(213, 255, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(213, 255, 95, 0); }
}

.onboarding-share-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.onboarding-qr-slot {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}

.onboarding-qr-slot img {
  display: block;
  width: 96px;
  height: 96px;
}

.onboarding-qr-loading {
  color: #101410;
  font-weight: 700;
  font-size: 13px;
}

.onboarding-share-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.onboarding-connect-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.onboarding-connect-row input {
  flex: 1;
  margin: 0;
}

.onboarding-circle-mini {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mini-circle-btn {
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}

.mini-circle-btn[aria-pressed="true"] {
  background: rgba(213, 255, 95, 0.14);
  border-color: rgba(213, 255, 95, 0.45);
  color: #d5ff5f;
  font-weight: 600;
}

.pair-code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 2px;
  color: #d5ff5f;
}

.onboarding-intro {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.onboarding-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.onboarding-template-card {
  display: grid;
  gap: 8px;
  align-content: start;
  text-align: left;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  transition: all 130ms ease;
}

.onboarding-template-card.selected:not(.exists) {
  border-color: #d5ff5f;
  background: rgba(38, 53, 28, 0.45);
}

.onboarding-template-card.exists {
  opacity: 0.65;
  cursor: default;
}

.template-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-icon {
  font-size: 22px;
}

.onboarding-template-card strong {
  font-size: 15px;
}

.onboarding-template-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex: none;
}

@media (max-width: 820px) {
  .launchpad-steps,
  .onboarding-network-grid,
  .onboarding-template-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .modal.onboarding-wizard-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 16px;
  }

  .onboarding-share-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .onboarding-connect-row {
    flex-direction: column;
    align-items: stretch;
  }

  .onboarding-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .onboarding-footer .button {
    width: 100%;
    justify-content: center;
  }
}

/* Unified Chat & Channel Filter Pills */
.chat-filter-pills {
  display: flex !important;
  gap: 4px !important;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  padding: 3px !important;
  margin: 10px 4px 14px !important;
}
.chat-filter-pill {
  flex: 1 !important;
  background: transparent !important;
  border: none !important;
  color: var(--muted) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  padding: 5px 8px !important;
  border-radius: 999px !important;
  cursor: pointer !important;
  text-align: center !important;
  transition: all 120ms ease !important;
}
.chat-filter-pill:hover {
  color: var(--ink) !important;
}
.chat-filter-pill.active {
  background: var(--surface-raised) !important;
  color: var(--accent) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}
.chat-avatar.channel-avatar {
  background: rgba(213, 255, 95, 0.08) !important;
  color: var(--accent) !important;
}
.chat-avatar.channel-avatar svg {
  width: 18px !important;
  height: 18px !important;
}
.bubble-device-pill {
  font-size: 11px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--muted) !important;
  padding: 1px 7px !important;
  border-radius: 4px !important;
  font-weight: 500 !important;
  margin-left: 6px !important;
}

/* ==========================================================================
   VÍA WEB AUTHENTICATION (Estilo WhatsApp Web: QR Dinámico + 2FA TOTP)
   ========================================================================== */
.web-login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
  background: var(--canvas, #0c0f0c);
  background-image: radial-gradient(ellipse at 50% 15%, rgba(213, 255, 95, 0.08) 0%, transparent 65%);
}

.web-login-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface, #141814);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 36px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
  animation: webAuthFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.web-login-card.onboarding-expanded {
  max-width: 620px;
  text-align: left;
}

@keyframes webAuthFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.web-login-brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.web-login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.web-login-sub {
  font-size: 13.5px;
  color: var(--muted, #859a7a);
  line-height: 1.5;
  margin: 0;
  max-width: 380px;
}

.onboarding-mode-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 4px;
  gap: 6px;
  margin-bottom: 2px;
}

.onboarding-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #859a7a);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.onboarding-mode-btn:hover {
  color: var(--ink, #edf5e7);
}

.onboarding-mode-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.web-login-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.web-login-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #859a7a);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap !important;
}

.web-login-tab-btn:hover {
  color: var(--ink, #edf5e7);
}

.web-login-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.web-login-qr-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.web-login-qr-box {
  width: 220px;
  height: 220px;
  background: #ffffff;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.web-login-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.web-login-qr-loading {
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 12, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #edf5e7;
  font-size: 13px;
  font-weight: 500;
}

.web-login-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted, #859a7a);
}

.web-login-code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 5px 14px;
  border-radius: 8px;
}

.web-login-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink, #edf5e7);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.web-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: webPulseAnimation 2s infinite ease-in-out;
}

@keyframes webPulseAnimation {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.web-login-steps {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--muted, #859a7a);
  line-height: 1.6;
}

.web-login-steps ol {
  margin: 0;
  padding-left: 18px;
}

.web-login-steps strong {
  color: var(--ink, #edf5e7);
}

.web-login-totp-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.web-login-totp-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  letter-spacing: 6px;
  text-align: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--accent, #d5ff5f);
  width: 100%;
  box-sizing: border-box;
}

.web-login-totp-input:focus {
  outline: none;
  border-color: var(--accent, #d5ff5f);
  box-shadow: 0 0 0 3px rgba(213, 255, 95, 0.15);
}

.web-login-remember {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted, #859a7a);
  cursor: pointer;
  user-select: none;
}

.web-login-remember input {
  accent-color: var(--accent, #d5ff5f);
  cursor: pointer;
}

.web-login-error-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  text-align: center;
}
