/*
 * syncme: foglio di stile dell'applicazione e delle pagine di accesso (docs/INTERFACCIA.md).
 * Lo usano l'interfaccia React (frontend/index.html) e le pagine di django-allauth
 * (backend/templates/allauth/layouts/base.html). Solo tema chiaro.
 */

/* --- Variabili --------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Neutri, tendenti al freddo. In commento l'equivalente esadecimale. */
  --bg: oklch(97.6% 0.003 265); /* #F6F7F9 */
  --surface: oklch(99.4% 0.001 286); /* #FDFDFE */
  --line: oklch(92.4% 0.008 261); /* #E3E6EB */
  --line-strong: oklch(88.4% 0.011 262); /* #D5D9E0 */
  --hover: oklch(94.9% 0.006 265); /* #ECEEF2 */
  --selected: oklch(93.4% 0.012 262);
  --ink: oklch(26.9% 0.014 267); /* #23262D */
  --ink-soft: oklch(36.8% 0.022 267); /* #3A3F4B */
  --muted: oklch(50.2% 0.020 264); /* #5E6470 */
  --paused: oklch(63.9% 0.018 263); /* #868C97 */
  --panel-text: oklch(84.8% 0.013 267); /* #C9CDD6 */

  /* Stato. */
  --ok: oklch(53.2% 0.094 162); /* #2F7D5B */
  --attention: oklch(45.7% 0.096 67); /* #7A4B0A */
  --attention-bg: oklch(95.3% 0.030 90); /* #F7EFD9 */
  --attention-line: oklch(87.0% 0.062 90); /* #E4D3A6 */
  --danger: oklch(50.1% 0.178 29); /* #B3261E */
  --danger-bg: oklch(95.7% 0.015 22); /* #FBEDEC */

  /* Calendari: otto tinte di luminosità simile, almeno 3:1 sul fondo. */
  --cal-0: oklch(59.1% 0.157 259); /* #3F7BD9 */
  --cal-1: oklch(64.0% 0.135 57); /* #C8742A */
  --cal-2: oklch(61.1% 0.093 192); /* #2B9592 */
  --cal-3: oklch(62.1% 0.122 125); /* #75933A */
  --cal-4: oklch(59.1% 0.165 297); /* #8A63D2 */
  --cal-5: oklch(62.3% 0.156 2); /* #D0587F */
  --cal-6: oklch(62.0% 0.117 85); /* #A6801F */
  --cal-7: oklch(59.9% 0.018 263); /* #7A808B */

  /* Caratteri, spazi, forme. */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --radius-control: 10px;
  --radius-chip: 12px;
  --radius-surface: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* La mappa delle regole: colonne e altezza delle righe. */
  --src-w: 13rem;
  --dst-w: 15rem;
  --status-w: 13.5rem;
  --chevron-w: 1.25rem;
  --col-gap: 1rem;
  --row-h: 52px;
  --row-pad: 0.5rem;
  --curve: 0.875rem;
}

[data-color="0"] { --cal: var(--cal-0); }
[data-color="1"] { --cal: var(--cal-1); }
[data-color="2"] { --cal: var(--cal-2); }
[data-color="3"] { --cal: var(--cal-3); }
[data-color="4"] { --cal: var(--cal-4); }
[data-color="5"] { --cal: var(--cal-5); }
[data-color="6"] { --cal: var(--cal-6); }
[data-color="7"] { --cal: var(--cal-7); }

/* --- Base -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--ink);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink-soft);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* --- Pulsanti e campi ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}

.btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.btn.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.btn.primary:hover {
  border-color: var(--ink-soft);
  background: var(--ink-soft);
  color: var(--bg);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--surface);
  font-weight: 600;
}

.btn.danger:hover {
  background: oklch(44% 0.17 29);
}

.btn.quiet {
  border-color: transparent;
  color: var(--muted);
}

.btn.quiet:hover {
  color: var(--ink);
}

.btn.quiet.danger-text {
  color: var(--danger);
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
}

.btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.btn:disabled:hover {
  background: transparent;
}

.btn.primary:disabled:hover {
  background: var(--ink);
}

.btn[aria-busy="true"] {
  opacity: 1;
}

.btn[aria-busy="true"]::after {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.link:hover {
  text-decoration-color: currentColor;
}

.link.muted {
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

select,
input[type="text"] {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
}

select {
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%235E6470' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

select:hover,
input[type="text"]:hover {
  border-color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.check:has(input:disabled) {
  color: var(--muted);
  cursor: default;
}

/* --- Intestazione e pagina -------------------------------------------------------- */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 32px;
}

.topbar .page {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand img {
  width: 28px;
  height: 28px;
}

.whoami {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  font-size: 14px;
  color: var(--muted);
}

.whoami a {
  font-weight: 500;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding-top: 32px;
  padding-bottom: 72px;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.notice.problem {
  border-color: var(--attention-line);
  background: var(--attention-bg);
  color: var(--attention);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--hover);
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  padding-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

/* --- Titolo e stato --------------------------------------------------------------- */

.overview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}

.overview h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.overview p {
  margin-top: 6px;
  font-size: 16px;
  color: var(--muted);
}

.overview p.attention {
  color: var(--attention);
}

/* --- La mappa delle regole -------------------------------------------------------- */

.map {
  padding: 20px 22px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
}

/* L'intestazione ha la stessa struttura di una riga, così le colonne coincidono. */
.map-head,
.map-head .rule-main {
  min-height: 0;
}

.map-head .rule-main {
  padding-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: default;
}

.map-head .head-src {
  justify-self: end;
}

.map-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 12px;
  padding: 0 var(--row-pad) 8px;
  color: var(--muted);
}

.group + .group {
  margin-top: 14px;
}

.group-rows {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Il tronco comune delle regole con la stessa sorgente: dalla prima linea all'ultima curva. */
.group-rows.branched::before {
  content: "";
  position: absolute;
  top: calc(var(--row-h) / 2);
  bottom: calc(var(--row-h) / 2 + var(--curve));
  left: calc(var(--row-pad) + var(--src-w) + var(--col-gap) + 0.75rem);
  border-left: 1.5px solid var(--cal);
  pointer-events: none;
}

.rule {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--status-w) var(--chevron-w);
  align-items: center;
  column-gap: var(--col-gap);
  min-height: var(--row-h);
  padding-right: var(--row-pad);
  border-radius: var(--radius-chip);
  transition: background-color 150ms var(--ease);
}

/* Solo le righe vere: intestazione e righe in caricamento non hanno un pulsante. */
.rule:not(.selected):has(> button.rule-main:hover) {
  background: var(--hover);
}

.rule.selected {
  background: var(--selected);
}

/* Tutta la riga apre la regola: la superficie del pulsante si stende sull'intera riga,
   stato e freccia compresi. "Riprendi" resta sopra e conserva il suo clic. */
.rule-main::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-chip);
}

.rule-main:focus-visible {
  outline: none;
}

.rule-main:focus-visible::after {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.rule-status .btn {
  position: relative;
  z-index: 1;
}

/* Il segno che la riga si apre: verso destra, verso il basso quando è aperta. */
.disclosure {
  justify-self: end;
  color: var(--muted);
  transition:
    transform 200ms var(--ease),
    color 150ms var(--ease);
}

.rule:has(> button.rule-main:hover) .disclosure,
.rule.selected .disclosure {
  color: var(--ink);
}

.rule.selected .disclosure {
  transform: rotate(90deg);
}

.rule-main {
  display: grid;
  grid-template-columns: var(--src-w) minmax(7rem, 1fr) var(--dst-w);
  align-items: center;
  column-gap: var(--col-gap);
  min-height: var(--row-h);
  padding: 0 var(--row-pad);
  border: 0;
  border-radius: var(--radius-chip);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

/* La sorgente sta accanto alla sua linea. */
.rule-main .src {
  justify-self: end;
}

.rule.branch .src {
  visibility: hidden;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  max-width: 100%;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-chip);
  background: var(--surface);
  white-space: nowrap;
}

.chip .dot {
  background: var(--cal);
}

.chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip strong {
  font-weight: 600;
}

.chip .secondary {
  margin-left: 6px;
  color: var(--muted);
}

.dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cal, var(--muted));
}

.wire {
  display: flex;
  align-items: center;
  min-width: 0;
  height: var(--row-h);
  color: var(--cal);
}

.rule.branch .wire {
  padding-left: 0.75rem;
}

.rule.branch .wire::before {
  content: "";
  flex: none;
  width: var(--curve);
  height: var(--curve);
  border-bottom: 1.5px solid var(--cal);
  border-left: 1.5px solid var(--cal);
  border-bottom-left-radius: 0.75rem;
  transform: translateY(calc(-50% + 0.75px));
}

.line {
  flex: 1 1 0;
  min-width: 8px;
  height: 0;
  border-top: 1.5px solid var(--cal);
}

.arrow {
  flex: none;
  width: 12px;
  height: 12px;
  margin-left: -1px;
  fill: var(--cal);
}

.pill {
  flex: none;
  margin: 0 8px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.rule.paused .line {
  border-top-style: dashed;
  border-top-color: var(--paused);
}

.rule.paused .arrow {
  fill: var(--paused);
}

.rule.paused .chip {
  color: var(--muted);
}

.rule-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.state .dot {
  width: 8px;
  height: 8px;
}

.state.ok .dot {
  background: var(--ok);
}

.state.first .dot {
  background: var(--paused);
}

.state.attention {
  color: var(--attention);
  font-weight: 500;
}

.map-add {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.map-add .btn {
  margin-left: -8px;
  color: var(--ink);
  font-weight: 600;
}

.map-empty {
  padding: 4px var(--row-pad) 12px;
  color: var(--muted);
}

/* Righe in attesa di dati. */
.skeleton .rule-main {
  cursor: default;
}

.skeleton .chip,
.skeleton .pill {
  width: 8rem;
  height: 34px;
  border-color: transparent;
  background: var(--hover);
}

.skeleton .pill {
  width: 5rem;
  height: 22px;
}

.skeleton .line {
  border-top: 1.5px solid var(--line);
}

/* --- Modifica e nuova regola ------------------------------------------------------ */

.editor,
.composer {
  margin: 8px 0 4px;
  padding: 20px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
}

.editor:focus {
  outline: none;
}

.editor:focus-visible {
  outline: 2px solid var(--ink);
}

.editor h3 {
  font-size: 16px;
  font-weight: 650;
}

.editor > * + * {
  margin-top: 16px;
}

.editor form > .actions {
  margin-top: 18px;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 14px 24px;
}

.options .checks {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 0 24px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.actions.split {
  justify-content: space-between;
}

.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  background: var(--attention-bg);
  color: var(--attention);
}

.callout.danger {
  background: var(--danger-bg);
  color: var(--ink);
}

.callout p {
  flex: 1 1 18rem;
}

.composer-row {
  display: grid;
  grid-template-columns: var(--src-w) minmax(7rem, 1fr) var(--dst-w) auto;
  align-items: center;
  column-gap: var(--col-gap);
}

.composer-row select {
  width: 100%;
  font-weight: 600;
}

.composer .wire {
  color: var(--ink);
}

.composer .line {
  border-top: 1.5px solid var(--ink);
}

.composer .arrow {
  fill: var(--ink);
}

.composer .wire select {
  flex: none;
  width: auto;
  min-height: 36px;
  margin: 0 8px;
  padding: 4px 30px 4px 12px;
  border-radius: 999px;
  background-color: var(--bg);
  font-size: 13px;
  font-weight: 500;
}

.composer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 20px;
  margin-top: 10px;
}

.composer-foot .actions {
  gap: 4px 20px;
}

.composer-more {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* --- Calendari, benvenuto, attività ---------------------------------------------- */

.accounts > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  border-top: 1px solid var(--line);
}

.account-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  min-height: 52px;
  margin-left: -10px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.account-main:hover {
  background: var(--hover);
}

.account-main[aria-pressed="true"] {
  background: var(--selected);
}

.account-main strong {
  font-weight: 600;
}

.account-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 12px;
  color: var(--muted);
}

.account-cals {
  grid-column: 1 / -1;
  padding: 0 0 12px 22px;
}

.account-remove {
  grid-column: 1 / -1;
  margin-bottom: 14px;
}

.welcome,
.need-second {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 36rem;
}

.welcome h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.welcome p,
.need-second p {
  font-size: 16px;
  color: var(--muted);
}

.need-second {
  max-width: none;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
}

.activity ul {
  display: flex;
  flex-direction: column;
}

.activity li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.activity time {
  flex: 0 0 9.5rem;
  color: var(--muted);
}

.activity .what {
  flex: 1 1 22rem;
  min-width: 0;
}

.activity .tag {
  color: var(--muted);
  font-size: 13px;
}

.activity .problem {
  color: var(--attention);
}

.page-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.leave {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 40rem;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-surface);
  background: var(--surface);
}

.leave form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-message {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 36rem;
  padding-top: 80px;
}

/* --- Pagine di accesso ------------------------------------------------------------ */

.access {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

.access-brand {
  display: flex;
  flex: 1 1 480px;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--ink);
  color: var(--bg);
}

.access-brand-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 420px;
}

.access-logo {
  width: 64px;
  height: 64px;
}

.access-name {
  font-size: 64px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.access-tagline {
  max-width: 26ch;
  font-size: 22px;
  line-height: 1.4;
  color: var(--panel-text);
}

.access-side {
  display: flex;
  flex: 1 1 480px;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.access-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 380px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
}

.access-card h1 {
  font-size: 18px;
  font-weight: 650;
}

.access-card p {
  color: var(--muted);
}

.access-card .note {
  font-size: 13px;
}

.access-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* I pulsanti di allauth (uscita, conferme) prendono l'aspetto dei nostri. */
.access-card form button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
}

.access-card form button:hover {
  background: var(--ink-soft);
}

.access-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.providers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/*
 * "Sign in with Google" secondo le linee guida di Google
 * (https://developers.google.com/identity/branding-guidelines): tema chiaro, riempimento
 * #FFFFFF, bordo #747775 di 1px, testo #1F1F1F, logo G a colori, 12px prima del logo, 10px
 * fra logo e testo, 12px dopo il testo. Il carattere è Google Sans, dove c'è.
 */
.gsi-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #747775;
  border-radius: var(--radius-control);
  background: #ffffff;
  color: #1f1f1f;
  font-family: "Google Sans", Roboto, var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  transition: background-color 150ms var(--ease);
}

.gsi-button:hover {
  background: #f2f2f2;
  color: #1f1f1f;
}

.gsi-button svg {
  flex: none;
  width: 18px;
  height: 18px;
}

/*
 * "Sign in with Microsoft" secondo le linee guida di Microsoft: sfondo #FFFFFF, bordo
 * #8C8C8C, testo #5E5E5E in Segoe UI semibold, logo a quattro quadrati.
 */
.msft-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #8c8c8c;
  border-radius: var(--radius-control);
  background: #ffffff;
  color: #5e5e5e;
  font-family: "Segoe UI", var(--font);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.msft-button:hover {
  background: #f2f2f2;
  color: #5e5e5e;
}

.msft-button svg {
  flex: none;
  width: 18px;
  height: 18px;
}

/* --- Schermi stretti -------------------------------------------------------------- */

@media (max-width: 720px) {
  .page {
    padding: 0 16px;
  }

  .workspace {
    gap: 44px;
    padding-top: 16px;
  }

  .overview h1,
  .welcome h1 {
    font-size: 26px;
  }

  .map {
    padding: 12px 12px 8px;
  }

  .map-head,
  .group-rows.branched::before,
  .rule.branch .wire::before,
  .line {
    display: none;
  }

  /* Righe divise da un filo: senza angoli arrotondati il filo resta dritto. */
  .rule,
  .rule-main::after {
    border-radius: 0;
  }

  .rule {
    grid-template-columns: minmax(0, 1fr) var(--chevron-w);
    padding: 6px var(--row-pad) 10px 0;
  }

  .rule-main,
  .rule-status {
    grid-column: 1;
  }

  .disclosure {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .group + .group,
  .rule + .rule {
    border-top: 1px solid var(--line);
  }

  .group + .group {
    margin-top: 0;
  }

  .rule-main {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2px;
    padding: 6px var(--row-pad);
  }

  .rule.branch .src {
    visibility: visible;
  }

  .rule-main .src {
    justify-self: start;
  }

  .rule.branch .wire,
  .wire {
    height: 30px;
    padding-left: 14px;
  }

  .arrow {
    order: -1;
    margin: 0;
    transform: rotate(90deg);
  }

  .rule-status {
    justify-content: flex-start;
    padding: 0 var(--row-pad);
    white-space: normal;
  }

  .composer-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .composer .wire select {
    margin-left: 0;
  }

  .accounts > li {
    grid-template-columns: 1fr;
  }

  .account-cals {
    order: 2;
    padding-bottom: 4px;
  }

  .account-side {
    order: 3;
    justify-content: flex-start;
    padding-bottom: 8px;
  }

  .account-remove {
    order: 4;
  }

  .access {
    align-content: flex-start;
  }

  .access-brand {
    flex-basis: 100%;
    padding: 18px 24px;
  }

  .access-brand-inner {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .access-logo {
    width: 36px;
    height: 36px;
  }

  .access-name {
    font-size: 32px;
  }

  .access-tagline {
    display: none;
  }

  .access-side {
    align-items: flex-start;
    padding: 32px 16px;
  }
}
