/* Aggiunte per la PWA sopra sidepanel.css: telefono, aree sicure, schermata di partenza. */

html, body { height: 100%; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
.app { height: 100dvh; max-width: 760px; margin: 0 auto; }
@media (min-width: 761px) {
  .app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

.top { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
.scroll { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.composer-wrap { padding-bottom: max(12px, env(safe-area-inset-bottom)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.fav { width: 28px; height: 28px; border-radius: 8px; }
.fav-wrap { background: transparent; }

/* tocchi più comodi sul telefono */
.icon-btn { width: 40px; height: 40px; }
.icon-btn svg { width: 20px; height: 20px; }
.send { width: 40px; height: 40px; }
/* iOS ingrandisce la pagina sui campi sotto i 16px */
.composer textarea, .src-card textarea, .field input, .field select, .onboarding input { font-size: 16px; }
.seg-btn { padding: 6px 12px; font-size: 13px; }
.chip { padding: 9px 14px; font-size: 13.5px; }
.md { font-size: 15px; }
.msg-user { font-size: 15px; }

/* schermata di partenza */
.start { display: flex; flex-direction: column; gap: 12px; animation: rise .35s ease both; padding-top: 8px; }
.start-title { margin: 6px 2px 0; font-size: 24px; letter-spacing: -.02em; line-height: 1.2; }
.start-sub { margin: -4px 2px 4px; color: var(--text-2); }
.src-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, box-shadow .15s;
}
.src-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.src-card textarea {
  border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font-family: var(--font);
  line-height: 1.45; padding: 6px 6px 0; min-height: 70px; max-height: 40vh;
}
.src-card textarea::placeholder { color: var(--text-3); }
.src-row { display: flex; gap: 8px; align-items: center; }
.src-row .btn-primary { margin-left: auto; padding: 10px 20px; font-size: 14.5px; border-radius: 12px; }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; }
.btn-icon svg { width: 17px; height: 17px; }
.start .status { margin: 0; }

.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 10px; }
.row-head .section-label { margin-bottom: 8px; }
.link-btn { border: 0; background: none; color: var(--accent-text); font-size: 12.5px; font-weight: 600; padding: 4px; }

.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); text-align: left; box-shadow: var(--shadow); width: 100%;
}
.hist-item:active { transform: scale(.99); }
.hist-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--accent-soft) center/cover no-repeat; color: var(--accent-text); display: grid; place-items: center; }
.hist-icon svg { width: 19px; height: 19px; }
.hist-row { display: flex; gap: 4px; align-items: center; min-width: 0; }
.hist-row .hist-item { flex: 1; min-width: 0; }
.hist-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.hist-title { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-meta { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-del { flex: none; }
.hist-del svg { width: 17px; height: 17px; }

.install-card {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r);
  background: var(--accent-soft); color: var(--text);
}
.install-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.install-icon svg { width: 18px; height: 18px; }
.install-body { display: flex; flex-direction: column; font-size: 13px; color: var(--text-2); line-height: 1.4; min-width: 0; flex: 1; }
.install-body strong { color: var(--text); font-size: 13.5px; }
.install-body .ios-share { display: inline-block; width: 15px; height: 15px; vertical-align: -3px; color: var(--accent-text); }

.hero-doc { width: 64px; height: 64px; flex: none; border-radius: 12px; background: var(--accent-soft) center/cover no-repeat; color: var(--accent-text); display: grid; place-items: center; }
.hero-doc svg { width: 26px; height: 26px; }
.hero-thumb { width: 120px; }

.sheet-card { padding-bottom: max(18px, env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.sheet { justify-content: center; }
.onboarding { padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.ob-text { flex: 1; width: auto !important; height: auto !important; border-radius: 0 !important; background: none !important; display: inline !important; color: var(--text) !important; font-size: 13.5px !important; font-weight: 400 !important; }
.toast { bottom: calc(120px + env(safe-area-inset-bottom)); }

/* in modalità app (installata) niente card di installazione */
@media (display-mode: standalone) { .install-card { display: none !important; } }
