/* Laboratorio IA — derivato da style.css dell'atlante Sardinia Data Web (stessi token e componenti). */
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-display: swap;
  src: url("vendor/fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-display: swap;
  src: url("vendor/fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }

:root {
  --ink: #1E2B32; --ink-2: #53636A; --ink-3: #87959A;
  --line: #DCE2E3; --paper: #F7F8F7; --white: #FFFFFF;
  --deep: #15506B; --saffron: #D18F00;
  --ok: #2F6E4F; --warn: #9A6A10; --ko: #A23B2A;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper);
  display: grid; grid-template-rows: 60px 1fr auto; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--deep); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------ top bar */
.topbar { display: grid; grid-template-columns: 340px 1fr auto; align-items: center;
  background: var(--white); border-bottom: 1px solid var(--line); padding-right: 16px; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 20px; }
.mark { width: 28px; height: 28px; fill: var(--deep); }
.mark .mark-in { fill: var(--white); opacity: .9; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.1; }
.brand-sub { font-size: 12.5px; color: var(--ink-2); }
.where { padding-left: 36px; font-weight: 600; color: var(--ink-2); }
.runchip { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--white);
  padding: 5px 14px; border-radius: 999px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 104px; justify-content: center; }
.runchip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.runchip.ok .dot { background: var(--ok); }
.runchip.warn { border-color: #E6CF9A; background: #FBF5E6; }
.runchip.warn .dot { background: var(--warn); }
.runchip.ko { border-color: #E3B3AA; background: #FBEDEA; color: var(--ko); }
.runchip.ko .dot { background: var(--ko); }

/* ------------------------------------------------ layout */
.layout { display: grid; grid-template-columns: 340px 1fr; min-height: 0; }
.panel { background: var(--white); border-right: 1px solid var(--line); overflow-y: auto; padding: 18px 20px 28px; }
.stage { position: relative; min-height: 0; overflow: auto; }
.sheet { max-width: 860px; padding: 28px 36px 40px; }
.sheet h2 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.15; margin: 0; max-width: 40ch; }
.lede { color: var(--ink-2); margin: 6px 0 16px; max-width: 72ch; }

.group { padding: 14px 0; border-top: 1px solid var(--line); }
.group:first-child { border-top: 0; padding-top: 0; }
.group h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.hint { font-size: 13.5px; color: var(--ink-2); margin: 8px 0 0; }

.history { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14.5px; }
.history li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--line); align-items: baseline; }
.history li:first-child { border-top: 0; }
.history .yr { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.history li.ora { font-weight: 600; box-shadow: inset 3px 0 0 var(--saffron); padding-left: 8px; margin-left: -8px; }
.history li.fatto { color: var(--ink-2); }
.history li.fatto .cod { color: var(--ok); }
.cod { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.ops-list { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); display: grid; gap: 6px; }
.ops-list b { color: var(--ink); font-weight: 600; }

.card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: var(--white); }
.card .sub, label.sub { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.testo { font-size: 17.5px; line-height: 1.6; }
.testo p { margin: 0 0 10px; }
.testo p:last-child { margin-bottom: 0; }
.testo ol, .testo ul { margin: 0 0 10px; padding-left: 22px; }
.testo img { max-width: 100%; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

.group-sheet { margin-top: 22px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--white); resize: vertical; line-height: 1.5; }
#risposta { min-height: 240px; font-size: 16px; }

.due { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.mia { white-space: pre-wrap; font-size: 15px; max-height: 260px; overflow: auto; }
.chiave { border-left: 3px solid var(--ok); }
.annota { margin-top: 14px; }
.domanda { margin: 12px 0; }
.dq { font-weight: 600; margin-bottom: 6px; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, auto); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px; background: var(--paper); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--deep); }

.azioni { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; }
.primary { background: var(--deep); color: var(--white); border: 0; border-radius: 6px; padding: 9px 18px; cursor: pointer; font-weight: 600; }
.ghost { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 14px; color: var(--ink); text-decoration: none; display: inline-block; }
button:disabled { opacity: .55; cursor: wait; }
.errore { color: var(--ko); font-weight: 600; margin: 8px 0 0; min-height: 1em; }

.invite { border: 1px solid #E6CF9A; background: #FBF5E6; border-radius: 8px; padding: 16px 18px; max-width: 60ch; }
.invite-t { font-family: var(--serif); font-weight: 600; font-size: 20px; margin-bottom: 4px; }
.invite p { margin: 6px 0 0; color: var(--ink-2); }

/* ------------------------------------------------ barra in basso (al posto della timeline dell'atlante) */
.timeline { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px;
  background: var(--white); border-top: 1px solid var(--line); height: 76px; padding: 0 20px 0 376px; }
.tbar-track { height: 8px; border-radius: 4px; background: #E8ECEC; overflow: hidden; }
.tbar-fill { height: 100%; width: 100%; background: var(--deep); transition: width .25s linear; }
.tbar-fill[data-livello="warn"] { background: var(--saffron); }
.tbar-fill[data-livello="ko"] { background: var(--ko); }
.tbar-lab { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.bar-actions { display: flex; gap: 10px; }
.ia { background: var(--white); color: var(--ink); border: 2px solid var(--saffron); border-radius: 6px; padding: 7px 16px; cursor: pointer; font-weight: 600; }
.ia:hover { background: #FBF5E6; }

/* ------------------------------------------------ loading */
.loading { position: fixed; inset: 0; background: var(--paper); display: grid; place-items: center; z-index: 50; }
.loading-box { display: grid; gap: 12px; justify-items: center; color: var(--ink-2); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--deep); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .tbar-fill { transition: none; } }

@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { grid-template-columns: 1fr auto; padding: 8px 12px; gap: 8px; height: auto; }
  .where { display: none; }
  .layout { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .sheet { padding: 20px 16px 32px; }
  .due { grid-template-columns: 1fr; }
  .timeline { padding: 10px 12px; height: auto; grid-template-columns: 1fr; gap: 10px; }
}

/* ------------------------------------------------ login Google */
.login { max-width: 520px; }
#gBtn { margin-top: 18px; min-height: 44px; }
.group .ghost#esciBtn { font-size: 13.5px; }
