/* =====================================================================
   ABILMENTE — Design system dei mockup
   Derivato 1:1 dai token di MyRiflessi (ui-shared/src/styles/_tokens.scss):
   stessa palette mauve / oro / azzurro-ghiaccio, stesso layout "Sidebar Large"
   per l'area Scuola, stesso pattern "card mobile + bottom-nav" per la PWA Famiglia.
   Caricare DOPO bootstrap.min.css e bootstrap-icons.
   ===================================================================== */

:root {
  /* ---- Primary mauve (identico a MyRiflessi) ---- */
  --rf-primary-50: #faf7fa;
  --rf-primary-100: #f1ebf2;
  --rf-primary-200: #e0d4e2;
  --rf-primary-300: #cab7cd;
  --rf-primary-400: #aca0ae;
  --rf-primary-500: #997a9f;
  --rf-primary-600: #825889;
  --rf-primary-700: #6a4270;
  --rf-primary-800: #4e3252;
  --rf-primary-900: #322334;
  /* ---- Gold / blue accents ---- */
  --rf-gold-100: #f9f5eb;
  --rf-gold-300: #eee4cd;
  --rf-gold-500: #dabe81;
  --rf-gold-700: #ab822b;
  --rf-gold-800: #8c6a21;
  --rf-blue-100: #eef5f6;
  --rf-blue-300: #d9e6e8;
  --rf-blue-500: #92b3b9;
  --rf-blue-700: #4c6f76;

  --rf-color-primary: var(--rf-primary-600);
  --rf-color-primary-hover: var(--rf-primary-700);
  --rf-color-primary-soft: var(--rf-primary-50);
  --rf-color-secondary: var(--rf-blue-700);
  --rf-color-secondary-soft: var(--rf-blue-100);
  --rf-color-success: #4c8b6a;
  --rf-color-success-bg: #e7f3ed;
  --rf-color-warning: #c68a2e;
  --rf-color-warning-bg: #fbf1df;
  --rf-color-danger: #c1554d;
  --rf-color-danger-bg: #fbeae8;
  --rf-color-info: #4c6f76;
  --rf-color-info-bg: #eef5f6;
  --rf-color-text: #221f22;
  --rf-color-text-muted: #665f65;
  --rf-color-border: #e4e1e4;
  --rf-color-surface: #ffffff;
  --rf-color-surface-alt: #faf9fa;
  --rf-neutral-100: #f2f0f2;
  --rf-neutral-300: #cbc6ca;
  --rf-neutral-500: #857d84;

  --rf-sidebar-bg: var(--rf-primary-600);
  --rf-sidebar-text: rgba(255, 255, 255, 0.78);
  --rf-sidebar-width: 264px;
  --rf-topbar-height: 64px;
  --rf-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --rf-font-brand: "Nunito", var(--rf-font-sans);
  --rf-radius-sm: 6px;
  --rf-radius-md: 10px;
  --rf-radius-lg: 16px;
  --rf-shadow-sm: 0 1px 2px rgba(45, 35, 46, 0.06);
  --rf-shadow-md: 0 4px 12px rgba(45, 35, 46, 0.08);
  --rf-shadow-lg: 0 12px 32px rgba(45, 35, 46, 0.12);

  /* ---- Le 7 macro-aree ABILMENTE (colore + icona fissi in tutta la piattaforma) ---- */
  --area-info: #4c6f76;      /* 1 Trova le informazioni importanti — bi-highlighter */
  --area-info-bg: #eef5f6;
  --area-mappa: #825889;     /* 2 Costruisci la mappa concettuale — bi-diagram-3 */
  --area-mappa-bg: #f1ebf2;
  --area-piano: #ab822b;     /* 3 Pianificazione dello studio — bi-calendar2-week */
  --area-piano-bg: #f9f5eb;
  --area-sessione: #4e3252;  /* 4 Sessione di studio completa — bi-journal-bookmark-fill */
  --area-sessione-bg: #ece4ee;
  --area-vita: #4c8b6a;      /* 5 Missioni di vita quotidiana — bi-house-heart */
  --area-vita-bg: #e7f3ed;
  --area-sociale: #b0577a;   /* 6 Competenze sociali e relazionali — bi-people */
  --area-sociale-bg: #f8e9ef;
  --area-scala: #4d474c;     /* 7 Scala trasversale di autonomia — bi-sliders */
  --area-scala-bg: #f2f0f2;

  /* ---- Scala trasversale di autonomia 0–4 (0 = completamente autonomo) ---- */
  --aut-0: #4c8b6a; --aut-0-bg: #e7f3ed;  /* Completamente autonomo */
  --aut-1: #5f8f8f; --aut-1-bg: #e6f0f0;  /* Semplice richiamo */
  --aut-2: #c68a2e; --aut-2-bg: #fbf1df;  /* Suggerimenti */
  --aut-3: #997a9f; --aut-3-bg: #f1ebf2;  /* Guida parziale */
  --aut-4: #6a4270; --aut-4-bg: #ece4ee;  /* Guida continua */

  /* ---- Bootstrap runtime theming (come _bootstrap-runtime-theming.scss) ---- */
  --bs-primary: #825889;
  --bs-primary-rgb: 130, 88, 137;
  --bs-link-color: #825889;
  --bs-link-color-rgb: 130, 88, 137;
  --bs-link-hover-color: #6a4270;
  --bs-body-font-family: var(--rf-font-sans);
  --bs-body-color: #221f22;
  --bs-border-color: #e4e1e4;
  --bs-primary-bg-subtle: #f1ebf2;
  --bs-primary-text-emphasis: #6a4270;
  --bs-success: #4c8b6a; --bs-success-rgb: 76, 139, 106;
  --bs-warning: #c68a2e; --bs-warning-rgb: 198, 138, 46;
  --bs-danger: #c1554d; --bs-danger-rgb: 193, 85, 77;
  --bs-info: #4c6f76; --bs-info-rgb: 76, 111, 118;
  --bs-success-bg-subtle: #e7f3ed; --bs-success-text-emphasis: #3a6d52;
  --bs-warning-bg-subtle: #fbf1df; --bs-warning-text-emphasis: #8c6a21;
  --bs-danger-bg-subtle: #fbeae8; --bs-danger-text-emphasis: #963f39;
  --bs-info-bg-subtle: #eef5f6; --bs-info-text-emphasis: #3c585e;
  --bs-secondary-bg-subtle: #f2f0f2;
}

body {
  font-family: var(--rf-font-sans);
  background: #ebe6ec;
  color: var(--rf-color-text);
}

.btn-primary { --bs-btn-bg: #825889; --bs-btn-border-color: #825889; --bs-btn-hover-bg: #6a4270; --bs-btn-hover-border-color: #6a4270; --bs-btn-active-bg: #6a4270; --bs-btn-active-border-color: #6a4270; --bs-btn-disabled-bg: #aca0ae; --bs-btn-disabled-border-color: #aca0ae; }
.btn-outline-primary { --bs-btn-color: #825889; --bs-btn-border-color: #825889; --bs-btn-hover-bg: #825889; --bs-btn-hover-border-color: #825889; --bs-btn-active-bg: #6a4270; }
.btn-success { --bs-btn-bg: #4c8b6a; --bs-btn-border-color: #4c8b6a; --bs-btn-hover-bg: #3a6d52; --bs-btn-hover-border-color: #3a6d52; }
.btn { border-radius: var(--rf-radius-md); font-weight: 600; }
.form-control, .form-select { border-radius: var(--rf-radius-md); }
.form-check-input:checked { background-color: #825889; border-color: #825889; }
.nav-tabs .nav-link.active { color: #825889; font-weight: 600; }
.nav-tabs .nav-link { color: var(--rf-color-text-muted); }
.text-primary { color: #825889 !important; }
.bg-primary { background-color: #825889 !important; }
.card { border-color: var(--rf-color-border); border-radius: var(--rf-radius-lg); box-shadow: var(--rf-shadow-sm); }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--rf-color-text-muted); font-weight: 600; background: var(--rf-color-surface-alt); }

/* =====================================================================
   BARRA MOCKUP (navigazione tra le schermate, non fa parte del prodotto)
   ===================================================================== */
.mk-bar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 1.25rem;
  background: #221f22; color: #fff;
  font-size: .85rem;
}
.mk-bar a { color: #e0d4e2; text-decoration: none; }
.mk-bar a:hover { color: #fff; }
.mk-bar__brand { display: flex; align-items: center; gap: .5rem; font-family: var(--rf-font-brand); font-weight: 800; letter-spacing: .02em; }
.mk-bar__brand img { width: 22px; height: 22px; }
.mk-bar__code { background: rgba(255,255,255,.12); border-radius: 999px; padding: .1rem .6rem; font-weight: 700; font-size: .75rem; }
.mk-bar__app { font-weight: 700; }
.mk-bar__app--scuola { color: #e0d4e2; }
.mk-bar__app--famiglia { color: #eee4cd; }
.mk-bar__app--alunno { color: #d9e6e8; }
.mk-bar__app--hub { color: #cbc6ca; }
.mk-bar__title { color: #fff; font-weight: 600; }
.mk-bar__spacer { flex: 1; }
.mk-bar__nav { display: flex; gap: .4rem; }
.mk-bar__nav a { border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: .2rem .65rem; }

/* Pannello "note per la presentazione" */
.mk-notes {
  background: #fff; border-radius: var(--rf-radius-lg); box-shadow: var(--rf-shadow-md);
  padding: 1.1rem 1.25rem; font-size: .9rem; line-height: 1.5;
  border-top: 4px solid var(--rf-color-primary);
}
.mk-notes h2 { font-size: 1rem; font-weight: 800; margin-bottom: .5rem; display: flex; gap: .5rem; align-items: center; }
.mk-notes h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--rf-color-text-muted); margin: .9rem 0 .35rem; font-weight: 700; }
.mk-notes ul { padding-left: 1.1rem; margin-bottom: 0; }
.mk-notes li { margin-bottom: .25rem; }
.mk-notes .mk-ctx { display: inline-flex; gap: .35rem; align-items: center; font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; }
.mk-ctx--scuola { background: var(--rf-primary-100); color: var(--rf-primary-700); }
.mk-ctx--casa { background: var(--rf-gold-100); color: var(--rf-gold-800); }

/* Pagina con note in alto (schermate desktop) */
.mk-notes-strip {
  display: flex; gap: 1.5rem; align-items: flex-start;
  background: #fff; border-bottom: 1px solid var(--rf-color-border);
  padding: .75rem 1.25rem; font-size: .85rem; line-height: 1.45;
}
.mk-notes-strip strong { color: var(--rf-primary-700); }
.mk-notes-strip .col-note { flex: 1; min-width: 0; }

/* Stage per frame dispositivo */
.mk-stage {
  min-height: calc(100vh - 44px);
  display: flex; gap: 2.5rem; align-items: flex-start; justify-content: center;
  padding: 2rem 1.5rem 3rem;
  background: radial-gradient(1200px 600px at 20% 0%, #f1ebf2 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 100%, #eef5f6 0%, transparent 60%), #ebe6ec;
}
.mk-stage .mk-notes { width: 340px; flex-shrink: 0; position: sticky; top: 64px; }
.mk-stage--multi { flex-wrap: wrap; }

/* =====================================================================
   FRAME DISPOSITIVI
   ===================================================================== */
.device-phone {
  width: 390px; height: 844px; flex-shrink: 0;
  border-radius: 48px; background: #17151a; padding: 12px;
  box-shadow: 0 30px 60px rgba(45,35,46,.25), inset 0 0 0 2px #3a353b;
  position: relative;
}
.device-phone__screen {
  width: 100%; height: 100%; border-radius: 38px; overflow: hidden;
  background: var(--rf-color-surface-alt); position: relative;
  display: flex; flex-direction: column;
  font-size: 16px; /* la PWA usa 112.5% → scalato per il frame */
}
.device-phone__notch {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 32px; background: #17151a; border-radius: 20px; z-index: 30;
}
.device-statusbar {
  height: 50px; flex-shrink: 0; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 28px 6px; font-size: .8rem; font-weight: 700; background: var(--rf-color-surface);
}
.device-statusbar--dark { background: transparent; color: #fff; }
.device-caption { text-align: center; font-size: .8rem; color: var(--rf-color-text-muted); margin-top: .75rem; font-weight: 600; }

.device-tablet {
  width: 1180px; height: 820px; flex-shrink: 0;
  border-radius: 36px; background: #17151a; padding: 18px;
  box-shadow: 0 30px 60px rgba(45,35,46,.25), inset 0 0 0 2px #3a353b;
}
.device-tablet__screen {
  width: 100%; height: 100%; border-radius: 20px; overflow: hidden;
  background: var(--rf-color-surface-alt); display: flex; flex-direction: column; position: relative;
}
/* tablet ridotto per stare accanto alle note su schermi 1440 */
.device-tablet--fit { zoom: .86; }

/* =====================================================================
   AREA SCUOLA — Shell "Sidebar Large" (identica a rf-shell MyRiflessi)
   ===================================================================== */
.rf-shell { display: flex; min-height: calc(100vh - 44px); }
.rf-sidebar {
  width: var(--rf-sidebar-width); flex-shrink: 0; background: var(--rf-sidebar-bg);
  color: var(--rf-sidebar-text); display: flex; flex-direction: column;
}
.rf-sidebar__brand { height: 72px; display: flex; align-items: center; gap: .6rem; padding: 0 1.25rem; }
.rf-sidebar__brand img { width: 34px; height: 34px; }
.rf-sidebar__brand-name { font-family: var(--rf-font-brand); color: #fff; font-weight: 800; font-size: 1.35rem; letter-spacing: .01em; line-height: 1; }
.rf-sidebar__brand-sub { font-size: .68rem; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; margin-top: .2rem; }
.rf-sidebar__school {
  margin: 0 .75rem .5rem; padding: .6rem .75rem; border-radius: var(--rf-radius-md);
  background: rgba(255,255,255,.1); font-size: .78rem; color: #fff; line-height: 1.3;
}
.rf-sidebar__school small { display: block; color: rgba(255,255,255,.7); font-size: .7rem; }
.rf-sidebar__nav { display: flex; flex-direction: column; gap: .2rem; padding: .5rem .75rem 1rem; flex: 1; }
.rf-sidebar__section { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.55); padding: .8rem .875rem .3rem; font-weight: 700; }
.rf-sidebar__nav-item {
  display: flex; align-items: center; gap: .75rem; padding: .55rem .875rem;
  border-radius: var(--rf-radius-md); color: var(--rf-sidebar-text); text-decoration: none; font-size: .9rem;
}
.rf-sidebar__nav-item i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.rf-sidebar__nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.rf-sidebar__nav-item--active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.rf-sidebar__nav-item--child { padding-left: 2.6rem; font-size: .84rem; }
.rf-sidebar__badge { margin-left: auto; background: var(--rf-color-danger); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: .1rem .45rem; }
.rf-sidebar__badge--soft { background: rgba(255,255,255,.25); }
.rf-sidebar__footer { padding: .75rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; }

.rf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rf-topbar {
  height: var(--rf-topbar-height); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
  background: #fff; border-bottom: 1px solid var(--rf-color-border); position: sticky; top: 44px; z-index: 10;
}
.rf-topbar__search { flex: 0 1 380px; position: relative; }
.rf-topbar__search input { padding-left: 2.1rem; background: var(--rf-color-surface-alt); }
.rf-topbar__search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--rf-color-text-muted); }
.rf-topbar__spacer { flex: 1; }
.rf-topbar__icon { position: relative; color: var(--rf-color-text-muted); font-size: 1.2rem; padding: .25rem; }
.rf-topbar__icon .dot { position: absolute; top: -2px; right: -6px; background: var(--rf-color-danger); color: #fff; font-size: .62rem; font-weight: 700; border-radius: 999px; padding: 0 .35rem; }
.rf-topbar__user { display: flex; align-items: center; gap: .65rem; }
.rf-topbar__user-info { text-align: right; line-height: 1.2; }
.rf-topbar__user-name { font-size: .875rem; font-weight: 600; }
.rf-topbar__user-role { font-size: .75rem; color: var(--rf-color-text-muted); }
.rf-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--rf-primary-100); color: var(--rf-primary-700); font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.rf-avatar--sm { width: 30px; height: 30px; font-size: .72rem; }
.rf-avatar--lg { width: 64px; height: 64px; font-size: 1.3rem; }
.rf-avatar--gold { background: var(--rf-gold-300); color: var(--rf-gold-800); }
.rf-avatar--blue { background: var(--rf-blue-300); color: var(--rf-blue-700); }
.rf-avatar--green { background: #d4eadf; color: #3a6d52; }
.rf-avatar--rose { background: #f8e9ef; color: #8e3f5e; }

.rf-breadcrumb { font-size: .8rem; color: var(--rf-color-text-muted); margin-bottom: .75rem; }
.rf-breadcrumb a { color: var(--rf-color-text-muted); text-decoration: none; }
.rf-breadcrumb i { font-size: .65rem; margin: 0 .35rem; }
.rf-content { flex: 1; padding: 1.5rem; background: var(--rf-color-surface-alt); }
.rf-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.rf-page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.rf-page-head p { margin: .2rem 0 0; color: var(--rf-color-text-muted); }

/* KPI card (dashboard-card MyRiflessi) */
.kpi { background: #fff; border: 1px solid var(--rf-color-border); border-radius: var(--rf-radius-lg); padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; box-shadow: var(--rf-shadow-sm); height: 100%; }
.kpi__icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.kpi__label { font-size: .78rem; color: var(--rf-color-text-muted); }
.kpi__value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi__delta { font-size: .72rem; font-weight: 600; }

.rf-panel { background: #fff; border: 1px solid var(--rf-color-border); border-radius: var(--rf-radius-lg); box-shadow: var(--rf-shadow-sm); }
.rf-panel__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--rf-color-border); }
.rf-panel__title { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: .5rem; margin: 0; }
.rf-panel__title i { color: var(--rf-color-primary); }
.rf-panel__body { padding: 1rem 1.1rem; }

/* Tab interne della scheda alunno (tab-sidebar MyRiflessi → versione orizzontale) */
.rf-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--rf-color-border); margin-bottom: 1.25rem; overflow-x: auto; }
.rf-tabs a { padding: .65rem 1rem; color: var(--rf-color-text-muted); text-decoration: none; font-size: .88rem; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: .4rem; align-items: center; }
.rf-tabs a.active { color: var(--rf-color-primary); border-color: var(--rf-color-primary); }

/* =====================================================================
   ELEMENTI SPECIFICI ABILMENTE
   ===================================================================== */
/* Chip di macro-area */
.area-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.area-chip--info { color: var(--area-info); background: var(--area-info-bg); }
.area-chip--mappa { color: var(--area-mappa); background: var(--area-mappa-bg); }
.area-chip--piano { color: var(--area-piano); background: var(--area-piano-bg); }
.area-chip--sessione { color: var(--area-sessione); background: var(--area-sessione-bg); }
.area-chip--vita { color: var(--area-vita); background: var(--area-vita-bg); }
.area-chip--sociale { color: var(--area-sociale); background: var(--area-sociale-bg); }
.area-chip--scala { color: var(--area-scala); background: var(--area-scala-bg); }

.area-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.area-icon--sm { width: 32px; height: 32px; border-radius: 9px; font-size: .95rem; }
.area-icon--lg { width: 60px; height: 60px; border-radius: 16px; font-size: 1.7rem; }
.area-icon--info { color: var(--area-info); background: var(--area-info-bg); }
.area-icon--mappa { color: var(--area-mappa); background: var(--area-mappa-bg); }
.area-icon--piano { color: var(--area-piano); background: var(--area-piano-bg); }
.area-icon--sessione { color: var(--area-sessione); background: var(--area-sessione-bg); }
.area-icon--vita { color: var(--area-vita); background: var(--area-vita-bg); }
.area-icon--sociale { color: var(--area-sociale); background: var(--area-sociale-bg); }
.area-icon--scala { color: var(--area-scala); background: var(--area-scala-bg); }

/* Badge livello autonomia 0–4 */
.aut { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .75rem; border-radius: 999px; padding: .15rem .55rem .15rem .2rem; white-space: nowrap; }
.aut b { display: inline-flex; width: 1.3rem; height: 1.3rem; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-size: .72rem; }
.aut--0 { background: var(--aut-0-bg); color: var(--aut-0); } .aut--0 b { background: var(--aut-0); }
.aut--1 { background: var(--aut-1-bg); color: var(--aut-1); } .aut--1 b { background: var(--aut-1); }
.aut--2 { background: var(--aut-2-bg); color: #8c6a21; } .aut--2 b { background: var(--aut-2); }
.aut--3 { background: var(--aut-3-bg); color: var(--rf-primary-700); } .aut--3 b { background: var(--aut-3); }
.aut--4 { background: var(--aut-4-bg); color: var(--aut-4); } .aut--4 b { background: var(--aut-4); }

/* Selettore scala 0–4 (inserimento da parte dell'adulto) */
.aut-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.aut-picker__opt { border: 2px solid var(--rf-color-border); border-radius: 12px; background: #fff; padding: .6rem .4rem; text-align: center; font-size: .72rem; line-height: 1.2; color: var(--rf-color-text-muted); font-weight: 600; }
.aut-picker__opt .n { display: block; font-size: 1.35rem; font-weight: 800; margin-bottom: .15rem; }
.aut-picker__opt--0 .n { color: var(--aut-0); } .aut-picker__opt--1 .n { color: var(--aut-1); } .aut-picker__opt--2 .n { color: var(--aut-2); } .aut-picker__opt--3 .n { color: var(--aut-3); } .aut-picker__opt--4 .n { color: var(--aut-4); }
.aut-picker__opt--sel { border-color: currentColor; box-shadow: 0 0 0 3px rgba(130,88,137,.15); color: var(--rf-color-text); }
.aut-picker__opt--0.aut-picker__opt--sel { border-color: var(--aut-0); background: var(--aut-0-bg); }
.aut-picker__opt--1.aut-picker__opt--sel { border-color: var(--aut-1); background: var(--aut-1-bg); }
.aut-picker__opt--2.aut-picker__opt--sel { border-color: var(--aut-2); background: var(--aut-2-bg); }
.aut-picker__opt--3.aut-picker__opt--sel { border-color: var(--aut-3); background: var(--aut-3-bg); }
.aut-picker__opt--4.aut-picker__opt--sel { border-color: var(--aut-4); background: var(--aut-4-bg); }

/* Barra della scala (legenda) */
.aut-scale { display: flex; border-radius: 999px; overflow: hidden; height: 10px; }
.aut-scale span { flex: 1; }

/* Profilo funzionale (DSA / ADHD / ASD / adattive) */
.prof-tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: 6px; background: var(--rf-neutral-100); color: var(--rf-color-text-muted); }

/* Contesto scuola / casa */
.ctx { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; }
.ctx--scuola { background: var(--rf-primary-100); color: var(--rf-primary-700); }
.ctx--casa { background: var(--rf-gold-100); color: var(--rf-gold-800); }

/* Badge AI */
.ai-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: linear-gradient(90deg, #f1ebf2, #eef5f6); color: var(--rf-primary-700); border: 1px solid var(--rf-primary-200); }

/* Live dot */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c1554d; box-shadow: 0 0 0 4px rgba(193,85,77,.18); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(193,85,77,.2); } 50% { box-shadow: 0 0 0 7px rgba(193,85,77,.05); } }

/* Barre di progresso sottili */
.bar { height: 8px; border-radius: 999px; background: var(--rf-neutral-100); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--rf-color-primary); }

/* =====================================================================
   PWA FAMIGLIA (dentro .device-phone__screen) — pattern MyRiflessi
   ===================================================================== */
.pwa-header { background: #fff; border-bottom: 1px solid var(--rf-color-border); padding: .65rem 1rem; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.pwa-header__brand { display: flex; align-items: center; gap: .45rem; font-family: var(--rf-font-brand); font-weight: 800; color: var(--rf-primary-600); font-size: 1.1rem; }
.pwa-header__brand img { width: 26px; height: 26px; }
.pwa-header__icons { display: flex; gap: .85rem; color: var(--rf-color-text-muted); font-size: 1.15rem; }
.pwa-header__icons span { position: relative; }
.pwa-header__icons .dot { position: absolute; top: -4px; right: -8px; background: var(--rf-color-danger); color: #fff; font-size: .58rem; font-weight: 700; border-radius: 999px; padding: 0 .3rem; }
.pwa-child-switch { display: flex; align-items: center; gap: .5rem; padding: .5rem 1rem; background: var(--rf-primary-50); border-bottom: 1px solid var(--rf-color-border); font-size: .8rem; flex-shrink: 0; }
.pwa-content { flex: 1; overflow-y: auto; padding: 1rem 1rem 1.25rem; }
.pwa-content::-webkit-scrollbar { width: 0; }
.rf-card { background: #fff; border-radius: var(--rf-radius-lg); box-shadow: var(--rf-shadow-sm); padding: 1rem; margin-bottom: .85rem; }
.rf-card__title { display: flex; align-items: center; gap: .5rem; font-weight: 700; margin-bottom: .7rem; font-size: .95rem; }
.rf-card__title i { color: var(--rf-color-primary); }
.segmented { display: flex; background: var(--rf-color-border); border-radius: 999px; padding: 3px; font-size: .8rem; }
.segmented__opt { flex: 1; text-align: center; padding: .4rem 0; border-radius: 999px; color: var(--rf-color-text-muted); font-weight: 600; }
.segmented__opt--attivo { background: #fff; color: var(--rf-color-primary); box-shadow: var(--rf-shadow-sm); font-weight: 700; }
.bottom-nav { flex-shrink: 0; background: #fff; border-top: 1px solid var(--rf-color-border); display: flex; padding: .4rem .25rem 1.2rem; }
.bottom-nav__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .66rem; color: var(--rf-color-text-muted); text-decoration: none; font-weight: 600; }
.bottom-nav__item i { font-size: 1.25rem; }
.bottom-nav__item--attivo { color: var(--rf-color-primary); }
.task-row { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--rf-color-border); }
.task-row:last-child { border-bottom: none; }
.task-row__main { flex: 1; min-width: 0; }
.task-row__title { font-weight: 700; font-size: .9rem; }
.task-row__meta { font-size: .74rem; color: var(--rf-color-text-muted); }
.pwa-cta { display: block; width: 100%; padding: .85rem; border-radius: 14px; background: var(--rf-color-primary); color: #fff; text-align: center; font-weight: 700; border: none; text-decoration: none; }
.pwa-cta--ghost { background: #fff; color: var(--rf-color-primary); border: 2px solid var(--rf-primary-200); }

/* =====================================================================
   AREA ALUNNO (esecuzione strumenti — tablet a scuola / tablet o PC a casa)
   Pagine grandi, testo leggibile (font 112.5%), TTS, alto contrasto, aiuti graduati
   ===================================================================== */
.st-top { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem; background: #fff; border-bottom: 1px solid var(--rf-color-border); flex-shrink: 0; }
.st-top__title { font-weight: 800; font-size: 1.05rem; }
.st-top__sub { font-size: .78rem; color: var(--rf-color-text-muted); }
.st-top__tools { margin-left: auto; display: flex; gap: .5rem; }
.st-tool { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--rf-color-border); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--rf-color-text-muted); font-size: 1.1rem; }
.st-tool--on { background: var(--rf-primary-100); color: var(--rf-primary-700); border-color: var(--rf-primary-200); }
.st-help { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 999px; background: var(--rf-gold-100); color: var(--rf-gold-800); border: 2px solid var(--rf-gold-300); font-weight: 800; }
.st-body { flex: 1; overflow: hidden; display: flex; min-height: 0; }
.st-foot { flex-shrink: 0; display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem; background: #fff; border-top: 1px solid var(--rf-color-border); }
.st-btn { padding: .75rem 1.5rem; border-radius: 14px; font-weight: 800; font-size: 1rem; border: none; }
.st-btn--primary { background: var(--rf-color-primary); color: #fff; }
.st-btn--ghost { background: #fff; color: var(--rf-color-primary); border: 2px solid var(--rf-primary-200); }

/* Stepper Sessione di studio completa (7 fasi) */
.stepper { display: flex; align-items: center; gap: .3rem; padding: .65rem 1.25rem; background: var(--rf-primary-50); border-bottom: 1px solid var(--rf-color-border); flex-shrink: 0; overflow: hidden; }
.stepper__step { display: flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; color: var(--rf-color-text-muted); white-space: nowrap; }
.stepper__n { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--rf-neutral-300); font-size: .72rem; }
.stepper__step--done { color: var(--rf-color-success); }
.stepper__step--done .stepper__n { background: var(--rf-color-success); border-color: var(--rf-color-success); color: #fff; }
.stepper__step--current { color: var(--rf-primary-700); }
.stepper__step--current .stepper__n { background: var(--rf-color-primary); border-color: var(--rf-color-primary); color: #fff; box-shadow: 0 0 0 4px rgba(130,88,137,.2); }
.stepper__line { flex: 1; min-width: 10px; height: 2px; background: var(--rf-neutral-300); }
.stepper__line--done { background: var(--rf-color-success); }

/* Testo scolastico con evidenziazione */
.reading { font-size: 1.15rem; line-height: 1.9; letter-spacing: .02em; word-spacing: .08em; }
.hl-main { background: #fde9a8; border-radius: 4px; padding: 0 .15rem; box-shadow: inset 0 -2px 0 #dabe81; }
.hl-sec { background: #d9e6e8; border-radius: 4px; padding: 0 .15rem; }
.hl-kw { background: #e0d4e2; border-radius: 4px; padding: 0 .2rem; font-weight: 700; color: #4e3252; }
.hl-extra { background: #fbeae8; border-radius: 4px; padding: 0 .15rem; text-decoration: underline wavy #c1554d; text-underline-offset: 4px; }

/* Nodi mappa concettuale */
.map-node { position: absolute; padding: .5rem .9rem; border-radius: 14px; background: #fff; border: 2px solid var(--area-mappa); font-weight: 700; font-size: .9rem; box-shadow: var(--rf-shadow-md); text-align: center; }
.map-node--root { background: var(--area-mappa); color: #fff; font-size: 1.05rem; }
.map-node--g1 { border-color: #4c6f76; } .map-node--g2 { border-color: #ab822b; } .map-node--g3 { border-color: #4c8b6a; }
.kw-card { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .75rem; border-radius: 10px; background: #fff; border: 1.5px solid var(--rf-primary-200); font-weight: 700; font-size: .88rem; box-shadow: var(--rf-shadow-sm); }

/* Missioni passo-passo */
.step-card { display: flex; gap: .9rem; align-items: center; padding: .85rem 1rem; border-radius: 16px; background: #fff; border: 2px solid var(--rf-color-border); }
.step-card--done { border-color: var(--rf-color-success); background: var(--rf-color-success-bg); }
.step-card--current { border-color: var(--rf-color-primary); box-shadow: 0 0 0 4px rgba(130,88,137,.12); }
.step-card__pic { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; flex-shrink: 0; background: var(--rf-neutral-100); }

/* Sparkline / grafici SVG */
.chart-axis { stroke: #e4e1e4; stroke-width: 1; }
.chart-label { font-size: 10px; fill: #857d84; font-family: var(--rf-font-sans); }

/* Documento (anteprima PDP / GLO) */
.doc-page { background: #fff; width: 794px; margin: 0 auto; padding: 56px 64px; box-shadow: var(--rf-shadow-lg); font-family: Georgia, "Times New Roman", serif; font-size: 13.5px; line-height: 1.55; color: #222; }
.doc-page h1, .doc-page h2, .doc-page h3 { font-family: var(--rf-font-sans); }
.doc-page h2 { font-size: 15px; color: var(--rf-primary-700); border-bottom: 1px solid var(--rf-primary-200); padding-bottom: 4px; margin-top: 22px; }
.doc-page table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-page td, .doc-page th { border: 1px solid #d8d2d8; padding: 5px 7px; vertical-align: top; }
.doc-page th { background: #f6f2f6; font-family: var(--rf-font-sans); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.doc-ai { background: #faf7fa; border-left: 3px solid var(--rf-primary-400); padding: 8px 12px; }

/* Utility */
.fw-800 { font-weight: 800; }
.small-2 { font-size: .78rem; }
.text-muted-rf { color: var(--rf-color-text-muted); }
.gap-xs { gap: .35rem; }
.brand-font { font-family: var(--rf-font-brand); }
