html.trwait body { opacity: 0; }
body { transition: opacity .15s ease; }
#splash { display: none; position: fixed; inset: 0; z-index: 10000; align-items: center; justify-content: center; background: var(--bg-page); transition: opacity .25s ease; }
html.booting #splash { display: flex; }
#splash.out { opacity: 0; pointer-events: none; }
#splash img { width: 64px; height: 64px; animation: splashPulse 1.4s ease-in-out infinite; }
@keyframes splashPulse { 0%, 100% { transform: scale(0.92); opacity: 0.55; } 50% { transform: scale(1.06); opacity: 1; } }
:root,
[data-theme="white"] {
  --bg-page: #f5f5f7;
  --bg-surface: rgba(255, 255, 255, 0.86);
  --bg-input: rgba(118, 118, 128, 0.08);
  --bg-bot: #f2f2f7;
  --bg-user: #007aff;
  --text-user: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
  --danger: #ff3b30;
  --success: #34c759;
}

[data-theme="black"] {
  --bg-page: #000000;
  --bg-surface: rgba(22, 22, 24, 0.86);
  --bg-input: rgba(255, 255, 255, 0.08);
  --bg-bot: #1c1c1e;
  --bg-user: #0a84ff;
  --text-user: #ffffff;
  --text-primary: #f5f5f7;
  --text-secondary: #8e8e93;
  --border: rgba(255, 255, 255, 0.11);
  --accent: #0a84ff;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.75);
  --danger: #ff453a;
  --success: #30d158;
}

[data-theme="sepia"] {
  --bg-page: #efe6d5;
  --bg-surface: rgba(248, 241, 227, 0.92);
  --bg-input: rgba(92, 70, 48, 0.08);
  --bg-bot: #eadec9;
  --bg-user: #7c4d25;
  --text-user: #fdfaf4;
  --text-primary: #2c2219;
  --text-secondary: #756352;
  --border: rgba(68, 50, 32, 0.12);
  --accent: #8c4f1e;
  --shadow: 0 24px 60px rgba(68, 50, 32, 0.12);
  --danger: #c0392b;
  --success: #3d7a47;
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg-page: #000000;
    --bg-surface: rgba(22, 22, 24, 0.86);
    --bg-input: rgba(255, 255, 255, 0.08);
    --bg-bot: #1c1c1e;
    --bg-user: #0a84ff;
    --text-user: #ffffff;
    --text-primary: #f5f5f7;
    --text-secondary: #8e8e93;
    --border: rgba(255, 255, 255, 0.11);
    --accent: #0a84ff;
    --shadow: 0 32px 80px rgba(0, 0, 0, 0.75);
    --danger: #ff453a;
    --success: #30d158;
  }
}

* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  min-height: 100dvh;
  background: var(--bg-page);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  transition: background 0.25s ease, color 0.25s ease;
}

.shell {
  width: 100%;
  min-width: 0;
  max-width: min(780px, 100%);
  box-sizing: border-box;
  overflow-x: hidden;
  height: min(90dvh, 840px);
  background: var(--bg-surface);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 0.5px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Ultra-clean Apple Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}

/* app installata sul computer: la barra in alto diventa la barra della finestra (si trascina da lì) */
@media (display-mode: window-controls-overlay) {
  .topbar { min-height: env(titlebar-area-height, 48px); padding-top: 0; padding-bottom: 0; padding-left: max(20px, env(titlebar-area-x, 0px)); padding-right: max(20px, calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw))); -webkit-app-region: drag; app-region: drag; }
  .topbar button, .topbar a, .topbar input, .topbar select, .topbar [role="button"] { -webkit-app-region: no-drag; app-region: no-drag; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover { background: rgba(128, 128, 128, 0.18); }

.icon-btn:active { transform: scale(0.92); }
.icon-btn.mic-on { background: var(--danger); color: #fff; animation: pulse 1.5s infinite; }
.icon-btn.cam-on { background: var(--accent); color: #fff; }
.icon-btn.muted { opacity: 0.45; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
}

/* Apple Sheet Impostazioni (position: fixed z-index: 9999 -> mai tagliato) */
.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.popover {
  width: 100%;
  max-width: 380px;
  max-height: calc(100dvh - max(36px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 24px));
  overflow-y: auto;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seg-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 10px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 2px;
  border-radius: 8px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.pop-select, .pop-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.hidden { display: none !important; }

/* Onboarding & OTP */
.center-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  padding: 24px 20px;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  gap: 18px;
  min-height: 0;
  overflow-y: auto;
  justify-content: safe center;
}
a:not([class]) { color: var(--accent); }

.seo-intro { max-width: 520px; margin: 28px auto 8px; font-size: 0.82rem; line-height: 1.55; color: var(--text-secondary); text-align: left; }
.seo-intro h2 { font-size: 0.95rem; color: var(--text-primary, inherit); margin: 0 0 6px; }
.seo-intro ul { padding-left: 18px; margin: 8px 0 0; }
html[lang="it"] .seo-en, html:not([lang="it"]) .seo-it { display: none; }
.hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}

.hero-sub {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.45;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.84rem; font-weight: 500; color: var(--text-secondary); }

input[type="text"], input[type="email"], input[type="number"] {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
}

.popover input { min-width: 0; font-size: 16px; }
#shareBackdrop, #usageBackdrop { align-items: flex-start; overflow-y: auto; padding: 16px 12px; }
input:focus {
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25);
}

.btn-primary {
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.btn-ghost {
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Conversation */
#inviteToast { position: fixed; z-index: 9000; right: 14px; bottom: 96px; display: flex; flex-direction: column; gap: 8px; max-width: min(340px, calc(100vw - 28px)); pointer-events: none; }
.invite-card { pointer-events: auto; background: var(--bg-page); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.28); font-size: .9rem; display: flex; flex-direction: column; gap: 10px; animation: icIn .25s ease-out; transition: opacity .45s ease, transform .45s ease; }
.invite-card.fading { opacity: 0; transform: translateY(8px); pointer-events: none; }
.invite-card .ic-row { display: flex; gap: 8px; align-items: center; }
.invite-card .btn-primary, .invite-card .btn-ghost { padding: 8px 14px; font-size: .85rem; flex-direction: row; }
@keyframes icIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lk-l { display:flex; flex-direction:column; gap:4px; font-size:.82rem; opacity:.95; }
.lk-l select { padding:11px 12px; border-radius:12px; border:0.5px solid var(--border); background:var(--bg-input); color:var(--text-primary); font-size:16px; }
.msg-author { display:flex; align-items:center; gap:6px; font-size:.78rem; margin-bottom:4px; opacity:.85; }
.msg-author small { opacity:.65; }
.avatar { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:var(--accent, #4f8cff); color:#fff; font-size:.75rem; font-weight:700; flex:none; }
.chat-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#chatKindTabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
#chatKindTabs::-webkit-scrollbar { display: none; }
#chatKindTabs .fl-chip { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }

.quota-nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  background: var(--bg-input);
  border-bottom: 0.5px solid var(--border);
  font-size: 0.84rem;
  gap: 10px;
}

.quota-cta {
  border: none;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.scroll-down-btn {
  width: 38px;
  height: 38px;
  margin: -52px auto 14px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 20;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.scroll-down-btn.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-down-btn.streaming { border-color: var(--accent, #2f6fe4); }

.msg {
  padding: 11px 16px;
  border-radius: 20px;
  max-width: 80%;
  line-height: 1.5;
  font-size: 0.97rem;
  animation: fadeUp 0.16s ease-out;
  word-break: break-word;
  position: relative;
}

.drop-hint { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); color: #fff; font-size: 1.3rem; font-weight: 600; border: 3px dashed rgba(255,255,255,0.8); pointer-events: none; }
.drop-hint.hidden { display: none; }
.app-link { color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px dashed currentColor; cursor: pointer; }
.app-link:hover { opacity: .8; }
.msg-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  gap: 6px;
}

.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; flex-shrink: 0; pointer-events: none; }
.mini-act .ic { width: 1.45em; height: 1.45em; }
.send-pill .ic { width: 1.35em; height: 1.35em; stroke-width: 2.2; }
.icon-btn .ic { width: 1.2em; height: 1.2em; }
.chat-item button .ic { width: 1.2em; height: 1.2em; }
.mini-act {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.7;
}
:where(button, a, select, input, textarea, summary, [role=button]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (pointer: coarse) { .mini-act { padding: 9px 12px; } .quick-chip { padding: 11px 15px; } }
.mini-act:focus-visible, .quick-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mini-act:hover { opacity: 1; background: rgba(128,128,128,0.14); }
.msg.user .mini-act { color: rgba(255,255,255,0.85); }
.msg.user.peer .mini-act { color: var(--text-secondary); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.msg.user {
  align-self: flex-end;
  background: var(--bg-user);
  color: var(--text-user);
  border-bottom-right-radius: 6px;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bg-bot);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

.typing-dots { display: inline-flex; gap: 5px; padding: 4px 2px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-secondary); opacity: 0.4;
  animation: dotPulse 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.35; } 40% { transform: scale(1.2); opacity: 1; } }

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 10px;
}

.quick-chip {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
}

.dm-bar { display: flex; align-items: center; gap: 8px; padding: 6px 20px 8px; font-size: 0.85rem; color: var(--text-secondary); }
.dm-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.has-unread { position: relative; }
.has-unread::after { content: ""; position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
#chatsBtn { position: relative; }
#chatsBtn.run-think::after, #chatsBtn.run-ready::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
#chatsBtn.run-think::after { animation: runPulse 1.8s ease-in-out infinite; }
.chat-run { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.chat-run.think { animation: runPulse 1.8s ease-in-out infinite; }
.chat-run.error { background: var(--danger, #c0392b); }
@keyframes runPulse { 0%, 100% { opacity: .3; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { #chatsBtn.run-think::after, .chat-run.think { animation: none; } }
.chat-type-ic, .chat-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.chat-type-ic {
  margin-right: 7px;
  opacity: 0.78;
}
.chat-type-ic .ic, .chat-type-badge .ic {
  width: 15px;
  height: 15px;
}
.chat-type-badge {
  margin-left: 2px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--bg-hover, rgba(128, 128, 128, 0.12));
  color: var(--text-primary);
  opacity: 0.85;
}
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }

.sources-bar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-decoration: none;
  max-width: 200px;
}

.source-chip img { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; }
.source-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-card {
  margin-top: 8px;
  border-radius: 14px;
  padding: 8px;
  background: rgba(128, 128, 128, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-card img, .file-card video { max-width: 100%; max-height: 240px; border-radius: 10px; object-fit: contain; }
.file-card iframe { width: 100%; height: 210px; border: none; border-radius: 10px; background: #fff; }
.file-card audio { width: 100%; }
.file-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; gap: 8px; }
.kbd-hint { float: right; margin-left: 14px; font-size: .72rem; opacity: .5; }
@media (hover: none) { .kbd-hint { display: none; } }
.dl-link { padding: 4px 10px; border-radius: 999px; background: var(--accent); color: #fff; text-decoration: none; font-size: 0.78rem; font-weight: 500; }

.embed-box { margin-top: 8px; border-radius: 14px; overflow: hidden; border: 0.5px solid var(--border); }
.emb-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; padding: 4px; }
.emb-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--border); }
.emb-cap { padding: 8px 10px 0; font-size: 12px; opacity: .75; }
.emb-site { padding: 8px 10px; font-size: 13px; }
.emb-site summary { cursor: pointer; }
.emb-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.emb-list a { color: inherit; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.agent-st { font-size: 12px; opacity: .7; margin-top: 6px; }
.tm-form summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.tm-l { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; opacity: .9; }
.tm-row { border: 0.5px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.tm-row small { opacity: .7; }
.tm-row .tm-b { display: flex; gap: 6px; flex-wrap: wrap; }
.tm-chip { display: inline-block; font-size: .7rem; padding: 1px 8px; border-radius: 99px; border: 0.5px solid var(--border); margin-left: 6px; opacity: .85; }
.fl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fl-chip { border: 0.5px solid var(--border); background: transparent; color: inherit; border-radius: 99px; padding: 4px 12px; font-size: .8rem; cursor: pointer; }
.fl-chip.on { background: var(--text, #111); color: var(--bg, #fff); }
.fl-row { display: flex; align-items: flex-start; gap: 10px; border: 0.5px solid var(--border); border-radius: 12px; padding: 10px; }
.fl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fl-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
@media (min-width: 600px) {
  .fl-row { align-items: center; }
  .fl-main { flex-direction: row; align-items: center; gap: 10px; }
  .fl-acts { flex-wrap: nowrap; flex-shrink: 0; }
}
.fl-spin { display: inline-block; width: 11px; height: 11px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: flspin .7s linear infinite; vertical-align: -1px; margin-right: 5px; }
@keyframes flspin { to { transform: rotate(360deg); } }
.fl-th { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--border); flex: none; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.fl-tx { flex: 1; min-width: 0; line-height: 1.25; }
.fl-tx b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.fl-tx small { opacity: .7; }
.embed-frame { width: 100%; aspect-ratio: 16 / 9; border: none; display: block; }
.embed-spotify { width: 100%; height: 152px; border: none; display: block; }
.chart-box { margin-top: 8px; padding: 10px; border-radius: 14px; background: rgba(128,128,128,0.06); }

.connector-row { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.connect-chip {
  padding: 7px 12px; border-radius: 10px; border: 0.5px solid var(--border);
  background: var(--bg-input); color: var(--text-primary); font-size: 0.83rem; font-weight: 500; cursor: pointer;
}
.connect-chip.connected { background: var(--success); color: #fff; border-color: transparent; }

.md-content p { margin: 0 0 8px; }
.md-content p:last-child { margin-bottom: 0; }
.md-content ul, .md-content ol { margin: 6px 0; padding-left: 18px; }
.md-content pre { background: rgba(128,128,128,0.12); padding: 10px; border-radius: 10px; overflow-x: auto; font-size: 0.84rem; }
.md-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }

.video-dock { padding: 0 20px 8px; display: flex; justify-content: flex-end; }
.video-dock video { width: 140px; height: 96px; object-fit: cover; border-radius: 16px; border: 0.5px solid var(--border); }

/* Minimal Apple iMessage-style Composer */
.composer {
  padding: 12px 16px 16px;
  border-top: 0.5px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer { align-items: flex-end; }
.composer textarea {
  flex: 1;
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 0.96rem;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  max-height: 180px;
  min-height: 44px;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
}
@media (max-width: 480px) {
  .topbar-actions { gap: 4px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; font-size: 0.95rem; }
  .brand span { font-size: 0.95rem; }
}
.mic-live { display: flex; align-items: center; gap: 10px; margin: 6px 16px 0; padding: 8px 12px; border-radius: 14px; background: var(--bg-input); font-size: .92rem; border: 1px solid transparent; }
.mic-live.final { border-color: var(--accent); }
.call-ov { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); background: radial-gradient(120% 90% at 50% 20%, #1c2a52 0%, #0d1322 70%); color: #fff; }
.call-ov.hidden { display: none; }
.call-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; transform: scaleX(-1); }
.call-top, .call-mid, .call-bar { position: relative; z-index: 1; }
.call-top { font-variant-numeric: tabular-nums; opacity: .8; }
.call-mid { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 560px; }
.call-logo { width: 112px; height: 112px; border-radius: 28px; box-shadow: 0 0 0 0 rgba(255,255,255,.25); }
.call-ov[data-st="listen"] .call-logo { animation: callPulse 1.6s ease-out infinite; }
.call-ov[data-st="talk"] .call-logo { animation: callPulse .9s ease-out infinite; }
@keyframes callPulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); } 100% { box-shadow: 0 0 0 36px rgba(255,255,255,0); } }
.call-name { font-size: 1.5rem; font-weight: 600; }
.call-state { opacity: .85; min-height: 1.4em; }
.call-cap { opacity: .9; font-size: 1.02rem; min-height: 3em; overflow-wrap: anywhere; }
.call-bar { display: flex; gap: 22px; align-items: center; }
.call-btn { width: 58px; height: 58px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; cursor: pointer; }
.call-btn svg { width: 26px; height: 26px; }
.call-btn.off { background: #fff; color: #0d1322; }
.call-btn.end { background: var(--danger, #e5484d); }
.call-btn.end svg { transform: rotate(135deg); }
.mic-live .ml-text { flex: 1; min-width: 0; cursor: text; overflow-wrap: anywhere; color: var(--text-secondary); }
.mic-live.final .ml-text { color: var(--text-primary); }
.mic-live .ml-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; animation: splashPulse 1.2s ease-in-out infinite; }
.att-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px 0; max-height: 168px; overflow-y: auto; }
.att-head { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--text-secondary); }
.att-head button { border: none; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 0.78rem; text-decoration: underline; }
.att-thumb { width: 44px; height: 44px; flex: none; border-radius: 9px; object-fit: cover; background: rgba(128,128,128,0.18); display: flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700; color: var(--text-secondary); overflow: hidden; }
.att-thumb img, .att-thumb video { width: 100%; height: 100%; object-fit: cover; }
.att-chip { max-width: 250px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 6px; }
.file-grid .file-card { margin: 0; }
.file-grid .file-card img { max-height: 90px; }
.att-chip {
  display: flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 8px 10px; border-radius: 14px;
  background: var(--bg-input); border: 0.5px solid var(--border);
  font-size: 0.82rem; color: var(--text-primary);
}
.att-chip .att-meta { display: flex; flex-direction: column; min-width: 0; }
.att-chip .att-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.att-chip .att-sub { color: var(--text-secondary); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.att-chip.uploading { opacity: 0.6; }
.att-chip button { border: none; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 0.95rem; }
.msg.error { border: 1px solid var(--danger); color: var(--danger); }
.chat-item { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; cursor: pointer; border-bottom: 0.5px solid rgba(128, 128, 128, 0.08); }
.chat-item:nth-child(even) { background: rgba(128, 128, 128, 0.04); }
.chat-item:hover { background: var(--bg-input); }
.chat-item.active { background: color-mix(in srgb, var(--accent) 14%, var(--bg-input)); }
.chat-item.unread .chat-title { font-weight: 600; }
.handoff-bar { display:flex; align-items:center; gap:8px; padding:7px 14px; margin:0 16px 6px; border-radius:12px; background:var(--bg-input); border:0.5px solid var(--border); font-size:.8rem; }
.handoff-bar.hidden { display:none; }
.handoff-txt { flex:1; min-width:0; }
.quota-pill { display:flex; align-items:center; gap:7px; padding:5px 12px; margin:0 16px 6px; border-radius:999px; background:var(--bg-input); border:0.5px solid var(--border); font-size:.77rem; }
.quota-pill.hidden { display:none; }
.qp-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; background:#f59e0b; }
.qp-dot.high { background:var(--danger, #e0443e); animation:micpulse 1.8s infinite; }
.pill-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1; background: var(--accent); color: #fff; }
.fl-chip.on .pill-badge { background: #fff; color: var(--accent); }
.chat-item .chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.chat-item button { border: none; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 0.9rem; opacity: 0.78; padding: 4px; border-radius: 8px; }
.chat-item button:hover { opacity: 1; background: rgba(128, 128, 128, 0.14); color: var(--text-primary); }
#chatList { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }

.send-pill {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* Modals */

.conn-card { margin-top:10px; padding:12px 14px; border:0.5px solid var(--border); border-radius:14px; background:var(--bg-input); font-size:14px; display:flex; flex-direction:column; gap:8px; }
.conn-card .conn-detail { opacity:.65; font-size:12.5px; }
.conn-card .conn-row { display:flex; gap:8px; flex-wrap:wrap; }
.conn-card input, .conn-form input, .conn-form select { padding:10px 12px; border-radius:10px; border:0.5px solid var(--border); background:var(--bg-input); color:var(--text-primary); font-size:14px; width:100%; box-sizing:border-box; }
.conn-list-item { display:flex; align-items:center; gap:8px; padding:10px 12px; border:0.5px solid var(--border); border-radius:12px; margin-top:8px; }
.conn-list-item .conn-name { flex:1; min-width:0; }
.conn-list-item .conn-name > div { overflow-wrap:anywhere; word-break:break-word; }
.conn-list-item button { flex-shrink:0; }
.conn-list-item .conn-name small { display:block; opacity:.6; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.conn-cat { display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:8px; margin-top:8px; min-height:84px; overflow-anchor:none; }
#connList { overflow-anchor:none; }
.conn-cat button { padding:12px 8px; border-radius:12px; border:0.5px solid var(--border); background:var(--bg-input); color:var(--text-primary); cursor:pointer; font-size:13.5px; text-align:center; }
.conn-cat button:hover { border-color:var(--accent, #888); }
.adm-block { border:0.5px solid var(--border); border-radius:12px; padding:10px 12px; margin-top:8px; }
.adm-block > summary { cursor:pointer; font-weight:600; font-size:.95rem; }
.topbar-actions { position: relative; }
.menu-pop { position:absolute; right:0; top:calc(100% + 8px); min-width:230px; max-width:calc(100vw - 24px); max-height:calc(100dvh - max(96px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 72px)); overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; background:var(--bg-surface, var(--bg-page)); border:0.5px solid var(--border); border-radius:14px; box-shadow:0 14px 36px rgba(0,0,0,.28); padding:6px 6px 10px; z-index:120; display:flex; flex-direction:column; }
.menu-pop.hidden { display:none; }
.menu-pop.menu-up { top:auto; bottom:calc(100% + 8px); left:0; right:auto; min-width:240px; max-height:calc(100dvh - max(110px, env(safe-area-inset-bottom) + 88px)); }
.menu-item { text-align:left; padding:12px 14px; border:0; background:transparent; color:var(--text-primary); font-size:15px; border-radius:10px; cursor:pointer; }
.menu-item { display:flex; align-items:center; gap:10px; }
.menu-item .ic { width:1.2em; height:1.2em; opacity:.8; }
.menu-item:hover { background:rgba(128,128,128,.16); }
.menu-item.hidden { display:none; }
.send-pill.mic-on { background:#e0443e; color:#fff; animation:micpulse 1.4s infinite; }
@keyframes micpulse { 0%,100% { box-shadow:0 0 0 0 rgba(224,68,62,.45);} 50% { box-shadow:0 0 0 8px rgba(224,68,62,0);} }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  z-index: 80;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop > .modal-card { margin: auto; }

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: calc(100dvh - max(28px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.modal-card > * { flex-shrink: 0; }
#viewerBody, #maList, #tplList { flex-shrink: 1; }
#tplCats { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
#tplCats::-webkit-scrollbar { display: none; }
#tplCats .fl-chip { flex: 0 0 auto; white-space: nowrap; }
.tpl-mini { border-radius: 10px; padding: 10px; border: 1px solid rgba(128,128,128,.16); display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.tpl-mini-nav { display: flex; justify-content: space-between; align-items: center; font-size: 9px; opacity: .75; }
.tpl-mini-hero { font-size: 11px; font-weight: 700; line-height: 1.2; }
.tpl-mini-btn { display: inline-block; width: fit-content; padding: 2px 8px; border-radius: 999px; font-size: 9px; font-weight: 600; }
.tpl-mini-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 2px; }
.tpl-mini-cols i { display: block; height: 14px; border-radius: 4px; opacity: .85; }

#plansModal .modal-card { max-width: 860px; }
.voice-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.voice-chip { border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); border-radius: 999px; padding: 5px 12px; font-size: .85rem; cursor: pointer; }
.voice-chip.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.voice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-height: 58vh; overflow: auto; padding-right: 2px; }
.voice-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-input); }
.voice-card.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.voice-card .vc-info { flex: 1; min-width: 0; }
.voice-card .vc-name { font-weight: 600; }
.voice-card .vc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: .78rem; opacity: .8; }
.voice-card .vc-tag { border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.tiers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.usage-sum { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--success); }
.dot.warn { background: #ffb300; } .dot.high { background: var(--danger); }
.urow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .86rem; align-items: baseline; }
.urow .bar { grid-column: 1 / -1; height: 10px; border-radius: 99px; background: var(--bg-input); overflow: hidden; }
.urow .bar i { display: block; height: 100%; border-radius: 99px; background: var(--success); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.urow.warn .bar i { background: #ffb300; } .urow.high .bar i { background: var(--danger); }
.urow .num { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ubox { background: var(--bg-input); border-radius: 14px; padding: 12px 14px; font-size: .86rem; line-height: 1.45; }
.ubox.warn { border: 1px solid #ffb300; } .ubox.high { border: 1px solid var(--danger); }
.usage-body { display: flex; flex-direction: column; gap: 14px; }
.usage-body .btn-primary, .usage-body .btn-ghost { width: 100%; }
.packs { display: flex; gap: 8px; flex-wrap: wrap; }
.packs .btn-ghost { flex: 1 1 140px; width: auto; }
.me-dot { position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg-surface); }
.upd-badge { position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; border-radius: 999px; background: var(--danger, #e0443e); color: #fff; font-size: 9px; font-weight: 800; font-style: normal; line-height: 14px; text-align: center; box-shadow: 0 0 0 2px var(--bg-surface); animation: micpulse 1.8s infinite; pointer-events: none; }
#settingsBtn { position: relative; }
.tier {
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tier.featured { border: 1.5px solid var(--accent); }
.tier-price { font-size: 1.45rem; font-weight: 700; }
.tier-list { margin: 0; padding-left: 16px; color: var(--text-secondary); font-size: 0.83rem; line-height: 1.5; flex: 1; }

/* schede dei piani: poche righe che contano in vista, il resto a un tocco */
.tier { position: relative; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tier:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.10); }
.tier.featured { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--bg-input)), var(--bg-input) 60%); }
.tier.current { border-color: var(--success); }
.tier-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tier-head strong { font-size: 1.02rem; }
.tier-chip { font-size: .7rem; font-weight: 600; letter-spacing: .02em; padding: 2px 9px; border-radius: 999px; background: var(--accent); color: #fff; }
.tier-chip.cur { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.tier-soon { font-size: .82rem; color: var(--text-secondary); padding: 6px 0; }
.tier-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .86rem; line-height: 1.35; }
.tier-keys li { display: flex; gap: 8px; align-items: flex-start; }
.tier-keys li::before { content: "✓"; color: var(--success); font-weight: 700; flex: none; }
.tier-more { font-size: .8rem; color: var(--text-secondary); flex: 1; }
.tier-more summary { cursor: pointer; padding: 4px 0; list-style: none; color: var(--accent); }
.tier-more summary::-webkit-details-marker { display: none; }
.tier-more ul { margin: 6px 0 0; padding-left: 16px; line-height: 1.5; }
.tier > .btn-primary, .tier > .btn-ghost { margin-top: auto; }
/* finestre: apertura morbida e caricamenti discreti */
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-backdrop:not(.hidden) { animation: fadeIn .16s ease-out; }
.modal-backdrop:not(.hidden) > .modal-card { animation: modalIn .2s ease-out; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel { border-radius: 12px; min-height: 52px; background: linear-gradient(90deg, var(--bg-input) 25%, color-mix(in srgb, var(--text-secondary) 14%, var(--bg-input)) 50%, var(--bg-input) 75%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; margin: 6px 0; }
/* I miei siti */
.gen-st { display: flex; align-items: center; gap: 9px; font-size: .88rem; color: var(--text-secondary); margin-top: 8px; animation: fadeUp .25s ease; }
.gen-ic { position: relative; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); animation: genSpin 1.1s cubic-bezier(.5,.15,.5,.85) infinite; }
.gen-ic::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, transparent); animation: genPulse 1.8s ease-in-out infinite; }
@keyframes genSpin { to { transform: rotate(360deg); } }
@keyframes genPulse { 0%, 100% { transform: scale(.55); opacity: .45; } 50% { transform: scale(1); opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .gen-ic { animation-duration: 3s; } .gen-ic::after { animation: none; } }
.run-ctl { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.run-ctl button { border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); border-radius: 999px; padding: 4px 12px; font-size: .8rem; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.run-ctl button:hover { border-color: var(--accent); }
.run-ctl .run-note { display: none; font-size: .8rem; color: var(--text-secondary); }
.run-ctl.paused .run-note { display: inline; }
.send-choice, .queue-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 14px 6px; max-width: 820px; margin: 0 auto; width: 100%; font-size: .88rem; }
.send-choice { animation: fadeUp .18s ease; }
.send-choice span { color: var(--text-secondary); }
.send-choice button, .queue-chip button { border-radius: 999px; padding: 5px 14px; font-size: .84rem; cursor: pointer; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); }
.send-choice button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.queue-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-radius: 999px; border: 1px dashed var(--border); color: var(--text-secondary); max-width: 100%; }
.queue-chip i { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.queue-chip button { padding: 2px 8px; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.site-link { color: var(--text-primary); font-weight: 600; font-size: .86rem; word-break: break-all; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.site-link:hover { text-decoration-color: currentColor; }
.site-thumb { position: relative; overflow: hidden; border-radius: 12px; border: 1px solid var(--border); background: #fff; cursor: pointer; width: 100%; max-width: 420px; }
.site-thumb iframe { position: absolute; top: 0; left: 0; width: 1000px; height: 620px; border: 0; transform-origin: 0 0; pointer-events: none; }
.site-chat { max-width: 440px; }
.site-more { font-size: .86rem; } .site-more summary { cursor: pointer; color: var(--text-secondary); padding: 2px 0; } .site-more[open] { display: flex; flex-direction: column; gap: 8px; }
.site-mode { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 0 14px 6px; max-width: 820px; margin: 0 auto; width: 100%; }
.site-mode-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--bg-input)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--text-primary); font-size: .88rem; font-weight: 600; animation: fadeUp .18s ease; }
.site-mode-chip button { border: 0; background: transparent; color: var(--text-secondary); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.site-mode-chip button:hover { background: color-mix(in srgb, var(--text-secondary) 20%, transparent); }
.site-card { border: 1px solid var(--border); border-radius: 16px; background: var(--bg-input); padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; transition: border-color .18s ease; }
.site-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.site-chip { font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--text-secondary) 16%, transparent); color: var(--text-secondary); }
.site-chip.on { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.site-chip.off { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.site-empty { text-align: center; padding: 22px 12px 8px; }
.site-empty .big { font-size: 2.2rem; line-height: 1; margin-bottom: 8px; }
.site-empty p { margin: 4px 0; color: var(--text-secondary); font-size: .9rem; }
.site-ideas { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
#sitesModal textarea, #sitesModal input, #sitesModal select { background: var(--bg-input); color: var(--text-primary, inherit); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: .92rem; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
#sitesModal textarea { resize: vertical; min-height: 76px; }
#sitesModal textarea:focus, #sitesModal input:focus, #sitesModal select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
#sitesModal textarea::placeholder, #sitesModal input::placeholder { color: var(--text-secondary); opacity: .8; }
#sitesStatus:empty { display: none; }
.site-frame-wrap { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.site-frame-bar { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: var(--bg-input); border-bottom: 1px solid var(--border); }
.site-frame-bar i { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--text-secondary) 40%, transparent); }
@media (max-width: 660px) {
  html, body { width: 100%; max-width: 100vw; overflow-x: hidden; padding: 0; }
  .shell { width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; border: none; }
  .center-stage { max-width: 100%; padding: 20px 16px; }
  .tiers-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; }
  .modal-card { padding: 18px 16px; border-radius: 20px; }
  .tier { padding: 14px; }
  .msg { max-width: 88%; }
}
.app-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text-primary);
  color: var(--bg-page);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.menu-sep { height: 0.5px; background: var(--border); margin: 4px 6px; }

/* ---- @Mention Autocomplete, Recipient Dock Bar & Quote/Broadcast UI ---- */
.mention-pop {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 8px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-surface, var(--bg-page));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 6px;
  z-index: 60;
  backdrop-filter: blur(16px);
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.12s ease;
}
.mention-item:hover, .mention-item.active {
  background: color-mix(in srgb, var(--accent, #6366f1) 14%, transparent);
}
.mention-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent, #6366f1);
  flex-shrink: 0;
}
.mention-av.is-group { background: #0ea5e9; }
.mention-av.is-email { background: #10b981; }
.mention-av.is-ai { background: linear-gradient(135deg, #6366f1, #ec4899); }
.mention-meta { flex: 1; min-width: 0; }
.mention-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-sub { font-size: 0.76rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-tag {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.rcpt-dock {
  max-width: 820px;
  width: 100%;
  margin: 0 auto 6px;
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 35%, var(--border));
  background: color-mix(in srgb, var(--accent, #6366f1) 7%, var(--bg-surface, var(--bg-page)));
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rcptSlide 0.16s ease-out;
}
@keyframes rcptSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.rcpt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.rcpt-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.rcpt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 200px;
}
.rcpt-chip-av {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent, #6366f1);
  flex-shrink: 0;
}
.rcpt-chip-av.is-group { background: #0ea5e9; }
.rcpt-chip-av.is-email { background: #10b981; }
.rcpt-chip-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcpt-chip-x {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.85rem;
  line-height: 1;
}
.rcpt-chip-x:hover { color: var(--danger, #ef4444); }
.rcpt-more-btn {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
}
.rcpt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
}
.rcpt-mode-seg {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  padding: 2px;
  gap: 2px;
}
.rcpt-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
}
.rcpt-mode-btn .ic, .quote-dock-title .ic, .sel-share-pop .ic, .delivery-head .ic, .delivery-link .ic, .send-pill.is-broadcast .ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.mention-av .ic { width: 15px; height: 15px; }
.quote-dock-title { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 0.76rem; color: var(--accent, #6366f1); margin-bottom: 2px; }
.delivery-head > span, .delivery-link { display: inline-flex; align-items: center; gap: 5px; }
.rcpt-mode-btn.active {
  background: var(--accent, #6366f1);
  color: #fff;
}
.rcpt-group-title {
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  width: 170px;
}
.rcpt-actions { display: flex; align-items: center; gap: 6px; }
.rcpt-act-btn {
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}
.rcpt-act-btn:hover { border-color: var(--accent, #6366f1); }

.quote-dock {
  max-width: 820px;
  width: 100%;
  margin: 0 auto 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, #6366f1);
  background: var(--bg-surface, var(--bg-page));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
}
.quote-dock-body { flex: 1; min-width: 0; }
.quote-dock-title { font-weight: 600; font-size: 0.76rem; color: var(--accent, #6366f1); margin-bottom: 2px; }
.quote-dock-text {
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.sel-share-pop {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--text-primary);
  color: var(--bg-page);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -100%);
}
.sel-share-pop button {
  border: none;
  background: transparent;
  color: inherit;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sel-share-pop button:hover { background: rgba(255, 255, 255, 0.16); }

.multi-sel-bar {
  max-width: 820px;
  width: 100%;
  margin: 0 auto 6px;
  padding: 6px 10px 6px 14px;
  border-radius: 14px;
  background: var(--bg-surface, var(--bg-page));
  border: 1px solid var(--accent, #6366f1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 500;
}
.multi-sel-bar #multiSelCount {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.multi-sel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.multi-sel-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .1s, color .15s;
}
.multi-sel-btn:hover {
  background: var(--bg-hover, rgba(128, 128, 128, 0.14));
}
.multi-sel-btn:active {
  transform: scale(0.94);
}
.multi-sel-btn.primary {
  background: var(--accent, #6366f1);
  color: #fff;
}
.multi-sel-btn.primary:hover {
  filter: brightness(1.08);
  background: var(--accent, #6366f1);
}
.multi-sel-btn .ic {
  width: 17px;
  height: 17px;
}
.msg.multi-selected {
  outline: 2px solid var(--accent, #6366f1);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--accent, #6366f1) 10%, transparent);
}

.delivery-card {
  max-width: 520px;
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-surface, var(--bg-page));
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.delivery-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; }
.delivery-bar { height: 3px; border-radius: 999px; background: var(--border); overflow: hidden; }
.delivery-bar > i { display: block; height: 100%; background: var(--accent, #6366f1); transition: width 0.25s linear; }
.delivery-links { display: flex; gap: 6px; flex-wrap: wrap; }
.delivery-link {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
  cursor: pointer;
}
.delivery-link:hover { border-color: var(--accent, #6366f1); }

.send-pill.is-broadcast {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #fff !important;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  position: relative;
  flex-shrink: 0;
}
.send-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--text-primary);
  color: var(--bg-page);
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-page);
  line-height: 1;
}

.rcpt-dock, .quote-dock, .multi-sel-bar { position: relative; z-index: 25; }

.msg.user.peer {
  align-self: flex-start;
  background: var(--bg-bot, var(--bg-surface));
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.msg-quote {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border-left: 3px solid rgba(255, 255, 255, 0.65);
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.86rem;
  line-height: 1.42;
  white-space: pre-wrap;
}
.msg.user.peer .msg-quote, .msg.bot .msg-quote {
  border-left-color: var(--accent, #6366f1);
  background: color-mix(in srgb, var(--accent, #6366f1) 8%, transparent);
}
.msg-quote-author {
  font-size: 0.76rem;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 2px;
}
.msg-quote-text { opacity: 0.95; }

/* ---- Avatar foto + iniziali colorate & Context-Guard ---- */
.av-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
#profileInitial {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 700;
  font-size: 0.85rem;
}
.ctx-fix-bar {
  max-width: 820px;
  width: 100%;
  margin: 0 auto 6px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 42%, var(--border));
  background: color-mix(in srgb, var(--accent, #6366f1) 9%, var(--bg-surface, var(--bg-page)));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  animation: rcptSlide 0.16s ease-out;
}
.ctx-fix-bar:hover {
  background: color-mix(in srgb, var(--accent, #6366f1) 14%, var(--bg-surface, var(--bg-page)));
}
.ctx-fix-bar:active { transform: scale(0.99); }
.ctx-fix-bar.is-applied {
  border-color: color-mix(in srgb, var(--success, #10b981) 50%, var(--border));
  background: color-mix(in srgb, var(--success, #10b981) 10%, var(--bg-surface, var(--bg-page)));
}
.ctx-fix-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.ctx-fix-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent, #6366f1);
}
.ctx-fix-bar.is-applied .ctx-fix-label { color: var(--success, #10b981); }
.ctx-fix-label .ic { width: 13px; height: 13px; flex-shrink: 0; }
.ctx-fix-preview {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Live In-App Notification Banner & Unread Badge ---- */
.live-notif {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  max-width: 440px;
  width: calc(100% - 24px);
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 40%, var(--border));
  background: var(--bg-surface, var(--bg-page));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: rcptSlide 0.18s ease-out;
}
.live-notif-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
}
.live-notif-body { flex: 1; min-width: 0; }
.live-notif-title { font-size: 0.84rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-notif-txt { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chats-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

@media (max-width: 640px) {
  .rcpt-dock { padding: 6px 10px; gap: 6px; margin-bottom: 4px; }
  .rcpt-mode-btn, .rcpt-act-btn { padding: 3px 8px; font-size: 0.72rem; }
  .quote-dock { padding: 6px 10px; margin-bottom: 4px; }
  .quote-dock-text { -webkit-line-clamp: 1; }
}

/* ---- Sistema unificato Big-Platform per select, input, textarea e selettori data/ora ---- */
:root { color-scheme: light dark; }
[data-theme="black"] { color-scheme: dark; }
[data-theme="white"], [data-theme="sepia"] { color-scheme: light; }
button { color: inherit; }

select,
.pop-select,
.lk-l select,
.conn-form select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
  padding: 9px 34px 9px 12px;
  cursor: pointer;
  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='%238892a4' 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: 15px 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
select:hover, .pop-select:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not(.auth-input):not(.rcpt-group-title),
textarea:not(#textInput) {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.72;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

select:focus,
.pop-select:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not(#textInput):focus,
textarea:not(#textInput):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}

.readonly-banner {
  margin: 0 auto 8px;
  max-width: 780px;
  width: calc(100% - 24px);
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--surface-2, rgba(128,128,128,.12));
  border: 1px solid var(--border);
  font-size: .86rem;
  color: var(--text-secondary);
  text-align: center;
}

.fl-act {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fl-th.selectable {
  cursor: pointer;
  position: relative;
  transition: box-shadow .15s ease, transform .15s ease;
}
.fl-row.selected {
  background: rgba(59, 130, 246, .08);
  border-radius: 10px;
}
.fl-row.selected .fl-th {
  box-shadow: 0 0 0 2px var(--accent, #2563eb);
}

.pin-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 780px;
  width: calc(100% - 24px);
  margin: 6px auto 0;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface-2, rgba(128,128,128,.1));
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: .84rem;
}
.pin-ic { display: inline-flex; color: var(--accent, #2563eb); flex-shrink: 0; }
.pin-ic .ic { width: 15px; height: 15px; }
.pin-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }

.rx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
@keyframes rxPop {
  0% { transform: scale(.75); }
  55% { transform: scale(1.18) rotate(-4deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes rxPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.rx-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: .8rem;
  cursor: pointer;
  animation: rxPop .28s ease-out;
  transition: border-color .15s, background .15s;
}
.rx-pill:hover .rx-em { display: inline-block; animation: rxPulse .45s ease-in-out; }
.rx-pill.me {
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, .14);
}
.rx-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 60;
  display: flex;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.rx-pop button {
  background: none;
  border: 0;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 8px;
  transition: transform .15s ease;
}
.rx-pop button:hover { transform: scale(1.28) translateY(-2px); }

.msg-more-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 185px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 14px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.msg-more-pop button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: .84rem;
  cursor: pointer;
}
.msg-more-pop button:hover { background: var(--surface-2, rgba(128,128,128,.12)); }
.msg.pin-flash { outline: 2px solid var(--accent, #2563eb); outline-offset: 3px; border-radius: 14px; }
.msg:has(.rx-pop, .msg-more-pop) { position: relative; z-index: 50; }
.rx-who-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-secondary);
  cursor: pointer;
}
.rx-who-btn .ic { width: 13px; height: 13px; }
.rx-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
}
.rx-user-row.is-me { cursor: pointer; }
.rx-user-row.is-me:hover { background: var(--bg-input); }

/* ---- Unified Account Hub & Centered Branded Loader ---- */
.acc-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: 10px;
  border-radius: 14px;
  background: var(--bg-input);
  border: 0.5px solid var(--border);
}
.acc-avatar-btn {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}
.acc-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  background: var(--accent);
  overflow: hidden;
}
.acc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acc-avatar-cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface, var(--bg-page));
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}
.acc-avatar-cam .ic { width: 12px; height: 12px; }
.acc-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.acc-act-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.acc-act-btn:hover { border-color: var(--accent); }
.acc-act-btn .ic { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.82; }
.acc-act-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-act-wide { grid-column: 1 / -1; }

.list-box-lg {
  min-height: min(56dvh, 460px);
  display: flex;
  flex-direction: column;
}
.list-box-md {
  min-height: min(36dvh, 300px);
  display: flex;
  flex-direction: column;
}
.roby-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  min-height: inherit;
  padding: 28px 12px;
  grid-column: 1 / -1;
}
.roby-loader img {
  width: 42px;
  height: 42px;
  animation: splashPulse 1.4s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}

/* ---- Pro Gallery & Unified Drive ---- */
.fl-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fl-seg {
  display: inline-flex;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-input);
}
.fl-seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 5px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  opacity: 0.62;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.fl-seg-btn.on {
  background: var(--accent);
  color: #fff;
  opacity: 1;
}
.fl-seg-btn .ic { width: 15px; height: 15px; }
.fl-zoom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  font-size: 0.78rem;
}
.fl-zoom-wrap input[type="range"] {
  width: 68px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.fl-zoom-ico { opacity: 0.65; user-select: none; line-height: 1; }
.fl-group-sel {
  border: 0.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 5px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}
.fl-bread {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  padding: 2px 2px 4px;
}
.fl-bread button {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}
.fl-bread button:hover { background: var(--bg-input); }
.fl-folders-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}
.fl-folder-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 11px;
  border: 0.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.82rem;
  transition: border-color 0.14s ease, transform 0.14s ease;
}
.fl-folder-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.fl-folder-card .fl-fc-cnt { opacity: 0.65; font-size: 0.75rem; }
.fl-folder-card .fl-fc-act {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 1px 3px;
  font-size: 0.78rem;
  opacity: 0.65;
}
.fl-folder-card .fl-fc-act:hover { opacity: 1; color: var(--text-primary); }

.fl-stage {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 4px;
}
.fl-scroll {
  flex: 1;
  min-height: min(50dvh, 440px);
  max-height: 58dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  gap: 10px;
}
.fl-date-sec { display: flex; flex-direction: column; gap: 6px; }
.fl-date-hdr {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--bg-page);
  border-bottom: 0.5px solid var(--border);
}
.fl-date-sel {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.fl-date-sel:hover { background: var(--bg-input); }

.fl-grid-wrap {
  display: grid;
  grid-template-columns: repeat(var(--fl-cols, 4), minmax(0, 1fr));
  gap: 8px;
  transition: all 0.22s ease;
}
.fl-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.fl-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.fl-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 32%, transparent); }
.fl-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: color-mix(in srgb, var(--bg-page) 70%, var(--border));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1.8rem;
}
.fl-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.24s ease;
}
.fl-card:hover .fl-card-thumb img { transform: scale(1.04); }
.fl-card-chk {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.14s ease, background 0.14s ease;
  z-index: 2;
}
.fl-card:hover .fl-card-chk,
.fl-card.selected .fl-card-chk,
.fl-has-sel .fl-card-chk { opacity: 1; }
.fl-card.selected .fl-card-chk { background: var(--accent); border-color: var(--accent); }
.fl-card-info-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 2;
}
.fl-card:hover .fl-card-info-btn { opacity: 1; }
.fl-card-meta {
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fl-card-name {
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fl-card-sub {
  font-size: 0.67rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fl-badge-ai {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(22, 163, 74, 0.88);
  color: #fff;
}

.fl-scrubber {
  width: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  position: relative;
  flex-shrink: 0;
}
.fl-scrub-tick {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
  transition: transform 0.12s ease, background 0.12s ease;
}
.fl-scrub-tick.active { background: var(--accent); transform: scale(1.6); }
.fl-scrub-tip {
  position: absolute;
  right: 24px;
  transform: translateY(-50%);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 6;
}

.fl-pick-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-surface, var(--bg-page));
  border: 1px solid var(--border);
  z-index: 4;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
}
.fl-pick-acts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fl-pb-btn { padding: 4px 9px; font-size: 0.78rem; border-radius: 8px; }

.fl-submodal {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.fl-subcard {
  width: 100%;
  max-width: 420px;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}
.fl-card-info-inline {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  padding: 2px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.75;
}
.fl-card-info-inline:hover { opacity: 1; color: var(--accent); background: var(--bg-input); }
.fl-card-info-inline .ic { width: 14px; height: 14px; }
.fl-card-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.fl-thumb-vid { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.fl-play-badge {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.fl-play-badge .ic { width: 14px; height: 14px; }
.fl-wave-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  color: var(--accent);
}
.fl-wave-svg { width: 84%; height: 34px; display: block; }
.fl-site-frame {
  width: 300%;
  height: 300%;
  border: 0;
  transform: scale(0.3333);
  transform-origin: top left;
  pointer-events: none;
  background: #fff;
}
.fl-type-ico { color: var(--accent); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fl-type-ico .ic { width: 28px; height: 28px; }
.fl-type-ext {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-page);
  border: 0.5px solid var(--border);
  color: var(--text-secondary);
}
@media (max-width: 600px) {
  .fl-toolbar #flQ { flex: 1 1 100%; }
  .fl-zoom-wrap input[type="range"] { width: 52px; }
}

/* Quote sempre visibili: una riga discreta sotto la casella e un pannello compatto al tocco */
.quota-line { position:relative; z-index:2; align-self:flex-start; display:flex; align-items:center; gap:6px; margin:-10px 16px 6px; padding:2px 6px; background:none; border:0; color:var(--text-secondary); font-size:.72rem; line-height:1.3; cursor:pointer; text-align:left; max-width:calc(100% - 32px); border-radius:8px; }
.quota-line:hover, .quota-line:focus-visible { color:var(--text-primary); background:var(--bg-input); outline:none; }
.quota-line.hidden, .quota-sheet.hidden { display:none; }
.quota-line .ql-txt { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.ql-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; display:inline-block; background:var(--success); }
.quota-sheet { position:fixed; left:16px; bottom:96px; width:min(380px, calc(100vw - 32px)); max-height:min(62vh, 520px); overflow:auto; overscroll-behavior:contain; z-index:130; background:var(--bg-page); color:var(--text-primary); border:0.5px solid var(--border); border-radius:16px; box-shadow:0 12px 40px rgba(0,0,0,.18); padding:12px 14px; }
.qs-head { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; margin-bottom:6px; }
.qs-sub { font-size:.74rem; color:var(--text-secondary); margin-top:2px; }
.qs-row { padding:7px 0; border-top:0.5px solid var(--border); }
.qs-top { display:flex; align-items:center; gap:7px; font-size:.82rem; }
.qs-name { flex:1; min-width:0; }
.qs-val { font-variant-numeric:tabular-nums; color:var(--text-primary); font-size:.8rem; white-space:nowrap; }
.qs-bar { height:4px; border-radius:4px; background:var(--bg-input); margin:5px 0 3px 14px; overflow:hidden; }
.qs-bar i { display:block; height:100%; border-radius:4px; transition:width .4s ease; }
.qs-meta { font-size:.72rem; color:var(--text-secondary); margin-left:14px; }
.qs-note { font-size:.76rem; color:var(--text-secondary); padding:8px 0 2px; }
.qs-more { width:100%; margin-top:8px; padding:7px 10px; font-size:.8rem; }
.doc-notes { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.doc-note { display:inline-flex; align-items:center; gap:5px; font-size:.72rem; padding:3px 9px; border-radius:999px; background:var(--bg-input); color:var(--text-secondary); border:0.5px solid var(--border); }
@media (max-width: 640px) { .quota-sheet { left:8px !important; right:8px; width:auto; } .quota-line { margin:-8px 12px 4px; } }
.msg.user .doc-note { background:rgba(255,255,255,.18); color:var(--text-user, #fff); border-color:rgba(255,255,255,.28); }
.msg.peer .doc-note { background:var(--bg-input); color:var(--text-primary); border-color:var(--border); }

/* ---- Aiuto mentre scrivi: continuazione in grigio dentro la casella + riga di consigli discreta ---- */
.ta-wrap { flex: 1; position: relative; display: flex; min-width: 0; }
.ta-wrap textarea { flex: 1; min-width: 0; }
.ghost {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; box-sizing: border-box;
  border: 0.5px solid transparent; border-radius: 22px; padding: 11px 16px;
  font-size: 0.96rem; font-family: inherit; line-height: 1.4;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; color: transparent;
}
.ghost .gh-next { color: var(--text-secondary); opacity: 0.6; }
.ghost .gh-key {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 5px; font-size: 0.68rem; line-height: 1.35;
  border: 0.5px solid var(--border); color: var(--text-secondary); opacity: 0.75; vertical-align: 1px;
}
.assist-bar {
  max-width: 820px; width: 100%; margin: 0 auto 4px; padding: 0 16px; box-sizing: border-box;
  display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none;
  font-size: 0.78rem; animation: rcptSlide 0.16s ease-out; position: relative; z-index: 2;
}
.assist-bar::-webkit-scrollbar { display: none; }
.as-intent { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
.as-intent .ic { width: 12px; height: 12px; }
.as-chip {
  border: 0.5px solid var(--border); background: var(--bg-input); color: var(--text-secondary);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap; cursor: pointer; flex-shrink: 0;
  max-width: 72vw; overflow: hidden; text-overflow: ellipsis; font: inherit; font-size: 0.78rem;
}
.as-chip:hover { color: var(--text-primary); border-color: color-mix(in srgb, var(--accent, #6366f1) 45%, var(--border)); }
.as-chip b { color: var(--text-primary); font-weight: 500; }

/* =================== Galleria file "big platform" (2026-12-04) =================== */
/* finestre aperte dalla galleria (anteprima, condivisione, editor) sempre sopra di essa */
body.fl-open .modal-backdrop { position: fixed; z-index: 10001; }
.fl-pop {
  position: relative; width: min(1040px, 96vw); max-width: min(1040px, 96vw); height: min(88dvh, 900px);
  max-height: 92dvh; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 12px;
}
.fl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; }
.fl-filterbar { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; padding-bottom: 2px; }
.fl-filterbar::-webkit-scrollbar, #flSmartBar::-webkit-scrollbar { display: none; }
.fl-filterbar .fl-chips, #flSmartBar { flex-wrap: nowrap; flex-shrink: 0; }
#flSmartBar { overflow-x: auto; scrollbar-width: none; }
.fl-filterbar .fl-chip, #flSmartBar .fl-chip { white-space: nowrap; flex-shrink: 0; }
.fl-sep { width: 1px; align-self: stretch; margin: 3px 2px; background: var(--border); flex-shrink: 0; }
.fl-chip-scope { border-style: dashed; }
#flFilesPane { gap: 8px !important; }
#flList.fl-scroll { max-height: none; min-height: 0; padding-bottom: 8px; }
.fl-quota { font-size: 0.72rem; opacity: 0.8; flex-shrink: 0; padding: 2px 2px 0; }
.fl-quota-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.fl-quota-track { height: 3px; border-radius: 999px; background: rgba(128, 128, 128, 0.2); overflow: hidden; }

/* barra di selezione: prende il posto dell'intestazione */
.fl-pick-bar {
  position: absolute; top: 0; left: 0; right: 0; bottom: auto; z-index: 30; display: flex; align-items: center; gap: 6px;
  flex-wrap: nowrap; padding: 12px 14px; border: 0; border-radius: 0; border-bottom: 0.5px solid var(--border);
  background: color-mix(in srgb, var(--accent) 9%, var(--bg-page)); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  animation: rcptSlide 0.16s ease-out;
}
.fl-pick-count { flex: 1; min-width: 0; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-pick-acts { display: flex; flex-wrap: nowrap; gap: 2px; align-items: center; }
.fl-pick-bar .icon-btn { width: 38px; height: 38px; }
#flSelAllBtn.on { color: var(--accent); }
.fl-pb-del { color: var(--danger, #c0392b); }

/* riquadri: si aprono al tocco; selezione stile foto */
.fl-card, .fl-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.fl-card:focus-visible, .fl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fl-card .fl-card-thumb { transition: transform 0.16s ease, border-radius 0.16s ease; }
.fl-card.selected { background: color-mix(in srgb, var(--accent) 14%, var(--bg-input)); }
.fl-card.selected .fl-card-thumb { transform: scale(0.9); border-radius: 10px; }
.fl-card-chk { width: 24px; height: 24px; top: 7px; left: 7px; }
.fl-card-chk .ic { width: 14px; height: 14px; opacity: 0; }
.fl-card.selected .fl-card-chk .ic { opacity: 1; }
@media (pointer: coarse) {
  .fl-card:hover .fl-card-chk { opacity: 0; }
  .fl-has-sel .fl-card-chk, .fl-card.selected .fl-card-chk { opacity: 1; }
  .fl-card:hover { transform: none; }
}
.fl-row { cursor: pointer; align-items: center; transition: background 0.12s ease; }
.fl-row:hover { background: var(--bg-input); }
.fl-th-wrap { position: relative; flex: none; }
.fl-row-chk {
  position: absolute; top: -5px; left: -5px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  color: #fff; display: none; align-items: center; justify-content: center; border: 2px solid var(--bg-page);
}
.fl-row-chk .ic { width: 11px; height: 11px; }
.fl-row.selected { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.fl-row.selected .fl-row-chk { display: flex; }
.fl-th-tile { background: var(--tile) !important; color: #fff !important; font-size: 0.62rem !important; font-weight: 700; letter-spacing: 0.03em; }

/* anteprime vere dei documenti (il colore del formato arriva da JS, questo è il valore di riserva) */
:root { --tile: var(--accent); }
.fl-doc {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: color-mix(in srgb, var(--tile) 11%, var(--bg-page));
}
.fl-doc-page {
  position: absolute; inset: 12% 12% 0; background: var(--bg-page); border-radius: 6px 6px 0 0; padding: 8px 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); font-size: 7px; line-height: 1.4; color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-word; overflow: hidden; text-align: left;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent);
}
.fl-doc-ico { color: var(--tile); display: inline-flex; }
.fl-doc-ico .ic { width: 36px; height: 36px; }
.fl-doc-ext {
  position: absolute; left: 8px; bottom: 8px; z-index: 1; background: var(--tile); color: #fff; font-weight: 700;
  font-size: 0.62rem; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 5px;
}
.fl-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 12px; text-align: center; color: var(--text-secondary); }
.fl-empty-ico .ic { width: 42px; height: 42px; opacity: 0.45; }
.fl-empty-t { max-width: 320px; font-size: 0.9rem; }

/* anteprima a tutto schermo dalla galleria */
.vw-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vw-stage > #viewerBody { position: relative; z-index: 1; }
.vw-tools { display: flex; gap: 2px; align-items: center; }
.vw-tools .icon-btn { width: 36px; height: 36px; }
.vw-tools .icon-btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.vw-tools .vw-del { color: var(--danger, #c0392b); }
#viewerModal.vw-gallery { background: rgba(0, 0, 0, 0.78); }
#viewerModal.vw-gallery > .modal-card {
  max-width: min(1200px, 97vw) !important; width: min(1200px, 97vw); height: 94dvh; max-height: 94dvh !important;
  animation: vwIn 0.16s ease-out; background: var(--bg-page);
}
@media (min-width: 641px) {
  .vw-stage:has(.vw-info:not(.hidden)) #viewerBody { margin-right: 346px; }
  .vw-stage:has(.vw-info:not(.hidden)) .vw-next { right: 350px; }
}
@keyframes vwIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }
.vw-gallery #viewerActs a[download] { display: none; }
.vw-gallery #viewerBody:has(> img), .vw-gallery #viewerBody:has(> video) { display: flex; align-items: center; justify-content: center; }
.vw-gallery #viewerBody > img, .vw-gallery #viewerBody > video { max-width: 100%; max-height: 100%; object-fit: contain; margin: auto !important; }
.vw-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.45); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.12s ease;
}
.vw-nav:hover { background: rgba(0, 0, 0, 0.65); }
.vw-nav .ic { width: 22px; height: 22px; }
.vw-prev { left: 4px; } .vw-next { right: 4px; }
.vw-info { position: absolute; top: 10px; right: 0; bottom: 0; width: min(340px, 100%); z-index: 4; animation: rcptSlide 0.16s ease-out; }
.vw-info .fl-subcard { max-width: none; max-height: none; height: 100%; }

@media (max-width: 640px) {
  #filesBackdrop { padding: 0; }
  .fl-pop {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0;
    padding: max(12px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
  }
  .fl-pick-bar { padding-top: max(10px, env(safe-area-inset-top)); }
  .fl-pick-bar { gap: 2px; padding-left: 8px; padding-right: 8px; }
  .fl-pick-bar .icon-btn { width: 34px; height: 34px; }
  .fl-pick-count { font-size: 0.86rem; }
  #flAddBtn > span:last-child { display: none; }
  #flList { --fl-cols: 3 !important; }
  #flZoomWrap { display: none !important; }
  .fl-toolbar { flex-wrap: nowrap; }
  #flQ { min-width: 0 !important; padding-top: 8px; padding-bottom: 8px; }
  .fl-group-sel { max-width: 96px; }
  .fl-card-meta { padding: 5px 6px 6px; }
  .fl-card-info-inline { display: none; }
  #viewerModal.vw-gallery { padding: 0; }
  #viewerModal.vw-gallery > .modal-card {
    width: 100vw; max-width: 100vw !important; height: 100dvh; max-height: 100dvh !important; border-radius: 0;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)) !important;
  }
  .vw-gallery .modal-card > div:first-child { flex-wrap: wrap; }
  .vw-gallery #viewerActs { order: 5; width: 100%; overflow-x: auto; }
  .vw-gallery #viewerActs:empty { display: none !important; }
  .vw-nav { width: 36px; height: 36px; background: rgba(0, 0, 0, 0.3); }
  .vw-info { top: auto; left: 0; width: auto; max-height: 72%; z-index: 6; }
  .vw-stage:has(.vw-info:not(.hidden)) #viewerBody iframe { visibility: hidden; } /* i lettori PDF incorporati coprirebbero la scheda */
  .vw-info .fl-subcard { border-radius: 16px 16px 0 0; }
}

/* ---- ✕ per svuotare la casella + riga unica dei suggerimenti (correzione, continuazione, consiglio, Annulla) ---- */
.ta-clear {
  position: absolute; right: 6px; bottom: 8px; z-index: 2; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: transparent; color: var(--text-secondary); display: none; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0.7; transition: opacity 0.12s ease, background 0.12s ease;
}
.ta-clear:hover { opacity: 1; background: color-mix(in srgb, var(--text-secondary) 14%, transparent); }
.ta-clear .ic { width: 15px; height: 15px; }
.ta-wrap.has-text .ta-clear { display: inline-flex; }
.ta-wrap.has-text textarea, .ta-wrap.has-text .ghost { padding-right: 40px; }
.as-chip.as-fix {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-input)); display: inline-flex; align-items: center; gap: 4px; max-width: 78vw;
}
.as-chip.as-fix .ic { width: 12px; height: 12px; flex-shrink: 0; }
/* la correzione si vede per intero (fino a 3 righe), con le parole cambiate evidenziate */
.assist-bar.has-fix { flex-wrap: wrap; overflow-x: visible; }
.as-chip.as-fix { white-space: normal; text-align: start; border-radius: 12px; padding: 5px 10px; max-width: 100%; align-items: flex-start; line-height: 1.35; }
.as-chip.as-fix .ic { margin-top: 2px; }
.as-chip.as-fix > span { white-space: nowrap; }
.as-chip.as-fix b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
.as-diff { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text-primary); border-radius: 3px; padding: 0 1px; font-weight: 600; }
.as-chip-strong { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); font-weight: 600; }

/* Galleria semplificata: una riga di filtri, Vista in un menu, cartelle in cima come Drive */
.fl-chip-ic { display: inline-flex; align-items: center; gap: 5px; }
.fl-chip-ic .ic { width: 13px; height: 13px; }
.fl-view-btn { display: inline-flex; align-items: center; gap: 5px; height: 100%; min-height: 34px; padding: 0 10px; border: 0.5px solid var(--border); border-radius: 10px; background: var(--bg-input); color: var(--text-primary); font-size: .8rem; }
.fl-view-btn.on { border-color: var(--accent); }
.fl-view-btn .ic { width: 15px; height: 15px; }
.fl-view-pop { right: 0; top: calc(100% + 6px); min-width: 232px; padding: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-page); z-index: 30; }
.fl-view-pop.hidden { display: none; }
.fl-vp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 4px; font-size: .82rem; color: var(--text-primary); }
.fl-vp-row > span { opacity: .8; }
.fl-vp-row .fl-group-sel { max-width: none !important; min-width: 118px; }
.fl-vp-row.fl-zoom-wrap input[type="range"] { width: 118px; }
.fl-vp-row.fl-dim { opacity: .45; }
.fl-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.fl-folders-sec .fl-folder-card { display: flex; min-width: 0; padding: 9px 10px; }
.fl-folder-card .fl-fc-ico { display: inline-flex; color: var(--accent); flex-shrink: 0; }
.fl-folder-card .fl-fc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fl-folder-card .fl-fc-act .ic { width: 14px; height: 14px; }
@media (hover: hover) { .fl-folder-card .fl-fc-act { opacity: 0; } .fl-folder-card:hover .fl-fc-act, .fl-folder-card:focus-within .fl-fc-act { opacity: .7; } }
.fl-bread button { display: inline-flex; align-items: center; gap: 3px; }
.fl-bread button .ic { width: 14px; height: 14px; }
.fl-date-hdr { justify-content: flex-start; gap: 8px; }
.fl-date-chk { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--text-secondary); background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; flex-shrink: 0; opacity: .55; transition: opacity .14s ease, background .14s ease; }
.fl-date-chk .ic { width: 12px; height: 12px; opacity: 0; }
.fl-date-chk:hover, .fl-has-sel .fl-date-chk { opacity: 1; }
.fl-date-chk.on { background: var(--accent); border-color: var(--accent); opacity: 1; }
.fl-date-chk.on .ic { opacity: 1; }
.fl-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-input); font-size: .8rem; color: var(--text-secondary); }
.fl-link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: .8rem; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.fl-up-prog { display: flex; flex-direction: column; gap: 3px; }
.fl-up-prog.hidden { display: none; }
.fl-up-track { height: 4px; border-radius: 999px; background: var(--bg-input); overflow: hidden; }
.fl-up-bar { height: 100%; border-radius: 999px; background: var(--accent); width: 0; transition: width .2s ease; }
.fl-up-prog small { font-size: .74rem; opacity: .8; }
.fl-mem { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 0.5px solid var(--border); }
.fl-mem-h { font-size: .8rem; font-weight: 700; opacity: .85; }
.fl-mem-st { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .8rem; }
.fl-mem-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.fl-mem-acts button { padding: 6px 10px; font-size: .8rem; }
.fl-mem-sum { font-size: .82rem; line-height: 1.45; max-height: 32vh; overflow-y: auto; }
.fl-mem-sum p { margin: 0 0 6px; white-space: pre-wrap; }
.fl-mem-sum ul { margin: 0 0 0 18px; opacity: .85; }
.fl-mem-note { font-size: .76rem; opacity: .8; min-height: 1em; }
@media (max-width: 640px) {
  .fl-view-btn > span:last-child { display: none; }
  #flScope { max-width: 118px; }
  .fl-folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Versioni, permessi per file, editor immagini e PDF (modules/file-collab.js) ---------- */
.fl-mem-sum.no-tr { white-space: pre-wrap; }
.file-ver { opacity: .7; font-size: .78em; }
.fc-muted { opacity: .7; font-size: .85rem; }
.fc-list { display: flex; flex-direction: column; gap: 8px; }
.fc-row { border: 0.5px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.fc-row.on { border-color: var(--accent); }
.fc-row-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .88rem; }
.fc-row-h .site-chip { margin-left: auto; }
.fc-sum { font-size: .84rem; opacity: .85; }
.fc-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fc-person { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.fc-who { display: flex; flex-direction: column; min-width: 0; }
.fc-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-sel { padding: 6px 8px; border-radius: 10px; max-width: 48%; }
.fc-add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fc-add input { flex: 1; min-width: 180px; }
.fc-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; position: sticky; top: 0; z-index: 2; background: var(--bg-elevated, var(--bg-surface)); padding: 4px 0; }
.fc-tool { padding: 6px 10px; font-size: .84rem; }
.fc-tool.on { border-color: var(--accent); color: var(--accent); }
.fc-color { width: 34px; height: 30px; padding: 0; border: none; background: none; }
.fc-size { width: 90px; }
.fc-canvas-wrap { display: flex; justify-content: center; }
.fc-canvas { max-width: 100%; max-height: 64vh; border-radius: 10px; cursor: crosshair; background: repeating-conic-gradient(#0001 0% 25%, transparent 0% 50%) 50% / 16px 16px; }
.fc-pages { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.fc-page-cell { width: min(100%, 760px); display: flex; flex-direction: column; gap: 4px; }
.fc-page-bar { display: flex; align-items: center; gap: 6px; font-size: .8rem; opacity: .85; }
.fc-page-bar small { margin-right: auto; }
.fc-mini { padding: 2px 8px; font-size: .85rem; }
.fc-page { position: relative; width: 100%; background: #fff; box-shadow: 0 1px 6px #0002; transition: transform .2s; }
.fc-page canvas { width: 100%; height: 100%; display: block; }
.fc-page.off { opacity: .25; }
.fc-layer { position: absolute; inset: 0; cursor: copy; }
.fc-item { position: absolute; transform: translateY(-50%); cursor: pointer; outline: 1px dashed #4f8cff88; }
.fc-pad-ov { position: fixed; inset: 0; background: #0008; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.fc-pad { background: var(--bg-elevated, #fff); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; width: min(560px, 100%); }
.fc-pad-c { width: 100%; aspect-ratio: 900 / 320; background: #fff; border: 1px solid var(--border); border-radius: 10px; touch-action: none; }

/* ---------- Editor a mano dei siti ---------- */
.se-ov { position: fixed; inset: 0; z-index: 9000; background: #0007; display: flex; }
.se-box { background: var(--bg-elevated, var(--bg-surface)); width: 100%; height: 100%; display: flex; flex-direction: column; }
.se-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 0.5px solid var(--border); }
.se-title { flex: 1 1 180px; min-width: 140px; font-weight: 600; }
.se-theme { max-width: 140px; }
.se-status { font-size: .82rem; opacity: .8; min-width: 120px; }
.se-top-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.se-top-acts button { padding: 6px 12px; }
.se-switch { display: none; gap: 6px; padding: 6px 14px; }
.se-main { flex: 1; display: grid; grid-template-columns: minmax(320px, 420px) 1fr; min-height: 0; position: relative; }
.se-main:has(.se-side:not(.hidden)) { grid-template-columns: minmax(320px, 420px) 1fr minmax(280px, 340px); }
.se-left { overflow-y: auto; padding: 12px 14px 40px; border-right: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.se-pv { display: flex; flex-direction: column; min-height: 0; background: var(--bg-surface); padding: 8px; gap: 6px; }
.se-vp { display: flex; gap: 4px; justify-content: center; }
.se-frame { flex: 1; width: 100%; border: 0; border-radius: 12px; background: #fff; transition: max-width .2s; margin: 0 auto; }
.se-frame.mob { max-width: 390px; }
.se-side { overflow-y: auto; border-left: 0.5px solid var(--border); padding: 12px 14px 40px; display: flex; flex-direction: column; gap: 10px; }
.se-sh { display: flex; justify-content: space-between; align-items: center; }
.se-sb { display: flex; flex-direction: column; gap: 8px; }
.se-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.se-prow { display: flex; gap: 6px; }
.se-prow input { flex: 1; }
.se-blocks { display: flex; flex-direction: column; gap: 8px; }
.se-block { border: 0.5px solid var(--border); border-radius: 12px; overflow: hidden; }
.se-block.open { border-color: var(--accent); }
.se-bh { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 0; }
.se-blab { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 8px 10px; cursor: pointer; color: inherit; font: inherit; display: flex; gap: 4px; align-items: baseline; overflow: hidden; }
.se-hint { opacity: .6; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 6px; }
.se-bacts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.se-mini { padding: 2px 8px; font-size: .85rem; min-width: 30px; }
.se-form { display: flex; flex-direction: column; gap: 8px; padding: 4px 12px 12px; }
.se-f { display: flex; flex-direction: column; gap: 3px; font-size: .82rem; }
.se-f > span { opacity: .75; }
.se-f input, .se-f textarea { width: 100%; font-size: .92rem; }
.se-items { display: flex; flex-direction: column; gap: 8px; }
.se-item { border: 0.5px dashed var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.se-ih { display: flex; justify-content: space-between; align-items: center; }
.se-img { display: flex; gap: 8px; align-items: center; }
.se-thumb { width: 72px; height: 48px; border-radius: 8px; border: 0.5px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.se-thumb img { width: 100%; height: 100%; object-fit: cover; }
.se-add > summary { list-style: none; cursor: pointer; text-align: center; padding: 10px; border-radius: 12px; }
.se-add > summary::-webkit-details-marker { display: none; }
.se-addgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-top: 8px; }
.se-addb { padding: 8px; font-size: .85rem; text-align: left; }
.se-pick { width: min(720px, 100%); max-height: 90vh; overflow-y: auto; }
.se-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; min-height: 60px; }
.se-tile { padding: 0; border: 0.5px solid var(--border); border-radius: 8px; overflow: hidden; height: 80px; cursor: pointer; background: none; }
.se-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.se-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.se-kpi { border: 0.5px solid var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; }
.se-kpi b { font-size: 1.3rem; }
.se-kpi small { opacity: .7; font-size: .74rem; }
.se-bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; border-bottom: 0.5px solid var(--border); }
.se-bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.se-st { margin-top: 8px; font-size: .88rem; }
.se-hrow { position: relative; display: flex; justify-content: space-between; gap: 8px; font-size: .84rem; padding: 4px 6px; border-radius: 6px; overflow: hidden; }
.se-hrow > span, .se-hrow > b { position: relative; }
.se-hrow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-hbar { position: absolute; inset: 0 auto 0 0; background: var(--accent); opacity: .15; }
.se-kv { display: grid; grid-template-columns: 54px 1fr auto; gap: 6px; align-items: center; font-size: .82rem; }
.se-kv code { word-break: break-all; font-size: .78rem; }
@media (max-width: 860px) {
  .se-switch { display: flex; }
  .se-main, .se-main:has(.se-side:not(.hidden)) { grid-template-columns: 1fr; }
  .se-pv { display: none; }
  .se-main.show-pv .se-left { display: none; }
  .se-main.show-pv .se-pv { display: flex; }
  .se-side:not(.hidden) { position: absolute; inset: 0; background: var(--bg-elevated, var(--bg-surface)); z-index: 3; }
  .se-status { min-width: 0; order: 9; flex-basis: 100%; }
}
