/* Tema dell'app Brain (sopra style.css e brand.css, dove stanno font Manrope e colori). Stile visivo Attio:
   grigi neutri freddi, accento blu, icone a linea sottile. Layout ispirato a Claude: colonna centrale e molto spazio in Home e Assistente.
   Le variabili sono condivise con il CRM (tasks.css). */
body { font-size: 13.5px; line-height: 1.45; }
:root { --side-w: 240px; --col: 760px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Controlli */
button { padding: 6px 11px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13.5px; }
button:hover { background: var(--hover); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { background: var(--accent); filter: brightness(1.08); }
.subtle { border-color: transparent; background: transparent; color: var(--ink-2); }
input, select, textarea { border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); padding: 6px 9px; font-size: 13.5px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.grow { flex: 1; }
.only-mobile { display: none !important; }

/* Menu laterale */
#workspace aside#side { width: var(--side-w); background: var(--side); border-right: 1px solid var(--line); padding: 10px 8px; position: fixed; inset: 0 auto 0 0; z-index: 30; }
#side .ws { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; flex-shrink: 0; }
#side .ws-logo { height: 28px; width: auto; }
#side .ws-name { font-weight: 650; color: var(--ink-2); }
#side nav { display: flex; flex-direction: column; gap: 1px; margin: 0; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; }
#side nav button, #side nav a { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-2); font-size: 13.5px; font-weight: 450; text-align: left; white-space: nowrap; text-decoration: none; flex: none; }
#side nav button:hover, #side nav a:hover { background: var(--hover); color: var(--ink); }
#side nav button.active { background: var(--active); color: var(--ink); font-weight: 600; }
#side .nav-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 14px 8px 4px; }
/* Gruppi a tendina: titolo sempre visibile, freccia a destra */
#side .nav-group { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; }
#side .nav-group[hidden] { display: none; }
#side nav .nav-head { justify-content: space-between; font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 6px 8px; }
#side nav .nav-head:hover { color: var(--ink-2); }
#side .nav-head .chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease; }
#side .nav-group.closed .chev { transform: rotate(-45deg); }
#side .nav-items { display: flex; flex-direction: column; gap: 1px; }
#side .nav-group.closed .nav-items { display: none; }
#side .sidebar-bottom { display: block; padding: 10px 8px 2px; border-top: 1px solid var(--line); margin-top: 8px; }
#side #account { margin: 6px 0; font-size: 12px; color: var(--ink-3); }
#side #logout { padding: 4px 0; font-size: 12.5px; }
.status-label { color: var(--ink-3); font-size: 11.5px; }

/* Area principale */
#workspace main { margin-left: var(--side-w); width: calc(100% - var(--side-w)); padding: 0 0 60px; min-width: 0; }
#workspace main > header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; height: 50px; margin: 0; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
#workspace main > header h1 { font-size: 14.5px; font-weight: 650; margin: 0; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.private-badge { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: var(--hover); border: 0; color: var(--ink-3); }
#notice { margin: 12px 20px 0; border-radius: 8px; padding: 9px 12px; font-size: 13px; background: var(--amber); color: var(--amber-ink); }
#content { padding: 16px 20px; }
#workspace .eyebrow { color: var(--ink-3); letter-spacing: .04em; }

/* Elementi esistenti del Brain, ammorbiditi */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; box-shadow: var(--shadow); }
.hero h2 { font-size: 22px; margin: 4px 0 6px; }
.hero p { color: var(--ink-2); font-size: 13.5px; margin: 0 0 14px; }
.section-head { margin: 22px 0 10px; }
.section-head h2 { font-size: 14px; font-weight: 650; }
.section-head span { color: var(--ink-3); font-size: 12.5px; }
.cards .card, .action-grid .card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); color: var(--ink); }
.cards .card:hover, .action-grid .card:hover { border-color: var(--line-strong); background: var(--surface); }
.action-grid .card h3 { font-size: 13.5px; margin: 6px 0 2px; }
.action-grid .card p { color: var(--ink-3); font-size: 12.5px; margin: 0; }
.mcp-card { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.mcp-card small { color: var(--ink-3); }
.empty { color: var(--ink-3); border: 1px dashed var(--line-strong); border-radius: 10px; background: transparent; }
.table-wrap { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow-x: auto; }
table { border-collapse: collapse; }
th { font-size: 12px; font-weight: 550; color: var(--ink-3); background: var(--surface); text-transform: none; letter-spacing: 0; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; }
tbody tr:hover td { background: var(--hover); }
.pill { background: var(--gray); color: var(--gray-ink); border-radius: 5px; padding: 1px 8px; font-size: 12px; font-weight: 550; }
.toolbar { gap: 8px; }
.list-item, .chat-item, .client-card, .connector { border-color: var(--line); background: var(--surface); border-radius: 10px; }
.chat-panel, .composer { background: var(--surface); border-color: var(--line); }
.message { border-radius: 10px; }

/* Home: riepilogo di oggi */
.today { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 6px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.stat:hover { border-color: var(--line-strong); background: var(--surface); }
.stat .k { color: var(--ink-3); font-size: 12px; font-weight: 550; }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--ink-3); font-size: 12px; }
.stat.warn .v { color: var(--red-ink); }

.scrim { position: fixed; inset: 0; background: rgba(15, 15, 14, .28); z-index: 25; }

/* Barra in basso (solo telefono) */
.tabbar { display: none; }

@media (max-width: 860px) {
  .only-mobile { display: inline-flex !important; }
  /* iPhone non fa zoom sui campi se il testo è almeno 16px */
  input, select, textarea { font-size: 16px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--ink-3);
    font-size: 11px; padding: 6px 2px; min-height: 48px; border-radius: 8px; }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button.active { color: var(--accent); font-weight: 600; }
  .tabbar button[hidden] { display: none; }
  #workspace main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  #workspace main > header { padding-top: env(safe-area-inset-top); height: calc(50px + env(safe-area-inset-top)); }
  #workspace aside#side { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  #side nav button, #side nav a { min-height: 42px; }
  #menu { display: none !important; }
  .today, .action-grid, .mcp-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .v { font-size: 19px; }
  .action-grid .card { padding: 10px 12px; }
  .hero { padding: 16px; }
  .hero h2 { font-size: 19px; }
  #workspace aside#side { position: fixed; width: 264px; height: 100dvh; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); border-right: 0; }
  #workspace aside#side.open { transform: none; }
  #side .ws .icon-btn { margin-left: auto; }
  #side .sidebar-bottom { display: block; }
  #side nav { display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; margin: 0; }
  #side nav button, #side nav a { font-size: 14px; padding: 8px; flex: none; }
  #workspace main { margin-left: 0; width: 100%; }
  #workspace main > header { padding: 0 10px; }
  #content { padding: 12px 10px; }
  .private-badge { display: none; }
}
/* Pagine incorporate (Analytics > Dashboard sito): iframe a tutta altezza sotto l'intestazione */
#workspace main.embedded { padding-bottom: 0; }
#workspace main.embedded #content { padding: 0; }
.embed-frame { display: block; width: 100%; height: calc(100dvh - 50px); border: 0; background: var(--bg); }
@media (max-width: 860px) {
  #workspace main.embedded { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .embed-frame { height: calc(100dvh - 50px - env(safe-area-inset-top) - 60px - env(safe-area-inset-bottom)); }
}
/* ---- Layout stile Claude: intestazione leggera, colonna centrale in Home e Assistente ---------- */
#workspace main > header { background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom-color: transparent; }
#workspace main.scrolled > header { border-bottom-color: var(--line); }
#workspace main > header h1 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.private-badge { display: none; }
#side { border-right-color: var(--line); }
#side nav button.active { background: var(--active); font-weight: 550; }
#side nav button svg, #side nav a svg { color: var(--ink-3); }
#side nav button.active svg { color: var(--ink); }
.col { max-width: var(--col); margin: 0 auto; width: 100%; }

/* Home */
.home { display: flex; flex-direction: column; gap: 30px; padding: 7vh 0 40px; }
.home-ask { text-align: center; }
.home-ask h2 { font-size: 30px; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; margin: 0 0 22px; color: var(--ink); }
.ask-box { display: flex; flex-direction: column; gap: 8px; text-align: left; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 18px; padding: 14px 14px 10px 18px; box-shadow: var(--shadow-ask); transition: border-color .15s, box-shadow .15s; }
.ask-box:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); box-shadow: var(--shadow-ask), 0 0 0 3px var(--accent-soft); }
.ask-box textarea { width: 100%; min-height: 58px; max-height: 40vh; resize: none; border: 0; outline: 0; padding: 2px 0; background: transparent;
  color: var(--ink); font-size: 15.5px; line-height: 1.55; box-shadow: none !important; }
.ask-bar { display: flex; align-items: center; gap: 6px; }
.ask-bar .composer-mic { border: 0; background: transparent; color: var(--ink-3); border-radius: 9px; height: 32px; padding: 0 8px; }
.ask-bar .composer-mic:hover { background: var(--hover); color: var(--ink); }
.ask-send { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 10px; }
.ask-send svg { width: 17px; height: 17px; stroke-width: 2; }
.ask-send:disabled { opacity: .35; cursor: default; filter: none; }
.ask-ideas { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.ask-ideas button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.ask-ideas button:hover { color: var(--ink); border-color: var(--line-strong); background: var(--hover); }
.ask-ideas svg { width: 14px; height: 14px; color: var(--ink-3); }
.home-sec h3 { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.home-sec h3 button { border: 0; background: none; padding: 0; font-size: 12.5px; color: var(--ink-3); }
.home-sec h3 button:hover { color: var(--ink); background: none; }
.today { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0; }
.stat { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 12px 14px; background: var(--surface); }
.stat:last-child { border-right: 0; }
.stat:hover { background: var(--hover); }
.stat .v { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.recent { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.recent button { display: flex; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 14px;
  background: var(--surface); text-align: left; color: var(--ink); }
.recent button:last-child { border-bottom: 0; }
.recent button:hover { background: var(--hover); }
.recent svg { color: var(--ink-3); }
.recent .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .w { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 12px; color: var(--ink-3); }
.links span { display: inline-flex; align-items: center; gap: 6px; }
.links i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.links i.ok { background: var(--green-ink); } .links i.ko { background: var(--red-ink); }

/* Assistente: conversazioni a sinistra, colonna di lettura al centro, casella in basso */
.split { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.chat-list { gap: 2px; position: sticky; top: 66px; max-height: calc(100vh - 90px); }
.chat-list > .primary { margin-bottom: 10px; border-radius: 9px; }
.chat-item { border: 0; background: transparent; border-radius: 8px; }
.chat-item button:first-child { border: 0; background: transparent; border-radius: 8px; padding: 7px 10px; color: var(--ink-2); font-size: 13px; }
.chat-item button:first-child:hover { background: var(--hover); color: var(--ink); }
.chat-item button.selected { background: var(--active) !important; color: var(--ink) !important; font-weight: 550; }
.chat-picker button { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.chat-picker button.selected { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chat-panel { border: 0; background: transparent; min-height: calc(100vh - 140px); max-width: var(--col); margin: 0 auto; width: 100%; overflow: visible; }
.messages { padding: 8px 0 24px; max-height: none; overflow: visible; }
.message { background: transparent; padding: 0; margin-bottom: 26px; font-size: 15px; line-height: 1.65; color: var(--ink); }
.message .message-label { display: none; }
.message.user { margin-left: auto; width: fit-content; max-width: 82%; background: var(--hover); padding: 10px 16px; border-radius: 16px; }
.message.error { background: var(--red); color: var(--red-ink); padding: 10px 14px; border-radius: 12px; }
.message strong { color: var(--ink); font-weight: 600; }
.message code { background: var(--gray); }
.message a { color: var(--accent); }
.message.reasoning { border-color: var(--line-strong); }
.reasoning-body { color: var(--ink-3); }
.composer { position: sticky; bottom: 14px; display: grid; grid-template-columns: auto auto 1fr auto; grid-template-areas: "t t t t" "a m . s";
  gap: 6px; padding: 12px 12px 10px 16px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-ask); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.composer textarea { grid-area: t; border: 0; padding: 2px 0; min-height: 52px; resize: none; font-size: 15px; background: transparent; box-shadow: none !important; }
.composer .composer-attach { grid-area: a; height: 32px; min-width: 0; padding: 0 8px; gap: 5px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-3); font-size: 12.5px; }
.composer .composer-attach:hover { background: var(--hover); color: var(--ink); }
.composer .composer-attach svg { width: 15px; height: 15px; }
.composer .composer-mic { grid-area: m; border: 0; background: transparent; color: var(--ink-3); height: 32px; }
.composer button[type="submit"] { grid-area: s; }
.chat-panel + .source, .split + .source { text-align: center; color: var(--ink-3); font-size: 12px; }
@media (max-width: 860px) {
  .home { padding-top: 3vh; gap: 22px; }
  .home-ask h2 { font-size: 22px; margin-bottom: 14px; }
  .ask-ideas { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .ask-ideas button { flex: none; }
  .today { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .chat-list { position: static; max-height: 168px; }
  .composer { bottom: calc(66px + env(safe-area-inset-bottom)); }
}
@media (prefers-color-scheme: dark) { #side .ws-logo { filter: invert(1) brightness(1.6); } }

/* ---- Accesso (21st: Login Minimal) ------------------------------------------------------- */
#login.login { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; background: var(--bg); grid-template-columns: 1fr; }
#login form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 0; background: transparent; border: 0; box-shadow: none; }
#login .login-logo { height: 36px; width: auto; align-self: flex-start; margin-bottom: 18px; }
#login h2 { font-size: 34px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 0; }
#login .login-sub { margin: -4px 0 12px; color: var(--ink-3); font-size: 15px; }
#login label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
#login label input:not([type="checkbox"]) { padding: 11px 13px; font-size: 15px; border-radius: 11px; font-weight: 400; }
#login .remember { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink-2); }
#login .remember input { width: 16px; height: 16px; accent-color: var(--accent); }
#login form .primary { width: 100%; padding: 12px; font-size: 15px; font-weight: 650; border-radius: 11px; margin-top: 6px; }
#login-error { min-height: 1em; margin: 0; color: var(--red-ink); font-size: 13px; }
@media (prefers-color-scheme: dark) { #login .login-logo { filter: invert(1) brightness(1.6); } }

/* ---- Pagine di lavoro: intestazione (21st: Search Toolbar Page Header) e colonna larga ---- */
#content, .page-head { max-width: 1180px; margin-left: auto; margin-right: auto; }
#workspace main.embedded #content { max-width: none; }
.page-head { padding: 26px 24px 16px; margin-bottom: 0; }
.page-head[hidden] { display: none; }
#workspace main.has-head > header h1, #workspace main.embedded > header h1 { visibility: hidden; }
#workspace main.has-head #content { padding-top: 18px; }
#content { padding-left: 24px; padding-right: 24px; }

/* Schede, vuoti, tab, tabelle e barre comuni delle pagine interne */
.hero, .draft-grid > *, .rules-card, .card:not(.stat), .list-item { border-radius: var(--radius-lg); }
.hero { box-shadow: var(--shadow); padding: 20px 22px; }
.hero h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.empty { display: flex; align-items: center; justify-content: center; min-height: 110px; padding: 28px 20px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg); background: transparent; color: var(--ink-3); text-align: center; font-size: 13.5px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--hover); }
.tab { border: 0 !important; background: transparent !important; color: var(--ink-2) !important; border-radius: 7px !important; padding: 5px 12px !important; font-weight: 550; }
.tab.active { background: var(--surface) !important; color: var(--ink) !important; box-shadow: var(--shadow); }
.table-wrap { border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.table-wrap th { background: var(--side); }
.table-wrap td:first-child, .table-wrap th:first-child { border-right: 1px solid var(--line); }
.toolbar input[type="search"], .toolbar input:not([type]) { min-width: 260px; }
.section-head h2 { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.source { color: var(--ink-3); font-size: 12.5px; }
#notice { max-width: 1132px; margin: 12px auto 0; }
@media (max-width: 860px) {
  .page-head { padding: 16px 12px 12px; }
  .page-head h1 { font-size: 19px; }
  #content { padding-left: 12px; padding-right: 12px; }
  .toolbar input[type="search"], .toolbar input:not([type]) { min-width: 0; }
}
#notice { width: calc(100% - 48px); }
/* Pagina azienda: il nome è già nell'intestazione grande */
#workspace main.has-head .crm .co-head { display: none; }
@media (max-width: 860px) { #notice { width: calc(100% - 24px); } }
#login label { margin: 0; }
#login .login-logo { height: 40px; }
.composer .composer-attach, .composer .composer-mic, .composer button[type="submit"] { grid-row: 2; align-self: center; margin: 0; order: 0; flex: none; width: auto; }
.composer .composer-attach { grid-column: 1; } .composer .composer-mic { grid-column: 2; } .composer button[type="submit"] { grid-column: 4; justify-self: end; }
.composer button[type="submit"].ask-send, .composer button.primary.ask-send { width: 34px; min-width: 0; height: 34px; min-height: 0; padding: 0; flex: none; }
.rules-text { width: 100%; padding: 12px 14px; border-radius: 12px; line-height: 1.55; }
.mail-date { color: var(--ink-3); margin-left: 4px; }
#workspace main.wide #content, #workspace main.wide .page-head { max-width: none; }

/* ---- Assistente come Claude: cronologia a sinistra, conversazione a destra --------------------- */
#workspace main:has(.chat-claude) #content { max-width: none; padding: 0; }
#workspace main:has(.chat-claude) { padding-bottom: 0; }
.chat-claude { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: calc(100dvh - 50px); }
.hist { display: flex; flex-direction: column; gap: 10px; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--side); min-height: 0; }
.hist-new { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.hist-new svg { width: 16px; height: 16px; }
.hist-who { align-self: flex-start; }
.hist-who button { padding: 3px 12px; font-size: 12.5px; }
.hist-list { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.hist-list section { margin-bottom: 14px; }
.hist-list h4 { margin: 4px 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.hist-item { display: flex; align-items: center; border-radius: 8px; }
.hist-item:hover, .hist-item.on { background: var(--active); }
.hist-open { flex: 1; min-width: 0; border: 0; background: transparent; padding: 7px 8px; text-align: left; color: var(--ink-2); font-size: 13.5px; font-weight: 450; border-radius: 8px; }
.hist-open:hover { background: transparent; }
.hist-item.on .hist-open { color: var(--ink); font-weight: 550; }
.hist-open span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-del { visibility: hidden; flex: none; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--ink-3); display: grid; place-items: center; border-radius: 7px; }
.hist-del svg { width: 14px; height: 14px; }
.hist-item:hover .hist-del, .hist-item.on .hist-del { visibility: visible; }
.hist-del:hover { color: var(--red-ink); background: var(--red); }
.hist-empty { color: var(--ink-3); font-size: 13px; padding: 8px; }

.conv { position: relative; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.conv .messages { width: 100%; max-width: var(--col); margin: 0 auto; padding: 28px 20px 12px; flex: 1 0 auto; min-height: 0; max-height: none; overflow: visible; }
/* flex 1 0 auto + min-height 0: la lista cresce con i messaggi. Con flex: 1 e il min-height 320px di style.css
   si comprimeva all'altezza dello schermo e i messaggi uscivano sotto il composer. */
.conv-hello { display: none; }
.conv-dock { position: sticky; bottom: 0; width: 100%; max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 8px 20px 14px;
  background: linear-gradient(to bottom, transparent, var(--bg) 24px); }
.conv-ideas, .conv-note { display: none; }
.conv-note { text-align: center; color: var(--ink-3); font-size: 12px; margin: 10px 0 0; }
.composer-claude textarea { min-height: 52px; }
/* Chat vuota: tutto al centro come la Home */
.conv.is-empty { justify-content: center; padding-bottom: 12vh; }
.conv.is-empty .conv-hello { display: block; text-align: center; padding: 0 20px; }
.conv.is-empty .conv-hello h2 { font-size: 30px; font-weight: 600; letter-spacing: -.025em; margin: 0 0 22px; }
.conv.is-empty .messages { display: none; }
.conv.is-empty .conv-dock { position: static; background: none; }
.conv.is-empty .conv-ideas { display: flex; }
.conv.is-empty .conv-note { display: block; }
.conv:not(.is-empty) .conv-note { display: block; margin-top: 6px; }
@media (max-width: 860px) {
  .chat-claude { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 50px - 60px - env(safe-area-inset-bottom)); }
  .hist { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; gap: 8px; }
  .hist-new { width: auto; }
  .hist-list { flex: 1 1 100%; max-height: 92px; }
  .hist-list h4 { display: none; }
  .hist-list section { margin: 0; }
  .conv.is-empty .conv-hello h2 { font-size: 22px; }
  .conv.is-empty .conv-ideas { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
}
.composer-claude .composer-attach { height: 32px; min-width: 0; padding: 0 8px; gap: 5px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-3); font-size: 12.5px; display: inline-flex; align-items: center; }
.composer-claude .composer-attach:hover { background: var(--hover); color: var(--ink); }
.composer-claude .composer-attach svg { width: 15px; height: 15px; }
.composer-claude .composer-mic { border: 0; background: transparent; color: var(--ink-3); height: 32px; padding: 0 8px; border-radius: 9px; }
.composer-claude .composer-mic:hover { background: var(--hover); color: var(--ink); }
.composer-claude .ask-send { width: 34px; height: 34px; min-width: 0; padding: 0; flex: none; }
.composer-claude .ask-bar > * { order: 0; }
.composer-claude .ask-bar .grow { order: 1; }
.composer-claude .ask-bar .ask-send { order: 2; }
