/* =====================================================================
   Timely — stile
   Temi via [data-theme], tutti i colori sono token semantici.
   ===================================================================== */

:root {
  --font-sans: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', ui-monospace, 'Cascadia Code', monospace;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --topbar-h: 68px;
  --chat-w: 380px;
  color-scheme: dark;
}

/* ---------- TEMI ---------- */
[data-theme='dark'] {
  --bg: #0b0d17; --bg-grad-1: #1b1440; --bg-grad-2: #062a33;
  --surface: #131726; --surface-2: #1a1f33; --surface-3: #232a44;
  --border: #262d48; --text: #eceffd; --text-2: #a3abcf; --text-3: #6f78a3;
  --accent: #7c5cff; --accent-2: #22d3ee; --on-accent: #ffffff;
  --break: #22d3ee; --lunch: #f59e0b; --work: #7c5cff; --danger: #f87171;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f6fb; --bg-grad-1: #e3dcff; --bg-grad-2: #d4f3fa;
  --surface: #ffffff; --surface-2: #f1f2f9; --surface-3: #e6e8f3;
  --border: #dfe2ef; --text: #141729; --text-2: #4b5170; --text-3: #6e7491;
  --accent: #5b3df5; --accent-2: #0891b2; --on-accent: #ffffff;
  --break: #0891b2; --lunch: #c2410c; --work: #5b3df5; --danger: #dc2626;
  --shadow: 0 20px 50px -24px rgb(30 30 80 / 0.25);
}
[data-theme='midnight'] {
  --bg: #000000; --bg-grad-1: #0c0c0c; --bg-grad-2: #0a1200;
  --surface: #0b0b0c; --surface-2: #141416; --surface-3: #1e1e21;
  --border: #232326; --text: #fafafa; --text-2: #a1a1aa; --text-3: #71717a;
  --accent: #e4e4e7; --accent-2: #a3e635; --on-accent: #000000;
  --break: #a3e635; --lunch: #facc15; --work: #e4e4e7; --danger: #f87171;
  --shadow: 0 0 0 1px #1e1e21;
}
[data-theme='aurora'] {
  --bg: #061418; --bg-grad-1: #0b3a33; --bg-grad-2: #2a1650;
  --surface: #0c1f25; --surface-2: #11292f; --surface-3: #18363d;
  --border: #1d3d44; --text: #e6fbf6; --text-2: #9cc7be; --text-3: #6a948b;
  --accent: #34d399; --accent-2: #a78bfa; --on-accent: #032b1e;
  --break: #a78bfa; --lunch: #fbbf24; --work: #34d399; --danger: #fb7185;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
}
[data-theme='sunset'] {
  --bg: #170b12; --bg-grad-1: #4a1330; --bg-grad-2: #4a2a06;
  --surface: #1f1119; --surface-2: #2a1622; --surface-3: #361c2c;
  --border: #3d2232; --text: #fff1f4; --text-2: #e0aebd; --text-3: #a57787;
  --accent: #fb7185; --accent-2: #fbbf24; --on-accent: #2a0711;
  --break: #fbbf24; --lunch: #fb923c; --work: #fb7185; --danger: #f87171;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
}
[data-theme='forest'] {
  --bg: #0b1510; --bg-grad-1: #123321; --bg-grad-2: #2c2a07;
  --surface: #101e17; --surface-2: #15281e; --surface-3: #1c3427;
  --border: #22392c; --text: #ecfbf0; --text-2: #a5c9b0; --text-3: #6f947a;
  --accent: #4ade80; --accent-2: #facc15; --on-accent: #052e16;
  --break: #facc15; --lunch: #fb923c; --work: #4ade80; --danger: #f87171;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
}
[data-theme='neon'] {
  --bg: #07040f; --bg-grad-1: #3b0a4a; --bg-grad-2: #00303a;
  --surface: #0f0a1d; --surface-2: #170f2b; --surface-3: #21163b;
  --border: #2f1f52; --text: #f8f0ff; --text-2: #c3a8e6; --text-3: #8c74b0;
  --accent: #ff2bd6; --accent-2: #00f0ff; --on-accent: #12001a;
  --break: #00f0ff; --lunch: #fff34d; --work: #ff2bd6; --danger: #ff5c7a;
  --shadow: 0 0 40px -10px rgb(255 43 214 / 0.35);
  --glow: 0 0 24px rgb(255 43 214 / 0.55), 0 0 60px rgb(0 240 255 / 0.25);
}
[data-theme='paper'] {
  color-scheme: light;
  --bg: #f4ecd8; --bg-grad-1: #efdcb4; --bg-grad-2: #dfe9d9;
  --surface: #fbf6e9; --surface-2: #f2e9d3; --surface-3: #e9dcbd;
  --border: #e1d2ae; --text: #33281a; --text-2: #5e4d36; --text-3: #7d6a4f;
  --accent: #b45309; --accent-2: #0f766e; --on-accent: #ffffff;
  --break: #0f766e; --lunch: #9a3412; --work: #b45309; --danger: #b91c1c;
  --shadow: 0 18px 40px -22px rgb(80 50 10 / 0.35);
}
[data-theme='ocean'] {
  color-scheme: light;
  --bg: #eaf4fb; --bg-grad-1: #c9e6fb; --bg-grad-2: #c8f1e9;
  --surface: #ffffff; --surface-2: #eef6fc; --surface-3: #dceaf5;
  --border: #d0e2f0; --text: #0c2233; --text-2: #3c5a70; --text-3: #5f7a8e;
  --accent: #0369a1; --accent-2: #0d9488; --on-accent: #ffffff;
  --break: #0d9488; --lunch: #c2410c; --work: #0369a1; --danger: #dc2626;
  --shadow: 0 20px 50px -24px rgb(10 60 100 / 0.3);
}

[data-theme='arctic'] {
  --bg: #1e2430; --bg-grad-1: #2b3a52; --bg-grad-2: #23392f;
  --surface: #262d3b; --surface-2: #2e3647; --surface-3: #3a4357;
  --border: #3b4558; --text: #eceff4; --text-2: #c2c9d6; --text-3: #8b95a8;
  --accent: #88c0d0; --accent-2: #a3be8c; --on-accent: #13202b;
  --break: #a3be8c; --lunch: #ebcb8b; --work: #88c0d0; --danger: #bf616a;
  --shadow: 0 20px 50px -20px rgb(0 0 0 / 0.5);
}
[data-theme='amethyst'] {
  --bg: #16141f; --bg-grad-1: #3a1f5c; --bg-grad-2: #4a1838;
  --surface: #1f1c2c; --surface-2: #282438; --surface-3: #332e47;
  --border: #39334f; --text: #f5f0ff; --text-2: #c9bfe0; --text-3: #8f84ab;
  --accent: #c084fc; --accent-2: #f472b6; --on-accent: #1d0a2e;
  --break: #f472b6; --lunch: #fbbf24; --work: #c084fc; --danger: #fb7185;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
}
[data-theme='coffee'] {
  --bg: #17110e; --bg-grad-1: #3a2418; --bg-grad-2: #2c2410;
  --surface: #201813; --surface-2: #2a201a; --surface-3: #362a21;
  --border: #3d3026; --text: #f7ede2; --text-2: #d6c1aa; --text-3: #9c856d;
  --accent: #d4a373; --accent-2: #e9c46a; --on-accent: #2a1a0c;
  --break: #e9c46a; --lunch: #f4845f; --work: #d4a373; --danger: #ef6f6c;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
}
[data-theme='sakura'] {
  color-scheme: light;
  --bg: #fdf2f5; --bg-grad-1: #fbd3e0; --bg-grad-2: #e6dcff;
  --surface: #ffffff; --surface-2: #fbeef2; --surface-3: #f5dde5;
  --border: #f0d3dd; --text: #3b1426; --text-2: #6e4658; --text-3: #8f6a7a;
  --accent: #db2777; --accent-2: #7c3aed; --on-accent: #ffffff;
  --break: #7c3aed; --lunch: #c2410c; --work: #db2777; --danger: #be123c;
  --shadow: 0 20px 50px -24px rgb(120 20 70 / 0.25);
}
[data-theme='terminal'] {
  --bg: #020703; --bg-grad-1: #062b10; --bg-grad-2: #0d1f02;
  --surface: #061109; --surface-2: #0a1a0e; --surface-3: #0f2614;
  --border: #12391b; --text: #c8ffd4; --text-2: #7fe39a; --text-3: #4fa465;
  --accent: #33ff66; --accent-2: #b4ff3a; --on-accent: #001a07;
  --break: #b4ff3a; --lunch: #ffd23a; --work: #33ff66; --danger: #ff5f56;
  --shadow: 0 0 30px -12px rgb(51 255 102 / 0.35);
  --glow: 0 0 18px rgb(51 255 102 / 0.45);
  --font-sans: 'Fira Code', ui-monospace, monospace;
}
[data-theme='cyber'] {
  --bg: #0d0d0d; --bg-grad-1: #2e2a00; --bg-grad-2: #002a33;
  --surface: #151515; --surface-2: #1d1d1d; --surface-3: #282828;
  --border: #333; --text: #fafafa; --text-2: #c7c7c7; --text-3: #8a8a8a;
  --accent: #fde047; --accent-2: #22d3ee; --on-accent: #111;
  --break: #22d3ee; --lunch: #fb923c; --work: #fde047; --danger: #f43f5e;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.7);
  --glow: 0 0 22px rgb(253 224 71 / 0.4);
}
[data-theme='lavender'] {
  color-scheme: light;
  --bg: #f4f2fb; --bg-grad-1: #e2d9ff; --bg-grad-2: #fde2f0;
  --surface: #ffffff; --surface-2: #f1eefa; --surface-3: #e5e0f5;
  --border: #ddd6f0; --text: #1f1638; --text-2: #4d4270; --text-3: #6f6790;
  --accent: #7c3aed; --accent-2: #db2777; --on-accent: #ffffff;
  --break: #db2777; --lunch: #c2410c; --work: #7c3aed; --danger: #dc2626;
  --shadow: 0 20px 50px -24px rgb(60 30 120 / 0.25);
}
[data-theme='mint'] {
  color-scheme: light;
  --bg: #effaf5; --bg-grad-1: #c9f2df; --bg-grad-2: #d3ecfb;
  --surface: #ffffff; --surface-2: #ecf7f1; --surface-3: #d9eee3;
  --border: #cfe7da; --text: #0b2a1e; --text-2: #3b5e50; --text-3: #5c7a6d;
  --accent: #059669; --accent-2: #0284c7; --on-accent: #ffffff;
  --break: #0284c7; --lunch: #c2410c; --work: #059669; --danger: #dc2626;
  --shadow: 0 20px 50px -24px rgb(10 80 50 / 0.25);
}
[data-theme='contrast'] {
  --bg: #000000; --bg-grad-1: #000000; --bg-grad-2: #000000;
  --surface: #000000; --surface-2: #0d0d0d; --surface-3: #1f1f1f;
  --border: #ffffff; --text: #ffffff; --text-2: #ffffff; --text-3: #e5e5e5;
  --accent: #ffff00; --accent-2: #00ffff; --on-accent: #000000;
  --break: #00ffff; --lunch: #ff9900; --work: #ffff00; --danger: #ff4d4d;
  --shadow: none;
}
[data-theme='sakura'], [data-theme='lavender'], [data-theme='mint'] { --picker-filter: none; }

/* ---------- BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, var(--bg-grad-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- BOTTONI & FORM ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; letter-spacing: -0.01em;
  transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 55%, var(--accent-2)));
  box-shadow: 0 10px 30px -10px color-mix(in oklab, var(--accent) 70%, transparent), var(--glow, 0 0 0 transparent);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px color-mix(in oklab, var(--accent) 85%, transparent), var(--glow, 0 0 0 transparent); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0 24px; }
.btn-sm { min-height: 38px; font-size: 0.9rem; padding: 0 14px; }
.btn-block { width: 100%; }
.btn.is-loading .btn-label::after { content: '…'; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--text-2);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.on { color: var(--accent-2); background: color-mix(in oklab, var(--accent-2) 14%, transparent); }
.icon-btn-sm { width: 36px; height: 36px; }

input[type='text'], input[type='email'], input[type='time'], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent); }
input:disabled { opacity: 0.45; }
input[aria-invalid='true'] { border-color: var(--danger); }
input[type='time'] { font-family: var(--font-mono); width: auto; min-width: 110px; }
input[type='time']::-webkit-calendar-picker-indicator { filter: var(--picker-filter, invert(0.7)); cursor: pointer; }
[data-theme='light'], [data-theme='paper'], [data-theme='ocean'] { --picker-filter: none; }
.field { display: grid; gap: 6px; }
.field-inline { grid-template-columns: 1fr auto; align-items: center; }
.field-inline select { width: auto; }
.field-label { font-size: 0.875rem; font-weight: 500; color: var(--text-2); }
.field-error { min-height: 1.25em; font-size: 0.875rem; color: var(--danger); }
.hint { font-size: 0.875rem; color: var(--text-2); }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); transition: background 0.2s; flex-shrink: 0; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: transform 0.25s var(--ease-spring), background 0.2s; }
.switch input:checked + .switch-ui { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--on-accent); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- BRAND / AVATAR ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.04em; font-size: 1.35rem; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--glow, 0 6px 20px -6px color-mix(in oklab, var(--accent) 70%, transparent)); }
.brand-mark svg { width: 20px; height: 20px; stroke-width: 2.4; }
.brand-lg { font-size: 1.8rem; }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 14px; }

.avatar {
  --h: 250;
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 0.85rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 55%), hsl(calc(var(--h) + 40) 70% 45%));
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-btn { padding: 4px; border: 0; background: none; border-radius: 50%; min-width: 44px; min-height: 44px; display: grid; place-items: center; }

/* ======================= LOGIN ======================= */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-bg span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55; animation: float 18s ease-in-out infinite alternate; }
.login-bg span:nth-child(1) { width: 420px; height: 420px; background: var(--accent); top: -120px; left: -80px; }
.login-bg span:nth-child(2) { width: 360px; height: 360px; background: var(--accent-2); bottom: -120px; right: -60px; animation-delay: -6s; }
.login-bg span:nth-child(3) { width: 260px; height: 260px; background: var(--lunch); top: 40%; left: 55%; opacity: 0.25; animation-delay: -12s; }
@keyframes float { to { transform: translate(60px, 40px) scale(1.15); } }
.login-card {
  position: relative; width: min(440px, 100%); padding: 40px 36px;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow);
  display: grid; gap: 18px;
  animation: rise 0.6s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.login-title { font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.1; letter-spacing: -0.04em; font-weight: 800; margin-top: 10px; }
.login-sub { color: var(--text-2); }
.login-form { display: grid; gap: 8px; margin-top: 6px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.input-icon input { padding-left: 44px; min-height: 52px; font-size: 1.05rem; }
.login-sent { display: grid; gap: 10px; justify-items: start; }
.login-sent h2 { font-size: 1.4rem; letter-spacing: -0.02em; }
.sent-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: var(--accent-2); background: color-mix(in oklab, var(--accent-2) 15%, transparent); }
.sent-icon svg { width: 26px; height: 26px; }

/* ======================= APP ======================= */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h); padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.topbar-clock { margin: 0 auto; display: flex; align-items: baseline; gap: 10px; font-size: 0.95rem; }
.topbar-clock .mono { font-weight: 600; }
#now-date { text-transform: capitalize; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.chat-toggle { display: none; }
.badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 0.7rem; font-weight: 700; line-height: 18px; color: #fff; background: var(--danger); }

.popover {
  position: absolute; top: calc(var(--topbar-h) - 6px); right: 16px; z-index: 30;
  padding: 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: pop 0.2s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.popover-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 4px 10px; }
.theme-menu { width: 460px; right: 120px; max-height: calc(100dvh - var(--topbar-h) - 16px); overflow-y: auto; }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.theme-opt { padding: 8px 4px; gap: 6px; font-size: 0.78rem; }
.theme-opt { display: grid; gap: 8px; justify-items: center; padding: 10px 6px; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2); color: var(--text); font-size: 0.85rem; font-weight: 500; transition: border-color 0.2s, transform 0.15s; }
.theme-opt:hover { transform: translateY(-2px); }
.theme-opt[aria-checked='true'] { border-color: var(--accent); }
.theme-swatch { display: flex; }
.theme-swatch i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface-2); margin-left: -6px; }
.theme-swatch i:first-child { margin-left: 0; box-shadow: inset 0 0 0 1px rgb(128 128 128 / 0.35); }

.layout { flex: 1; display: grid; grid-template-columns: 1fr var(--chat-w); min-height: 0; }

/* ---------- STAGE (timer) ---------- */
.stage { --ring: min(500px, 88vw); display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 32px 24px 40px; min-width: 0; }

.phase-pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px;
  border-radius: 99px; font-weight: 600; font-size: 0.95rem;
  background: color-mix(in oklab, var(--phase-color) 14%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--phase-color) 35%, transparent);
  color: var(--text);
  animation: rise 0.5s var(--ease) both;
}
.phase-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--phase-color); box-shadow: 0 0 0 0 var(--phase-color); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--phase-color) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

body { --phase-color: var(--work); }
body[data-phase='break'] { --phase-color: var(--break); }
body[data-phase='before'], body[data-phase='after'], body[data-phase='off'] { --phase-color: var(--text-3); }

.ring-wrap { position: relative; width: var(--ring); aspect-ratio: 1; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring stop:first-child { stop-color: var(--accent); }
.ring stop:last-child { stop-color: var(--accent-2); }
body[data-phase='break'] .ring stop:first-child { stop-color: var(--break); }
body[data-phase='break'] .ring stop:last-child { stop-color: var(--accent); }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 14; opacity: 0.7; }
.ring-ticks { fill: none; stroke: var(--border); stroke-width: 6; stroke-dasharray: 1.5 17.98; opacity: 0.9; }
.ring-progress {
  fill: none; stroke: url(#ring-grad); stroke-width: 14; stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 14px color-mix(in oklab, var(--accent) 55%, transparent));
}
.ring-progress.idle { opacity: 0; }
.ring-center { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 0 12%; }
.phase-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: var(--phase-color); background: color-mix(in oklab, var(--phase-color) 14%, transparent); margin-bottom: 4px; }
.phase-icon svg { width: 26px; height: 26px; }
.countdown {
  font-weight: 700; line-height: 1;
  letter-spacing: -0.05em; color: var(--text);
  text-shadow: var(--glow, none);
}
.target-label { font-size: clamp(1rem, 2.4vw, 1.25rem); font-weight: 500; color: var(--text-2); }
.target-time { font-size: 0.9rem; color: var(--text-3); padding: 4px 12px; border-radius: 99px; background: var(--surface-2); }

body.urgent .countdown { color: var(--phase-color); animation: heartbeat 1s var(--ease) infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.04); } }

/* ---------- TIMELINE ---------- */
.timeline-card, .stat { background: color-mix(in oklab, var(--surface) 85%, transparent); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.timeline-card { width: min(860px, 100%); padding: 20px 22px 44px; }
.timeline-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.timeline-head h2 { font-size: 1rem; font-weight: 700; }
#day-percent { font-size: 0.85rem; }
.timeline { position: relative; display: flex; gap: 3px; height: 14px; }
.seg { position: relative; min-width: 4px; border-radius: 6px; overflow: hidden; background: color-mix(in oklab, var(--work) 18%, var(--surface-3)); }
.seg-break { background: color-mix(in oklab, var(--break) 28%, var(--surface-3)); }
.seg-lunch { background: color-mix(in oklab, var(--lunch) 30%, var(--surface-3)); }
.seg-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: var(--work); transition: transform 1s linear; }
.seg-break .seg-fill { background: var(--break); }
.seg-lunch .seg-fill { background: var(--lunch); }
.seg.active { box-shadow: 0 0 0 2px color-mix(in oklab, var(--phase-color) 50%, transparent); }
.now-marker { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: var(--text); box-shadow: 0 0 10px var(--text); transition: left 1s linear; }
.timeline-labels { position: relative; height: 0; }
.tl-label { position: absolute; top: 10px; transform: translateX(-50%); display: grid; justify-items: center; font-size: 0.72rem; color: var(--text-3); white-space: nowrap; line-height: 1.3; }
.tl-label b { font-size: 0.78rem; color: var(--text-2); font-weight: 600; }
.tl-label.edge-start { transform: none; justify-items: start; }
.tl-label.edge-end { transform: translateX(-100%); justify-items: end; }
.tl-label.custom b { color: var(--lunch); }

/* ---------- STATS ---------- */
.stats { width: min(860px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, transparent); }
.stat-label { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }
.stat-value { font-weight: 700; font-size: 1.02rem; }

/* ======================= CHAT ======================= */
.chat {
  display: flex; flex-direction: column; min-height: 0;
  height: calc(100dvh - var(--topbar-h)); position: sticky; top: var(--topbar-h);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  border-left: 1px solid var(--border);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; }
.chat-head h2 { font-size: 1.05rem; font-weight: 700; }
.chat-head p { font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.chat-close { display: none; }

.online-list { list-style: none; margin: 0; padding: 4px 14px 12px; display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.online-user { display: grid; justify-items: center; gap: 2px; width: 72px; flex-shrink: 0; padding: 6px 2px; border-radius: 12px; text-align: center; }
.online-user .avatar { width: 40px; height: 40px; font-size: 0.85rem; }
.status-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--surface); background: var(--work); }
.status-break .status-dot { background: var(--break); }
.status-before .status-dot, .status-after .status-dot, .status-off .status-dot { background: var(--text-3); }
.online-name { font-size: 0.75rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-status { font-size: 0.66rem; color: var(--text-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-break .online-status { color: var(--break); }

.messages { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 2px; overflow-anchor: none; }
.empty { margin: auto; color: var(--text-3); font-size: 0.9rem; text-align: center; }
.day-sep { align-self: center; margin: 12px 0 8px; padding: 3px 12px; font-size: 0.72rem; font-weight: 600; color: var(--text-3); background: var(--surface-2); border-radius: 99px; text-transform: capitalize; }
.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; animation: msg-in 0.3s var(--ease) both; }
.msg.grouped { margin-top: 2px; padding-left: 40px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine.grouped { padding-left: 0; padding-right: 40px; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.bubble { max-width: 78%; padding: 8px 12px 6px; border-radius: 16px 16px 16px 6px; background: var(--surface-3); }
.msg.mine .bubble { border-radius: 16px 16px 6px 16px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 70%, var(--accent-2))); }
.msg.mine .bubble a { color: inherit; }
.msg-name { display: block; font-size: 0.75rem; font-weight: 700; color: var(--accent-2); margin-bottom: 1px; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 0.94rem; }
.msg-time { display: block; text-align: right; font-size: 0.66rem; opacity: 0.65; margin-top: 1px; }
.typing { min-height: 22px; padding: 0 18px; font-size: 0.78rem; color: var(--text-3); font-style: italic; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.composer textarea { resize: none; min-height: 46px; max-height: 140px; line-height: 1.4; padding: 12px 14px; border-radius: 14px; }
.send-btn { width: 46px; height: 46px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: 14px; }
.send-btn:hover { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); filter: brightness(1.1); }

.scrim { position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / 0.45); backdrop-filter: blur(2px); }

/* ======================= PROFILO ======================= */
.user-menu { width: 340px; max-width: calc(100vw - 24px); padding: 16px; display: grid; gap: 12px; }
.profile-head { display: flex; align-items: center; gap: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in oklab, var(--accent) 45%, transparent); }
.profile-who { min-width: 0; }
.user-menu-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-email { margin: 0; font-size: 0.82rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-days {
  padding: 14px 16px; border-radius: 16px;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(120% 120% at 100% 100%, color-mix(in oklab, var(--accent-2) 16%, transparent), transparent 60%),
    var(--surface-2);
  border: 1px solid color-mix(in oklab, var(--accent) 22%, var(--border));
}
.profile-days-top { display: flex; align-items: center; gap: 12px; }
.profile-days-n { font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.profile-days-label { display: grid; font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.profile-since { font-weight: 500; font-size: 0.78rem; color: var(--text-3); }
.profile-progress { height: 6px; margin-top: 12px; border-radius: 99px; background: color-mix(in oklab, var(--text) 10%, transparent); overflow: hidden; }
.profile-progress span { display: block; height: 100%; border-radius: inherit; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: transform 0.8s var(--ease); }
.profile-next { margin-top: 6px; font-size: 0.76rem; color: var(--text-3); }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.profile-stats div { display: grid; gap: 1px; padding: 10px 8px; border-radius: 12px; text-align: center; background: var(--surface-2); border: 1px solid var(--border); }
.profile-stats b { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.profile-stats span { font-size: 0.7rem; color: var(--text-3); }

/* chip "Giorno N con Timely" nella scheda di saluto */
.hello-days { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; color: var(--accent); background: color-mix(in oklab, var(--accent) 13%, transparent); }
.hello-days svg { width: 14px; height: 14px; }
.hello-days.milestone { color: #fff; background: linear-gradient(135deg, var(--lunch), var(--accent)); box-shadow: 0 0 18px color-mix(in oklab, var(--lunch) 50%, transparent); animation: rise 0.5s var(--ease) both, glow-pulse 2.4s ease-in-out infinite; }
@keyframes glow-pulse { 50% { box-shadow: 0 0 26px color-mix(in oklab, var(--lunch) 75%, transparent); } }

/* ======================= GRADI ======================= */
.rank-badge {
  --rc1: #64748b; --rc2: #34d399;
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 44px; color: #fff;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background:
    radial-gradient(circle at 35% 25%, rgb(255 255 255 / 0.45), transparent 45%),
    linear-gradient(150deg, var(--rc2), var(--rc1));
}
.rank-badge svg { width: 52%; height: 52%; stroke-width: 2.2; filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / 0.35)); }
.rank-xs { width: 16px; height: 18px; }
.rank-xs svg { stroke-width: 2.6; width: 62%; height: 62%; }
.rank-sm { width: 28px; height: 31px; }
.rank-lg { width: 60px; height: 66px; }
.rank-badge.locked { background: linear-gradient(150deg, var(--surface-3), color-mix(in oklab, var(--surface-3) 70%, var(--bg))); color: var(--text-3); }
.rank-badge.locked svg { filter: none; width: 42%; height: 42%; }
/* il grado più alto luccica */
.rank-badge.top:not(.locked)::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgb(255 255 255 / 0.55) 48%, transparent 66%);
  background-size: 250% 100%; animation: shine 3.2s linear infinite;
}

/* profilo: grado attuale */
.profile-rank {
  padding: 14px; border-radius: 16px; display: grid; gap: 10px;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in oklab, var(--accent) 20%, transparent), transparent 60%),
    radial-gradient(120% 120% at 100% 100%, color-mix(in oklab, var(--accent-2) 14%, transparent), transparent 60%),
    var(--surface-2);
  border: 1px solid color-mix(in oklab, var(--accent) 22%, var(--border));
}
.profile-rank-top { display: flex; align-items: center; gap: 12px; }
.profile-rank-badge { display: grid; filter: drop-shadow(0 6px 14px rgb(0 0 0 / 0.35)); }
.profile-rank-text { flex: 1; min-width: 0; }
.profile-rank-level { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.profile-rank-name { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.profile-rank-motto { font-size: 0.76rem; color: var(--text-2); line-height: 1.35; }
.profile-days-box { display: grid; justify-items: center; padding-left: 10px; border-left: 1px solid var(--border); }
.profile-days-n { font-size: 1.7rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.profile-days-label { font-size: 0.7rem; color: var(--text-3); }
.profile-progress { height: 7px; margin: 0; border-radius: 99px; background: color-mix(in oklab, var(--text) 10%, transparent); overflow: hidden; }
.profile-progress span { display: block; height: 100%; border-radius: inherit; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--rc1, var(--accent)), var(--rc2, var(--accent-2))); transition: transform 0.8s var(--ease); }
.profile-next { margin: -4px 0 0; font-size: 0.76rem; color: var(--text-2); }
.profile-since { margin: 0; font-size: 0.72rem; color: var(--text-3); text-align: center; }

/* scala dei gradi */
.rank-ladder { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: repeat(8, 1fr); position: relative; }
.rank-ladder::before { content: ''; position: absolute; left: 6%; right: 6%; top: 15px; height: 2px; background: var(--border); }
.rank-ladder li { position: relative; display: grid; justify-items: center; gap: 3px; cursor: default; }
.rank-ladder li span:not(.rank-badge) { font-size: 0.6rem; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.rank-ladder li.reached span:not(.rank-badge) { color: var(--text-2); }
.rank-ladder li.current .rank-badge { transform: scale(1.18); filter: drop-shadow(0 0 8px var(--rc2)); }
.rank-ladder li.current span:not(.rank-badge) { color: var(--text); font-weight: 800; }
.rank-ladder .rank-badge { transition: transform 0.2s var(--ease-spring); }
.rank-ladder li:hover .rank-badge { transform: scale(1.12); }

/* etichetta del grado nel saluto */
.hello-days { gap: 7px; color: var(--text); background: color-mix(in oklab, var(--rc2, var(--accent)) 16%, transparent); border: 1px solid color-mix(in oklab, var(--rc2, var(--accent)) 35%, transparent); padding: 3px 10px 3px 6px; }
.hello-days b { font-weight: 800; }
.hello-days-n { color: var(--text-3); font-weight: 600; }
.hello-days.milestone { color: #fff; background: linear-gradient(135deg, var(--rc1), var(--rc2)); border-color: transparent; }
.hello-days.milestone .hello-days-n { color: rgb(255 255 255 / 0.85); }

/* grado accanto ai colleghi */
.tm-name { display: flex; align-items: center; min-width: 0; }
.tm-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-rank, .tm-offline { flex-shrink: 0; }
.tm-rank { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; white-space: nowrap; padding: 1px 8px 1px 4px; border-radius: 99px; font-size: 0.68rem; font-weight: 700; vertical-align: 1px; color: var(--text-2); background: color-mix(in oklab, var(--rc2) 14%, transparent); }

/* ======================= CHAT: CRONOLOGIA ======================= */
.messages-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages-wrap .messages { flex: 1; min-height: 0; }
.load-older { align-self: center; margin: 6px 0 10px; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 0.8rem; font-weight: 600; transition: background 0.2s, color 0.2s; }
.load-older:hover { background: var(--surface-3); color: var(--text); }
.load-older.is-loading { opacity: 0.6; pointer-events: none; }
.load-older.is-loading::after { content: '…'; }
.chat-start { align-self: center; margin: 4px 0 6px; font-size: 0.72rem; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }
.chat-jump {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 99px;
  font-size: 0.8rem; font-weight: 700; color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 24px -8px color-mix(in oklab, var(--accent) 80%, transparent);
  animation: rise 0.3s var(--ease) both;
}
.chat-jump svg { width: 15px; height: 15px; transform: rotate(90deg); }

/* ======================= DIALOG IMPOSTAZIONI ======================= */
.sheet { width: min(640px, calc(100% - 24px)); max-height: min(88dvh, 900px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.sheet[open] { animation: rise 0.3s var(--ease) both; }
.sheet::backdrop { background: rgb(5 5 15 / 0.55); backdrop-filter: blur(4px); }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head, .sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; }
.sheet-head { border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 1.2rem; letter-spacing: -0.02em; }
.sheet-foot { border-top: 1px solid var(--border); }
.sheet-body { overflow-y: auto; padding: 8px 22px 12px; display: grid; gap: 4px; }
.group { border: 0; padding: 14px 0; margin: 0; display: grid; gap: 12px; border-bottom: 1px dashed var(--border); }
.group:last-of-type { border-bottom: 0; }
.group legend { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 0; margin-bottom: 10px; float: left; width: 100%; }
.group legend + * { clear: both; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row input[type='time'] { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-grid; place-items: center; min-width: 52px; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 0.9rem; font-weight: 600; color: var(--text-2); transition: all 0.2s; }
.chip input:checked + span { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.breaks { display: grid; gap: 8px; }
.break-row { display: grid; grid-template-columns: 1fr 118px 10px 118px 58px 36px; align-items: center; gap: 8px; }
.tag:empty { padding: 0; background: none; }
.tag { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; color: var(--lunch); background: color-mix(in oklab, var(--lunch) 15%, transparent); }
.lunch-days { display: grid; gap: 4px; }
.lunch-day { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 10px; border-radius: 12px; transition: background 0.2s; }
.lunch-day.on { background: color-mix(in oklab, var(--lunch) 9%, transparent); }
.lunch-times { display: flex; align-items: center; gap: 6px; }

/* indicatore del salvataggio automatico */
.save-status { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; color: var(--text-3); min-width: 0; }
.save-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; transition: background 0.2s, color 0.2s; }
.save-icon svg { width: 13px; height: 13px; stroke-width: 3; }
.save-status[data-state='idle'] .save-icon { color: var(--text-3); background: var(--surface-2); }
.save-status[data-state='pending'] .save-icon, .save-status[data-state='saving'] .save-icon { background: none; border: 2px solid color-mix(in oklab, var(--accent) 30%, transparent); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.save-status[data-state='pending'] .save-icon svg, .save-status[data-state='saving'] .save-icon svg { display: none; }
.save-status[data-state='saved'] { color: var(--text-2); }
.save-status[data-state='saved'] .save-icon { color: #fff; background: #22c55e; animation: pop 0.3s var(--ease-spring) both; }
.save-status[data-state='error'] { color: var(--danger); }
.save-status[data-state='error'] .save-icon { color: #fff; background: var(--danger); }

/* ======================= TOAST ======================= */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.show { animation: toast 3.5s var(--ease) both; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 8%, 90% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ======================= AVVISO (ALERT) ======================= */
.alert-root { position: relative; z-index: 200; }
.alert {
  --tone: var(--break); --tone-2: var(--accent);
  position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  margin: 0; border: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  background: transparent; color: var(--text); overflow: hidden;
}
.alert-work { --tone: var(--accent); --tone-2: var(--accent-2); }
.alert-party { --tone: var(--lunch); --tone-2: var(--accent); }

.alert-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 600px at 50% 45%, color-mix(in oklab, var(--tone) 35%, transparent), transparent 70%),
    rgb(4 4 12 / 0.62);
  backdrop-filter: blur(10px) saturate(130%);
  animation: fade-in 0.35s var(--ease) both;
}
.alert-stage { position: relative; display: grid; place-items: center; }

/* scheda opaca con bordo luminoso che gira SOLO sul bordo (niente riflessi dentro il testo) */
@property --alert-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.alert-card {
  --card-bg: color-mix(in oklab, var(--surface) 96%, var(--tone));
  position: relative; isolation: isolate;
  width: min(420px, calc(100vw - 32px)); padding: 30px 28px 22px;
  display: grid; justify-items: center; gap: 8px; text-align: center;
  border-radius: 28px; border: 1.5px solid transparent;
  background:
    radial-gradient(130% 70% at 50% 0%, color-mix(in oklab, var(--tone) 14%, var(--card-bg)), var(--card-bg) 62%) padding-box,
    conic-gradient(from var(--alert-angle), var(--tone), var(--tone-2), color-mix(in oklab, var(--tone) 12%, var(--border)) 28%, color-mix(in oklab, var(--tone) 12%, var(--border)) 62%, var(--tone-2) 80%, var(--tone)) border-box;
  box-shadow:
    0 30px 90px -24px color-mix(in oklab, var(--tone) 55%, transparent),
    0 12px 30px -12px rgb(0 0 0 / 0.45),
    inset 0 1px 0 rgb(255 255 255 / 0.06);
  animation: alert-in 0.6s var(--ease-spring) both, alert-spin 6s linear infinite;
}
@keyframes alert-spin { to { --alert-angle: 360deg; } }

.alert-close {
  position: absolute; top: 12px; right: 12px; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 12px; border: 0; background: transparent; color: var(--text-3);
  transition: background 0.2s, color 0.2s;
}
.alert-close:hover { background: var(--surface-2); color: var(--text); }
.alert-close svg { width: 18px; height: 18px; }

/* icona con anello che si svuota fino alla chiusura automatica */
.alert-orb-wrap { position: relative; display: grid; place-items: center; width: 112px; height: 112px; margin: 2px 0 10px; }
.alert-orb {
  position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; color: #fff;
  background: radial-gradient(circle at 32% 28%, color-mix(in oklab, var(--tone) 55%, white), var(--tone) 48%, color-mix(in oklab, var(--tone) 60%, var(--tone-2)));
  box-shadow: 0 10px 34px -6px color-mix(in oklab, var(--tone) 75%, transparent), inset 0 -6px 14px rgb(0 0 0 / 0.18), inset 0 2px 6px rgb(255 255 255 / 0.35);
  animation: orb 2.6s var(--ease) infinite;
}
.alert-orb svg { width: 40px; height: 40px; stroke-width: 2; filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.25)); animation: wiggle 1.2s var(--ease) 0.4s both; }
.alert-countdown { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.alert-countdown circle { fill: none; stroke-width: 3; }
.alert-countdown .track { stroke: color-mix(in oklab, var(--tone) 16%, transparent); }
.alert-countdown .left {
  stroke: var(--tone); stroke-linecap: round;
  stroke-dasharray: var(--ring); stroke-dashoffset: 0;
  filter: drop-shadow(0 0 4px var(--tone));
  animation: countdown var(--duration) linear forwards;
}
@keyframes countdown { to { stroke-dashoffset: var(--ring); } }
.alert.is-paused .alert-countdown .left { animation-play-state: paused; }
.ripple { position: absolute; inset: 14px; border-radius: 50%; border: 1.5px solid var(--tone); opacity: 0; animation: ripple 2.8s var(--ease) infinite; }
.ripple:nth-child(2) { animation-delay: 1.4s; }

.alert-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--tone); background: color-mix(in oklab, var(--tone) 13%, transparent);
  animation: rise 0.5s var(--ease) 0.15s both;
}
.alert-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 8px var(--tone); }
.alert-title {
  margin-top: 4px;
  font-size: clamp(1.6rem, 5vw, 2.05rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.035em; text-wrap: balance;
  background: linear-gradient(120deg, var(--text) 35%, color-mix(in oklab, var(--tone) 80%, var(--text)) 50%, var(--text) 65%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rise 0.5s var(--ease) 0.22s both, shine 4s linear 1s infinite;
}
.alert-body { color: var(--text-2); max-width: 34ch; font-size: 0.98rem; line-height: 1.55; text-wrap: pretty; animation: rise 0.5s var(--ease) 0.3s both; }

.alert-meta { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; animation: rise 0.5s var(--ease) 0.36s both; }
.alert-meta li {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 10px;
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
}
.alert-meta svg { width: 15px; height: 15px; color: var(--tone); }

.alert-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; margin-top: 14px; animation: rise 0.5s var(--ease) 0.42s both; }
.alert-actions .alert-ok { flex: 1 1 140px; max-width: 240px; margin: 0; min-width: 0; }
.alert-actions .btn-primary { background: linear-gradient(135deg, var(--tone), color-mix(in oklab, var(--tone) 55%, var(--tone-2))); color: #fff; box-shadow: 0 10px 26px -10px color-mix(in oklab, var(--tone) 80%, transparent); }
.alert-ok:focus-visible { outline: 2px solid color-mix(in oklab, var(--tone) 70%, var(--text)); outline-offset: 3px; border-radius: 12px; }
.alert-hint { margin-top: 8px; font-size: 0.75rem; color: var(--text-3); animation: rise 0.5s var(--ease) 0.5s both; }
.alert-hint kbd { margin: 0 2px 0 0; height: 20px; min-width: 0; font-size: 0.68rem; }
@media (pointer: coarse) { .alert-hint { display: none; } }

.alert-particles { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.alert-particles i {
  position: absolute; width: var(--s); height: var(--s); border-radius: 50%;
  background: var(--tone); opacity: 0;
  animation: burst 1.4s var(--ease) var(--delay) both;
}
.alert-particles i:nth-child(3n) { background: var(--tone-2); border-radius: 2px; }
.alert-particles i:nth-child(4n) { background: #fff; }

.alert.is-leaving .alert-card { animation: alert-out 0.35s var(--ease) both; }
.alert.is-leaving .alert-backdrop { animation: fade-out 0.35s var(--ease) both; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes alert-in { 0% { opacity: 0; transform: translateY(40px) scale(0.85) rotateX(20deg); } 100% { opacity: 1; transform: none; } }
@keyframes alert-out { to { opacity: 0; transform: translateY(-20px) scale(0.92); } }
@keyframes orb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes ripple { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes wiggle { 0% { transform: rotate(0) scale(0.4); } 30% { transform: rotate(-18deg) scale(1.1); } 50% { transform: rotate(14deg); } 70% { transform: rotate(-8deg); } 100% { transform: rotate(0) scale(1); } }
@keyframes shine { to { background-position: -250% 0; } }
@keyframes drain { to { transform: scaleX(0); } }
@keyframes burst {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(30px) scale(1); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(0.3); }
}

/* ---------- PULSANTE PAUSA ---------- */
body[data-phase='due'] { --phase-color: var(--lunch); }
body[data-phase='due'] .ring stop:first-child { stop-color: var(--lunch); }
body[data-phase='due'] .ring stop:last-child { stop-color: var(--break); }
body[data-phase='due'] .ring-progress { animation: due-ring 1.6s var(--ease) infinite; }
body[data-phase='due'] .countdown { color: var(--lunch); }
@keyframes due-ring { 50% { opacity: 0.45; } }

.break-actions { display: grid; justify-items: center; gap: 8px; margin-top: -8px; animation: rise 0.4s var(--ease) both; }
.break-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn-break { min-width: 240px; }
.break-actions[data-mode='due'] .btn-break {
  min-height: 60px; font-size: 1.15rem; padding: 0 30px;
  background: linear-gradient(135deg, var(--lunch), var(--break)); color: #fff;
  animation: break-pulse 1.8s var(--ease) infinite;
}
.break-actions[data-mode='due'] .btn-break svg { width: 22px; height: 22px; }
@keyframes break-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--lunch) 55%, transparent); }
  100% { box-shadow: 0 0 0 18px transparent; }
}
.break-hint { min-height: 1.3em; font-size: 0.85rem; color: var(--text-3); text-align: center; }
body.offline .break-actions .btn { opacity: 0.5; cursor: not-allowed; }

/* timeline: stato reale delle pause */
.seg[data-state='done'] .seg-fill { opacity: 1; }
.seg[data-state='skipped'], .seg[data-state='missed'] {
  background: repeating-linear-gradient(135deg, var(--surface-3) 0 5px, transparent 5px 9px);
}
.seg[data-state='due'] { animation: due-ring 1.6s var(--ease) infinite; box-shadow: 0 0 0 2px var(--lunch); }
.tl-label.done b::after { content: ' ✓'; color: var(--break); }

/* ---------- TEAM ---------- */
.team-card { width: min(860px, 100%); padding: 20px 22px; background: color-mix(in oklab, var(--surface) 85%, transparent); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.team-card h2 { display: flex; align-items: center; gap: 8px; }
.team-card h2 svg { width: 18px; height: 18px; color: var(--accent); }
.team-summary { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.team-chip { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; color: var(--work); background: color-mix(in oklab, var(--work) 14%, transparent); }
.team-chip.status-break { color: var(--break); background: color-mix(in oklab, var(--break) 16%, transparent); }
.team-chip.status-due { color: var(--lunch); background: color-mix(in oklab, var(--lunch) 16%, transparent); }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tm { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(140px, 38%); align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; transition: background 0.2s; }
.tm:hover { background: var(--surface-2); }
.tm.status-break { background: color-mix(in oklab, var(--break) 8%, transparent); }
.tm.status-due { background: color-mix(in oklab, var(--lunch) 8%, transparent); }
.tm.offline { opacity: 0.6; }
.tm-who { min-width: 0; }
.tm-name { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-offline { margin-left: 8px; font-size: 0.68rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.tm-status { font-size: 0.82rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-status b { font-weight: 600; color: var(--text); }
.tm.status-break .tm-status b { color: var(--break); }
.tm.status-due .tm-status b { color: var(--lunch); }
.status-due .status-dot { background: var(--lunch); }
.status-due .online-status { color: var(--lunch); }
.tm-bar { position: relative; height: 10px; border-radius: 6px; background: color-mix(in oklab, var(--work) 14%, var(--surface-3)); overflow: hidden; }
.tm-bar i { position: absolute; top: 0; bottom: 0; }
.tm-planned { border-radius: 3px; box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--break) 70%, transparent); background: color-mix(in oklab, var(--break) 14%, transparent); }
.tm-planned.lunch { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--lunch) 70%, transparent); background: color-mix(in oklab, var(--lunch) 14%, transparent); }
.tm-real { border-radius: 3px; background: var(--break); }
.tm-real.lunch { background: var(--lunch); }
.tm-real.active { animation: due-ring 1.6s var(--ease) infinite; box-shadow: 0 0 10px var(--break); }
.tm-now { width: 2px; margin-left: -1px; background: var(--text); }
.team-empty { padding: 10px 0; }
.team-legend { display: flex; justify-content: flex-end; gap: 14px; margin-top: 10px; font-size: 0.72rem; color: var(--text-3); }
.team-legend span { display: inline-flex; align-items: center; gap: 6px; }
.team-legend i { width: 14px; height: 8px; border-radius: 2px; }
.lg-planned { box-shadow: inset 0 0 0 1.5px var(--break); }
.lg-real { background: var(--break); }
.lg-active { background: var(--break); box-shadow: 0 0 6px var(--break); }

/* righe di sistema in chat */
.sys-msg { align-self: center; display: flex; align-items: center; gap: 8px; max-width: 92%; margin: 10px 0 4px; padding: 5px 12px; border-radius: 99px; font-size: 0.78rem; color: var(--text-2); background: color-mix(in oklab, var(--break) 10%, var(--surface-2)); animation: msg-in 0.3s var(--ease) both; }
.sys-msg svg { width: 14px; height: 14px; color: var(--break); }
.sys-msg time { color: var(--text-3); font-size: 0.7rem; }
.sys-end svg { color: var(--work); }

.alert-due { --tone: var(--lunch); --tone-2: var(--break); }
.test-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- MENU STILI ---------- */
.popover-title-2 { margin-top: 16px; }
.style-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.style-opt { display: grid; gap: 6px; justify-items: center; padding: 8px 4px; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2); font-size: 0.75rem; font-weight: 500; transition: border-color 0.2s, transform 0.15s; }
.style-opt:hover { transform: translateY(-2px); }
.style-opt[aria-checked='true'] { border-color: var(--accent); }
.style-preview { position: relative; width: 38px; height: 28px; }
.style-preview i { position: absolute; display: block; }
.style-preview i:first-child { inset: 0 8px 8px 0; background: var(--surface-3); }
.style-preview i:last-child { inset: 10px 0 0 12px; background: var(--accent); }
[data-preview='soft'] i { border-radius: 8px; box-shadow: 0 4px 8px -2px rgb(0 0 0 / 0.35); }
[data-preview='glass'] i:first-child { border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
[data-preview='glass'] i:last-child { border-radius: 7px; background: color-mix(in oklab, var(--surface) 40%, transparent); backdrop-filter: blur(3px); border: 1px solid rgb(255 255 255 / 0.35); }
[data-preview='brutal'] i { border: 2px solid var(--text); box-shadow: 3px 3px 0 var(--text); }
[data-preview='minimal'] i { border-radius: 2px; }
[data-preview='minimal'] i:first-child { background: none; border: 1px solid var(--border); }
[data-preview='retro'] i { border: 1px solid var(--accent-2); background: repeating-linear-gradient(0deg, var(--surface-3) 0 2px, transparent 2px 4px); }
[data-preview='retro'] i:last-child { background: repeating-linear-gradient(0deg, var(--accent) 0 2px, transparent 2px 4px); }

/* ======================= STILI ======================= */
/* Vetro: pannelli traslucidi e sfocati sopra uno sfondo più vivace */
[data-style='glass'] body {
  background:
    radial-gradient(900px 600px at 10% 0%, color-mix(in oklab, var(--accent) 45%, transparent), transparent 60%),
    radial-gradient(800px 600px at 100% 100%, color-mix(in oklab, var(--accent-2) 40%, transparent), transparent 60%),
    radial-gradient(600px 400px at 60% 40%, color-mix(in oklab, var(--break) 20%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
[data-style='glass'] :is(.timeline-card, .stat, .team-card, .chat, .popover, .sheet) {
  background: color-mix(in oklab, var(--surface) 45%, transparent);
  backdrop-filter: blur(22px) saturate(160%);
  border-color: color-mix(in oklab, var(--text) 14%, transparent);
}
[data-style='glass'] .phase-pill, [data-style='glass'] .target-time { backdrop-filter: blur(12px); }

/* Brutale: niente sfumature, bordi spessi e ombre piene */
[data-style='brutal'] { --radius-sm: 0; --radius: 0; --radius-lg: 0; }
[data-style='brutal'] body { background: var(--bg); }
[data-style='brutal'] :is(.timeline-card, .stat, .team-card, .popover, .sheet, .alert-card, .phase-pill, .target-time, .theme-opt, .style-opt, .tm, .bubble, .chip span) {
  border-radius: 0; border: 2px solid var(--text); box-shadow: 5px 5px 0 var(--text);
}
[data-style='brutal'] .tm { box-shadow: none; border-width: 0 0 2px; }
[data-style='brutal'] .btn, [data-style='brutal'] .icon-btn, [data-style='brutal'] input, [data-style='brutal'] select, [data-style='brutal'] textarea, [data-style='brutal'] .send-btn {
  border-radius: 0; border: 2px solid var(--text); box-shadow: 3px 3px 0 var(--text);
}
[data-style='brutal'] .topbar .icon-btn { box-shadow: none; border-color: transparent; }
[data-style='brutal'] .btn:active { transform: translate(3px, 3px); box-shadow: none; }
[data-style='brutal'] .btn-primary, [data-style='brutal'] .send-btn, [data-style='brutal'] .msg.mine .bubble, [data-style='brutal'] .brand-mark { background: var(--accent); }
[data-style='brutal'] .brand-mark, [data-style='brutal'] .avatar { border-radius: 0; }
[data-style='brutal'] .chat { border-left: 3px solid var(--text); }
[data-style='brutal'] .topbar { border-bottom: 3px solid var(--text); backdrop-filter: none; background: var(--bg); }
[data-style='brutal'] .ring-progress { stroke-linecap: butt; filter: none; }
[data-style='brutal'] .seg, [data-style='brutal'] .tm-bar { border-radius: 0; border: 1px solid var(--text); }
[data-style='brutal'] .countdown { letter-spacing: -0.06em; text-shadow: 4px 4px 0 color-mix(in oklab, var(--accent) 60%, transparent); }
[data-style='brutal'] .alert-card { background: var(--surface); animation: alert-in 0.6s var(--ease-spring) both; }
[data-style='brutal'] .alert-orb, [data-style='brutal'] .alert-eyebrow, [data-style='brutal'] .alert-meta li, [data-style='brutal'] .alert-close { border-radius: 0; }

/* Minimal: piatto, niente ombre, sfondi né bagliori */
[data-style='minimal'] body { background: var(--bg); }
[data-style='minimal'] { --shadow: none; --glow: none; }
[data-style='minimal'] :is(.timeline-card, .stat, .team-card) { background: transparent; box-shadow: none; border-color: var(--border); }
[data-style='minimal'] .stat-icon, [data-style='minimal'] .phase-icon { background: none; }
[data-style='minimal'] .ring-progress { filter: none; stroke-width: 6; }
[data-style='minimal'] .ring-track { stroke-width: 6; }
[data-style='minimal'] .ring-ticks { display: none; }
[data-style='minimal'] .countdown { font-weight: 300; letter-spacing: -0.03em; }
[data-style='minimal'] .btn-primary, [data-style='minimal'] .send-btn, [data-style='minimal'] .brand-mark, [data-style='minimal'] .msg.mine .bubble { background: var(--accent); box-shadow: none; }
[data-style='minimal'] .phase-pill { background: none; }
[data-style='minimal'] .topbar { backdrop-filter: none; background: var(--bg); }
[data-style='minimal'] .alert-card { background: var(--surface); border-color: var(--border); animation: alert-in 0.6s var(--ease-spring) both; box-shadow: 0 20px 60px -20px rgb(0 0 0 / 0.5); }
[data-style='minimal'] .alert-particles, [data-style='minimal'] .ripple { display: none; }

/* Retrò: monospace, angoli squadrati, righe da monitor CRT */
[data-style='retro'] { --font-sans: 'Fira Code', ui-monospace, monospace; --radius-sm: 2px; --radius: 4px; --radius-lg: 6px; }
[data-style='retro'] body::after {
  content: ''; position: fixed; inset: 0; z-index: 300; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / 0.12) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
[data-style='retro'] :is(.btn, .icon-btn, input, select, textarea, .bubble, .phase-pill, .target-time, .chip span, .theme-opt, .style-opt, .tm, .send-btn, .brand-mark) { border-radius: 3px; }
[data-style='retro'] .avatar { border-radius: 3px; }
[data-style='retro'] .countdown { text-shadow: 0 0 12px color-mix(in oklab, var(--accent) 70%, transparent), 2px 0 0 color-mix(in oklab, var(--accent-2) 50%, transparent); letter-spacing: 0; }
[data-style='retro'] .ring-progress { stroke-linecap: butt; stroke-dasharray: none; }
[data-style='retro'] .ring-ticks { stroke-dasharray: 3 9; }
[data-style='retro'] .seg { border-radius: 0; }
[data-style='retro'] :is(h1, h2, .brand-name, .popover-title, .group legend) { text-transform: uppercase; letter-spacing: 0.04em; }
[data-style='retro'] .alert-card { border-radius: 6px; }
[data-style='retro'] :is(.alert-meta li, .alert-eyebrow, .alert-close) { border-radius: 3px; }

@media (max-width: 720px) {
  .tm { grid-template-columns: auto minmax(0, 1fr); }
  .tm-bar { grid-column: 1 / -1; }
  .btn-break { min-width: 0; width: 100%; }
  .style-grid { grid-template-columns: repeat(3, 1fr); }
  .motif-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ======================= RIFINITURE UI ======================= */
/* struttura: eroe (timer) + colonna laterale */
.hero { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; }
.side { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.side > * { animation: rise 0.55s var(--ease) both; }
.side > :nth-child(2) { animation-delay: 0.06s; }
.side > :nth-child(3) { animation-delay: 0.12s; }
.side > :nth-child(4) { animation-delay: 0.18s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* barra avanzamento giornata sotto la topbar */
.day-line { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; }
.day-line span { display: block; height: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px var(--accent); transition: transform 1s linear; }

/* countdown */
.countdown { display: inline-flex; align-items: baseline; font-size: calc(var(--ring) * 0.19); white-space: nowrap; }
.countdown[data-size='hours'] { font-size: calc(var(--ring) * 0.175); }
.countdown[data-size='days'] { font-size: calc(var(--ring) * 0.12); }
.cd-sec { font-size: 0.42em; font-weight: 600; letter-spacing: -0.02em; color: var(--text-3); margin-left: 0.04em; }
body[data-phase='due'] .cd-sec { color: inherit; opacity: 0.7; }

/* anello: alone colorato + pallino sulla punta */
.ring-halo {
  position: absolute; inset: 14%; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, color-mix(in oklab, var(--phase-color) 26%, transparent), transparent 68%);
  filter: blur(20px); animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.08); opacity: 0.75; } }
.ring-wrap { isolation: isolate; }
.ring-knob {
  fill: var(--text); stroke: var(--accent-2); stroke-width: 4;
  filter: drop-shadow(0 0 8px var(--accent-2)) drop-shadow(0 0 2px var(--accent-2));
  transform-box: view-box; transform-origin: 200px 200px;
  transition: transform 1s linear, opacity 0.3s;
}
body[data-phase='break'] .ring-knob { stroke: var(--break); filter: drop-shadow(0 0 8px var(--break)); }
body[data-phase='due'] .ring-knob, .ring-knob.idle { opacity: 0; }

/* saluto */
.hello-card {
  width: min(860px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--phase-color) 16%, transparent), transparent 60%),
    color-mix(in oklab, var(--surface) 85%, transparent);
  box-shadow: var(--shadow);
}
.hello-title { font-size: clamp(1.3rem, 2.2vw, 1.6rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.hello-sub { margin-top: 4px; color: var(--text-2); font-size: 0.95rem; }
.hello-team { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 6px 12px 6px 6px; border-radius: 99px; background: color-mix(in oklab, var(--break) 12%, transparent); }
.hello-team-label { font-size: 0.8rem; font-weight: 600; color: var(--break); white-space: nowrap; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 30px; height: 30px; font-size: 0.7rem; border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* statistiche più compatte */
.stats { gap: 12px; }
.stat { padding: 14px 16px; gap: 12px; transition: transform 0.2s var(--ease), border-color 0.2s; }
.stat:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); }
.stat-value { font-size: 0.98rem; line-height: 1.3; }

/* timeline: etichette su due righe quando troppo vicine */
.tl-label.row2 { top: 40px; }
.tl-label.row2::before { content: ''; position: absolute; top: -12px; left: 50%; width: 1px; height: 10px; background: var(--border); }
.timeline-card.two-rows { padding-bottom: 76px; }
.seg { transition: box-shadow 0.3s; }
.seg:hover { filter: brightness(1.15); }

/* scorciatoia da tastiera */
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 4px;
  font: 600 0.72rem var(--font-mono); color: var(--text-2);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2);
}
@media (pointer: coarse) { .break-hint kbd { display: none; } }

/* lista online della chat: avatar + nome, lo stato è nel pallino */
.online-list { padding: 2px 14px 12px; gap: 2px; }
.online-user { width: 58px; padding: 6px 0; }
.online-user .avatar { width: 38px; height: 38px; transition: transform 0.2s var(--ease-spring); }
.online-user:hover .avatar { transform: translateY(-2px) scale(1.05); }
.online-status { display: none; }
.status-break .avatar, .status-due .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--phase-ring, var(--break)); }
.status-due .avatar { --phase-ring: var(--lunch); }
.status-break .online-name { color: var(--break); }
.status-due .online-name { color: var(--lunch); }

/* chat vuota */
.empty-chat { margin: auto; display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--text-3); font-size: 0.9rem; }
.empty-chat svg { width: 44px; height: 44px; padding: 12px; box-sizing: content-box; border-radius: 20px; color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }

/* team: righe più ariose */
.tm { padding: 10px 12px; }
.tm-bar { height: 12px; }

/* layout a due colonne sugli schermi larghi */
@media (min-width: 1280px) {
  .stage {
    --ring: min(440px, calc((100vw - var(--chat-w)) * 0.4));
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start;
    gap: 32px; padding: 32px 32px 40px; max-width: 1400px; margin: 0 auto; width: 100%;
  }
  .hero { position: sticky; top: calc(var(--topbar-h) + 24px); padding-top: 8px; }
  .side > * { width: 100%; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ======================= MOTIVI DI SFONDO ======================= */
/* Livello fisso dietro ai contenuti; i colori vengono dal tema, quindi ogni motivo si adatta a tutti i temi. */
:root {
  /* colori del motivo: tinti con l'accento del tema (non grigi) e molto tenui */
  --motif-c: color-mix(in oklab, color-mix(in oklab, var(--text) 45%, var(--accent)) 6%, transparent);
  --motif-a: color-mix(in oklab, var(--accent) 12%, transparent);
  /* il motivo svanisce al centro, dove ci sono i contenuti, e resta ai bordi */
  --motif-fade: radial-gradient(ellipse 80% 70% at 45% 42%, rgb(0 0 0 / 0.18) 0%, rgb(0 0 0 / 0.55) 55%, #000 100%);
}
[data-theme='light'], [data-theme='paper'], [data-theme='ocean'], [data-theme='sakura'], [data-theme='lavender'], [data-theme='mint'] {
  --motif-c: color-mix(in oklab, color-mix(in oklab, var(--text) 45%, var(--accent)) 7%, transparent);
  --motif-a: color-mix(in oklab, var(--accent) 10%, transparent);
}

[data-motif] body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  /* sfuma il motivo verso il basso così non disturba i contenuti */
  -webkit-mask-image: var(--motif-fade);
  mask-image: var(--motif-fade);
}
[data-motif='none'] body::before { content: none; }

/* anteprime nel menu */
.motif-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.motif-opt { display: grid; gap: 5px; justify-items: center; padding: 6px 4px 8px; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2); color: var(--text); font-size: 0.72rem; font-weight: 500; transition: border-color 0.2s, transform 0.15s; }
.motif-opt:hover { transform: translateY(-2px); }
.motif-opt[aria-checked='true'] { border-color: var(--accent); }
.mp { position: relative; display: block; width: 100%; height: 34px; border-radius: 8px; overflow: hidden; background-color: var(--bg); box-shadow: inset 0 0 0 1px var(--border); --motif-c: color-mix(in oklab, var(--text) 22%, transparent); --motif-a: color-mix(in oklab, var(--accent) 45%, transparent); }
.mp[data-m='none']::after { content: ''; position: absolute; left: 50%; top: 50%; width: 60%; height: 2px; background: var(--text-3); transform: translate(-50%, -50%) rotate(-20deg); border-radius: 2px; }

/* --- Puntini --- */
[data-motif='dots'] body::before, .mp[data-m='dots'] {
  background-image: radial-gradient(circle, var(--motif-c) 1.3px, transparent 1.8px);
  background-size: 22px 22px;
}
.mp[data-m='dots'] { background-size: 9px 9px; }

/* --- Griglia --- */
[data-motif='grid'] body::before, .mp[data-m='grid'] {
  background-image:
    linear-gradient(var(--motif-c) 1px, transparent 1px),
    linear-gradient(90deg, var(--motif-c) 1px, transparent 1px),
    linear-gradient(var(--motif-a) 1px, transparent 1px),
    linear-gradient(90deg, var(--motif-a) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px, 160px 160px, 160px 160px;
}
.mp[data-m='grid'] { background-size: 9px 9px, 9px 9px, 45px 45px, 45px 45px; }

/* --- Righe diagonali --- */
[data-motif='lines'] body::before, .mp[data-m='lines'] {
  background-image: repeating-linear-gradient(135deg, var(--motif-c) 0 1px, transparent 1px 16px);
}
.mp[data-m='lines'] { background-image: repeating-linear-gradient(135deg, var(--motif-c) 0 1px, transparent 1px 6px); }

/* --- Quaderno (righe + margine) --- */
[data-motif='notebook'] body::before, .mp[data-m='notebook'] {
  background-image:
    linear-gradient(90deg, transparent 71px, color-mix(in oklab, var(--danger) 22%, transparent) 71px 73px, transparent 73px),
    repeating-linear-gradient(to bottom, transparent 0 31px, color-mix(in oklab, var(--accent-2) 13%, transparent) 31px 32px);
}
.mp[data-m='notebook'] {
  background-image:
    linear-gradient(90deg, transparent 10px, color-mix(in oklab, var(--danger) 60%, transparent) 10px 11px, transparent 11px),
    repeating-linear-gradient(to bottom, transparent 0 6px, color-mix(in oklab, var(--accent-2) 45%, transparent) 6px 7px);
}

/* --- motivi disegnati in SVG: maschera colorata con i colori del tema --- */
[data-motif='waves'] body::before, [data-motif='topo'] body::before, [data-motif='hex'] body::before, [data-motif='confetti'] body::before {
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
[data-motif='waves'] body::before, .mp[data-m='waves']::after,
[data-motif='topo'] body::before, .mp[data-m='topo']::after,
[data-motif='hex'] body::before, .mp[data-m='hex']::after { background: linear-gradient(160deg, var(--motif-a), var(--motif-c) 60%); }
.mp[data-m='waves']::after, .mp[data-m='topo']::after, .mp[data-m='hex']::after, .mp[data-m='confetti']::after { content: ''; position: absolute; inset: 0; }

[data-motif='waves'] body::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='28'%3E%3Cpath d='M0 14 Q30 2 60 14 T120 14' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E"), var(--motif-fade);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='28'%3E%3Cpath d='M0 14 Q30 2 60 14 T120 14' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E"), var(--motif-fade);
}
.mp[data-m='waves']::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='10'%3E%3Cpath d='M0 5 Q10 0 20 5 T40 5' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='10'%3E%3Cpath d='M0 5 Q10 0 20 5 T40 5' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E");
}

[data-motif='topo'] body::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M180 40c80 0 140 50 140 130s-60 150-150 150S40 270 42 180 100 40 180 40z'/%3E%3Cpath d='M180 80c58 0 100 36 100 94s-44 106-110 106S82 246 84 180s38-100 96-100z'/%3E%3Cpath d='M182 120c36 0 60 22 60 58s-28 64-66 64-54-26-54-62 24-60 60-60z'/%3E%3Cpath d='M180 158c16 0 26 9 26 24s-12 26-28 26-22-10-22-24 9-26 24-26z'/%3E%3Cpath d='M0 330c40-20 80-10 110 20M250 360c20-40 60-60 110-50M300 0c10 30 30 50 60 54M0 40c30 0 50-20 56-40'/%3E%3C/svg%3E"), var(--motif-fade);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M180 40c80 0 140 50 140 130s-60 150-150 150S40 270 42 180 100 40 180 40z'/%3E%3Cpath d='M180 80c58 0 100 36 100 94s-44 106-110 106S82 246 84 180s38-100 96-100z'/%3E%3Cpath d='M182 120c36 0 60 22 60 58s-28 64-66 64-54-26-54-62 24-60 60-60z'/%3E%3Cpath d='M180 158c16 0 26 9 26 24s-12 26-28 26-22-10-22-24 9-26 24-26z'/%3E%3Cpath d='M0 330c40-20 80-10 110 20M250 360c20-40 60-60 110-50M300 0c10 30 30 50 60 54M0 40c30 0 50-20 56-40'/%3E%3C/svg%3E"), var(--motif-fade);
}
.mp[data-m='topo']::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cellipse cx='40' cy='20' rx='34' ry='18'/%3E%3Cellipse cx='40' cy='21' rx='23' ry='12'/%3E%3Cellipse cx='41' cy='22' rx='12' ry='6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cellipse cx='40' cy='20' rx='34' ry='18'/%3E%3Cellipse cx='40' cy='21' rx='23' ry='12'/%3E%3Cellipse cx='41' cy='22' rx='12' ry='6'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center;
}

[data-motif='hex'] body::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34'/%3E%3C/svg%3E"), var(--motif-fade);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34'/%3E%3C/svg%3E"), var(--motif-fade);
}
.mp[data-m='hex']::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='25' fill='none' stroke='%23000' stroke-width='1'%3E%3Cpath d='M7 16.5L0 12.5L0 4L7 0L14 4L14 12.5L7 16.5L7 25'/%3E%3Cpath d='M7 0L7 8.5L0 12.5L0 21L7 25L14 21L14 12.5L7 8.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='25' fill='none' stroke='%23000' stroke-width='1'%3E%3Cpath d='M7 16.5L0 12.5L0 4L7 0L14 4L14 12.5L7 16.5L7 25'/%3E%3Cpath d='M7 0L7 8.5L0 12.5L0 21L7 25L14 21L14 12.5L7 8.5'/%3E%3C/svg%3E");
}

/* --- Coriandoli: forme piene con i tre colori del tema --- */
[data-motif='confetti'] body::before, .mp[data-m='confetti']::after {
  background: linear-gradient(120deg, var(--accent), var(--accent-2) 50%, var(--break));
  opacity: 0.1;
}
[data-motif='confetti'] body::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Crect x='20' y='24' width='10' height='4' rx='2' transform='rotate(30 25 26)'/%3E%3Ccircle cx='96' cy='40' r='3'/%3E%3Cpath d='M150 20l6 10h-12z'/%3E%3Crect x='60' y='96' width='12' height='4' rx='2' transform='rotate(-40 66 98)'/%3E%3Ccircle cx='140' cy='110' r='2.5'/%3E%3Cpath d='M30 140c4-6 10-6 14 0' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/%3E%3Crect x='110' y='150' width='9' height='9' rx='2' transform='rotate(20 114 154)'/%3E%3Ccircle cx='170' cy='170' r='2'/%3E%3Cpath d='M80 168l5 9h-10z'/%3E%3C/svg%3E"), var(--motif-fade);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Crect x='20' y='24' width='10' height='4' rx='2' transform='rotate(30 25 26)'/%3E%3Ccircle cx='96' cy='40' r='3'/%3E%3Cpath d='M150 20l6 10h-12z'/%3E%3Crect x='60' y='96' width='12' height='4' rx='2' transform='rotate(-40 66 98)'/%3E%3Ccircle cx='140' cy='110' r='2.5'/%3E%3Cpath d='M30 140c4-6 10-6 14 0' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/%3E%3Crect x='110' y='150' width='9' height='9' rx='2' transform='rotate(20 114 154)'/%3E%3Ccircle cx='170' cy='170' r='2'/%3E%3Cpath d='M80 168l5 9h-10z'/%3E%3C/svg%3E"), var(--motif-fade);
}
[data-theme='sakura'][data-motif='confetti'] body::before, [data-theme='lavender'][data-motif='confetti'] body::before { opacity: 0.14; }
.mp[data-m='confetti']::after {
  opacity: 0.8;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='34'%3E%3Crect x='4' y='6' width='7' height='3' rx='1.5' transform='rotate(30 7 7)'/%3E%3Ccircle cx='24' cy='8' r='2'/%3E%3Cpath d='M33 18l4 7h-8z'/%3E%3Crect x='12' y='22' width='7' height='3' rx='1.5' transform='rotate(-40 15 23)'/%3E%3Ccircle cx='30' cy='30' r='1.6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='34'%3E%3Crect x='4' y='6' width='7' height='3' rx='1.5' transform='rotate(30 7 7)'/%3E%3Ccircle cx='24' cy='8' r='2'/%3E%3Cpath d='M33 18l4 7h-8z'/%3E%3Crect x='12' y='22' width='7' height='3' rx='1.5' transform='rotate(-40 15 23)'/%3E%3Ccircle cx='30' cy='30' r='1.6'/%3E%3C/svg%3E");
}

/* --- Stelle: tre strati di dimensioni diverse che brillano piano --- */
[data-motif='stars'] body::before, .mp[data-m='stars'] {
  --st: color-mix(in oklab, var(--text) 50%, transparent);
  background-image:
    radial-gradient(1.6px 1.6px at 20px 30px, var(--st) 99%, transparent),
    radial-gradient(1.2px 1.2px at 120px 80px, var(--st) 99%, transparent),
    radial-gradient(1.4px 1.4px at 60px 150px, var(--st) 99%, transparent),
    radial-gradient(2.4px 2.4px at 180px 120px, color-mix(in oklab, var(--accent-2) 85%, transparent) 99%, transparent),
    radial-gradient(1.2px 1.2px at 90px 20px, var(--st) 99%, transparent),
    radial-gradient(2px 2px at 150px 190px, color-mix(in oklab, var(--accent) 85%, transparent) 99%, transparent),
    radial-gradient(1px 1px at 40px 90px, var(--st) 99%, transparent),
    radial-gradient(1.3px 1.3px at 10px 60px, var(--st) 99%, transparent),
    radial-gradient(60px 60px at 30% 20%, color-mix(in oklab, var(--accent) 6%, transparent), transparent);
  background-size: 150px 150px, 110px 110px, 170px 170px, 260px 260px, 90px 90px, 310px 310px, 70px 70px, 130px 130px, 100% 100%;
}
[data-motif='stars'] body::before { animation: twinkle 7s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
.mp[data-m='stars'] { background-size: 60px 60px, 46px 46px, 70px 70px, 80px 80px, 36px 36px, 90px 90px; }
[data-theme='light'][data-motif='stars'] body::before, [data-theme='paper'][data-motif='stars'] body::before, [data-theme='ocean'][data-motif='stars'] body::before,
[data-theme='sakura'][data-motif='stars'] body::before, [data-theme='lavender'][data-motif='stars'] body::before, [data-theme='mint'][data-motif='stars'] body::before { --st: color-mix(in oklab, var(--accent) 45%, transparent); }

/* --- Bolle: grandi sfere sfocate che si muovono lentamente --- */
[data-motif='bubbles'] body::before, .mp[data-m='bubbles'] {
  background-image:
    radial-gradient(circle at 12% 22%, color-mix(in oklab, var(--accent) 34%, transparent) 0 8%, transparent 20%),
    radial-gradient(circle at 82% 14%, color-mix(in oklab, var(--accent-2) 32%, transparent) 0 6%, transparent 16%),
    radial-gradient(circle at 68% 72%, color-mix(in oklab, var(--break) 28%, transparent) 0 10%, transparent 24%),
    radial-gradient(circle at 28% 82%, color-mix(in oklab, var(--accent-2) 26%, transparent) 0 5%, transparent 13%),
    radial-gradient(circle at 46% 46%, color-mix(in oklab, var(--accent) 18%, transparent) 0 3%, transparent 8%),
    radial-gradient(circle at 92% 52%, color-mix(in oklab, var(--accent) 22%, transparent) 0 4%, transparent 10%);
}
[data-motif='bubbles'] body::before { inset: -15%; filter: blur(4px); animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift { 0% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(3%, -2%) rotate(4deg); } 100% { transform: translate(-3%, 3%) rotate(-3deg); } }
.mp[data-m='bubbles'] { background-image:
    radial-gradient(circle at 25% 35%, color-mix(in oklab, var(--accent) 60%, transparent) 0 16%, transparent 34%),
    radial-gradient(circle at 75% 60%, color-mix(in oklab, var(--accent-2) 60%, transparent) 0 14%, transparent 30%); }

/* --- Lava: gocce che salgono e scendono lente, si fondono e si separano come in una lampada di lava --- */
.lava { display: none; }
[data-motif='lava'] body::before {
  /* alone caldo in basso e in alto, come la luce della lampada */
  background:
    radial-gradient(ellipse 60% 35% at 50% 105%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 25% at 50% -5%, color-mix(in oklab, var(--accent-2) 10%, transparent), transparent 70%);
  -webkit-mask-image: none; mask-image: none;
}
[data-motif='lava'] .lava {
  display: block; position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  opacity: 0.26;
  /* le gocce si vedono soprattutto ai lati: al centro restano più tenui sotto i contenuti */
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 45% 45%, rgb(0 0 0 / 0.35), #000 85%);
  mask-image: radial-gradient(ellipse 70% 75% at 45% 45%, rgb(0 0 0 / 0.35), #000 85%);
}
[data-theme='light'][data-motif='lava'] .lava, [data-theme='paper'][data-motif='lava'] .lava, [data-theme='ocean'][data-motif='lava'] .lava,
[data-theme='sakura'][data-motif='lava'] .lava, [data-theme='lavender'][data-motif='lava'] .lava, [data-theme='mint'][data-motif='lava'] .lava { opacity: 0.22; }
[data-style='minimal'][data-motif='lava'] .lava { opacity: 0.16; }

/* il filtro lavora su un livello a metà risoluzione poi ingrandito: stesso effetto, molto più leggero da calcolare */
.lava-inner {
  position: absolute; left: 0; top: 0; width: 50vw; height: 50vh;
  transform: scale(2); transform-origin: 0 0;
  filter: url(#goo);
}
.lava-inner i {
  --size: 12vmin; --x: 50%; --dur: 30s; --delay: 0s; --rise: -42vh; --sway: 3vw;
  --c1: var(--accent); --c2: var(--accent-2);
  position: absolute; bottom: calc(var(--size) * -0.4); left: var(--x);
  width: var(--size); height: var(--size); margin-left: calc(var(--size) / -2);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--c1) 70%, white), var(--c1) 45%, var(--c2));
  animation: lava-rise var(--dur) ease-in-out var(--delay) infinite;
  will-change: transform;
}
@keyframes lava-rise {
  0%   { transform: translate(0, 0) scale(1, 1); border-radius: 50%; }
  25%  { transform: translate(var(--sway), calc(var(--rise) * 0.45)) scale(0.92, 1.12); border-radius: 46% 54% 58% 42% / 58% 46% 54% 42%; }
  50%  { transform: translate(0, var(--rise)) scale(1.08, 0.94); border-radius: 54% 46% 42% 58% / 44% 56% 44% 56%; }
  75%  { transform: translate(calc(var(--sway) * -1), calc(var(--rise) * 0.5)) scale(0.95, 1.08); border-radius: 48% 52% 55% 45% / 52% 50% 50% 48%; }
  100% { transform: translate(0, 0) scale(1, 1); border-radius: 50%; }
}
/* "pozza" di lava sul fondo e una più piccola in alto: le gocce ci si staccano e ci rientrano */
.lava-inner i:nth-child(1) {
  --size: 34vmin; left: 50%; bottom: -28vmin; width: 70vw; margin-left: -35vw; border-radius: 50%;
  animation: lava-pool 18s ease-in-out infinite alternate;
}
.lava-inner i:nth-child(2) {
  --size: 22vmin; --c1: var(--accent-2); --c2: var(--accent);
  left: 50%; top: -17vmin; bottom: auto; width: 50vw; margin-left: -25vw;
  animation: lava-pool 22s ease-in-out infinite alternate-reverse;
}
@keyframes lava-pool {
  from { transform: translateX(-4vw) scale(1, 1); }
  to   { transform: translateX(4vw) scale(1.06, 0.9); }
}
.lava-inner i:nth-child(3)  { --size: 14vmin; --x: 12%; --dur: 34s; --delay: -4s;  --rise: -44vh; --sway: 2vw; }
.lava-inner i:nth-child(4)  { --size: 9vmin;  --x: 26%; --dur: 26s; --delay: -12s; --rise: -40vh; --sway: -3vw; --c1: var(--accent-2); --c2: var(--break); }
.lava-inner i:nth-child(5)  { --size: 17vmin; --x: 40%; --dur: 42s; --delay: -20s; --rise: -46vh; --sway: 4vw; }
.lava-inner i:nth-child(6)  { --size: 7vmin;  --x: 55%; --dur: 22s; --delay: -6s;  --rise: -38vh; --sway: -2vw; --c1: var(--break); --c2: var(--accent); }
.lava-inner i:nth-child(7)  { --size: 12vmin; --x: 68%; --dur: 31s; --delay: -16s; --rise: -45vh; --sway: 3vw; --c1: var(--accent-2); --c2: var(--accent); }
.lava-inner i:nth-child(8)  { --size: 15vmin; --x: 84%; --dur: 38s; --delay: -27s; --rise: -43vh; --sway: -4vw; }
.lava-inner i:nth-child(9)  { --size: 6vmin;  --x: 92%; --dur: 24s; --delay: -3s;  --rise: -36vh; --sway: -2vw; --c1: var(--break); --c2: var(--accent-2); }
.lava-inner i:nth-child(10) { --size: 8vmin;  --x: 6%;  --dur: 28s; --delay: -19s; --rise: -41vh; --sway: 3vw; --c1: var(--accent-2); --c2: var(--break); }
.lava-inner i:nth-child(11) { --size: 10vmin; --x: 48%; --dur: 36s; --delay: -30s; --rise: -47vh; --sway: -3vw; --c1: var(--accent); --c2: var(--break); }

/* anteprima nel menu */
.mp[data-m='lava'] {
  background-image:
    radial-gradient(circle at 30% 70%, color-mix(in oklab, var(--accent) 75%, transparent) 0 22%, transparent 24%),
    radial-gradient(circle at 46% 46%, color-mix(in oklab, var(--accent) 75%, transparent) 0 14%, transparent 16%),
    radial-gradient(circle at 72% 32%, color-mix(in oklab, var(--accent-2) 75%, transparent) 0 17%, transparent 19%),
    radial-gradient(ellipse 80% 30% at 50% 108%, color-mix(in oklab, var(--accent) 75%, transparent) 0 70%, transparent 72%);
}

/* nessuna animazione per chi ha ridotto i movimenti: gocce ferme */
@media (prefers-reduced-motion: reduce) {
  .lava-inner i { animation: none !important; }
}

/* lo stile Minimal resta pulito: motivo molto più leggero */
[data-style='minimal'] body::before { opacity: 0.5; }

/* ======================= PREMI DEI GRADI ======================= */
/* --- avatar = emblema del grado (esagono), uguale per tutti --- */
@property --fa { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.avatar.avatar-rank { border-radius: 0; background: none; isolation: isolate; color: #fff; box-shadow: none; }
.avatar-hex {
  position: absolute; inset: 0; display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background:
    radial-gradient(circle at 35% 25%, rgb(255 255 255 / 0.45), transparent 45%),
    linear-gradient(150deg, var(--rc2), var(--rc1));
}
.avatar-hex svg { width: 56%; height: 56%; stroke-width: 2.2; filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / 0.35)); }
.avatar-rank .status-dot { z-index: 2; }
.avatar-stack .avatar.avatar-rank { border: 0; margin-left: -6px; }
.avatar-lg.avatar-rank { box-shadow: none; filter: drop-shadow(0 6px 14px rgb(0 0 0 / 0.35)); }
.status-break .avatar.avatar-rank, .status-due .avatar.avatar-rank { box-shadow: none; filter: drop-shadow(0 0 5px var(--phase-ring, var(--break))); }
.avatar-btn .avatar-rank { width: 38px; height: 38px; }

/* --- cornici: un esagono più grande dietro l'emblema --- */
.avatar[data-frame]::before {
  content: ''; position: absolute; inset: -4px; z-index: -1; pointer-events: none;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.avatar[data-frame='bronze']::before { background: conic-gradient(#7c3f10, #e7a868, #8a4a17, #d18a45, #7c3f10); }
.avatar[data-frame='silver']::before { background: conic-gradient(#6b7280, #f8fafc, #9ca3af, #e5e7eb, #6b7280); }
.avatar[data-frame='gold']::before { background: conic-gradient(#a16207, #fde68a, #ca8a04, #fff7d1, #a16207); }
.avatar[data-frame='gold'] { filter: drop-shadow(0 0 4px rgb(250 204 21 / 0.55)); }
.avatar[data-frame='animated']::before { background: conic-gradient(from var(--fa), var(--accent), var(--accent-2), transparent 40%, var(--accent) 60%, var(--accent-2), transparent 90%, var(--accent)); animation: frame-turn 3s linear infinite; }
.avatar[data-frame='animated'] { filter: drop-shadow(0 0 5px var(--accent)); }
.avatar[data-frame='rainbow']::before { background: conic-gradient(from var(--fa), #f43f5e, #f59e0b, #facc15, #22c55e, #06b6d4, #6366f1, #d946ef, #f43f5e); animation: frame-turn 4s linear infinite; }
.avatar[data-frame='rainbow'] { filter: drop-shadow(0 0 6px rgb(255 255 255 / 0.4)); }
@keyframes frame-turn { to { --fa: 360deg; } }

/* ======================= FONDATORE (solo il creatore) ======================= */
.avatar.founder .avatar-hex {
  background:
    radial-gradient(circle at 35% 25%, rgb(255 255 255 / 0.5), transparent 45%),
    conic-gradient(from var(--fa), #6d28d9, #a855f7, #f59e0b, #fde68a, #f59e0b, #a855f7, #6d28d9);
  animation: frame-turn 6s linear infinite;
}
.avatar[data-frame='founder']::before {
  inset: -5px;
  background: conic-gradient(from var(--fa), #fde68a, #f59e0b, #7c3aed, #c084fc, #fde68a, #f59e0b, #7c3aed, #fde68a);
  animation: frame-turn 2.5s linear infinite;
}
.avatar[data-frame='founder'] { filter: drop-shadow(0 0 6px rgb(245 158 11 / 0.65)) drop-shadow(0 0 12px rgb(124 58 237 / 0.45)); }
/* scintilla che gira attorno */
.avatar[data-frame='founder']::after {
  content: ''; position: absolute; top: -6px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; z-index: 3;
  background: #fff; box-shadow: 0 0 6px 2px #fde68a; offset-path: none; animation: founder-spark 2.4s ease-in-out infinite;
}
@keyframes founder-spark { 0%, 100% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1); } }

.name-founder {
  background: linear-gradient(90deg, #fde68a, #f59e0b, #c084fc, #7c3aed, #f59e0b, #fde68a);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent !important;
  animation: founder-text 4s linear infinite; font-weight: 800;
}
@keyframes founder-text { to { background-position: -300% 0; } }
.bubble.bubble-founder {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--surface-3), var(--surface-3)) padding-box,
    linear-gradient(120deg, #fde68a, #f59e0b, #a855f7, #6d28d9) border-box;
  box-shadow: 0 4px 18px -6px rgb(245 158 11 / 0.5);
}
.msg.mine .bubble.bubble-founder {
  color: #fff;
  background:
    linear-gradient(135deg, #6d28d9, #a855f7 55%, #d97706) padding-box,
    linear-gradient(120deg, #fde68a, #f59e0b, #c084fc) border-box;
}
.tm-rank.tm-founder { color: #fff; background: linear-gradient(120deg, #6d28d9, #a855f7, #d97706); box-shadow: 0 0 10px rgb(245 158 11 / 0.35); }
.rank-badge.founder { background: radial-gradient(circle at 35% 25%, rgb(255 255 255 / 0.5), transparent 45%), conic-gradient(from var(--fa), #6d28d9, #a855f7, #f59e0b, #fde68a, #f59e0b, #a855f7, #6d28d9); animation: frame-turn 6s linear infinite; }

/* sezione esclusiva nella finestra dei premi */
.reward-section.founder-section { margin: 6px 0 8px; padding: 16px 14px 14px; border: 0; border-radius: 18px; background: linear-gradient(135deg, rgb(109 40 217 / 0.18), rgb(245 158 11 / 0.12)); box-shadow: inset 0 0 0 1px rgb(245 158 11 / 0.35); }
.founder-section h3 { background: linear-gradient(90deg, #fde68a, #f59e0b, #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.founder-section h3::before { content: '🚀 '; -webkit-text-fill-color: initial; }
.reward-opt.founder-opt[aria-pressed='true'] { border-color: #f59e0b; background: color-mix(in oklab, #f59e0b 12%, var(--surface-2)); }
.reward-opt.founder-opt[aria-pressed='true']::after { color: #f59e0b; }
.founder-state { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.founder-opt[aria-pressed='true'] .founder-state { color: #f59e0b; }
.founder-name-preview { font-size: 1.05rem; }
.founder-bubble-preview { display: inline-block; padding: 6px 12px; border-radius: 14px; font-size: 0.85rem; }

/* --- lucchetti nei menu --- */
.lock-tag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 99px; font-size: 0.62rem; font-weight: 700; color: var(--text-2); background: color-mix(in oklab, var(--text) 12%, transparent); }
.lock-tag svg { width: 10px; height: 10px; stroke-width: 2.6; }
.theme-opt.exclusive, .motif-opt.exclusive { position: relative; }
.theme-opt.exclusive .lock-tag, .motif-opt.exclusive .lock-tag { position: absolute; top: 4px; right: 4px; }
.theme-opt.exclusive:not(.locked) .lock-tag, .motif-opt.exclusive:not(.locked) .lock-tag { display: none; }
.theme-opt.exclusive:not(.locked)::after { content: '★'; position: absolute; top: 3px; right: 6px; font-size: 0.7rem; color: #facc15; }
.theme-opt.locked, .motif-opt.locked { opacity: 0.55; filter: grayscale(0.6); }
.theme-opt.locked:hover, .motif-opt.locked:hover { transform: none; }

/* --- pulsante nel profilo --- */
.btn-rewards { background: linear-gradient(135deg, #f59e0b, var(--accent)); color: #fff; }

/* --- finestra "I tuoi premi" --- */
.rewards-sheet { width: min(760px, calc(100% - 24px)); }
.rewards-sub { margin-top: 2px; font-size: 0.85rem; color: var(--text-2); }
.rewards-body { gap: 0; }
.reward-section { padding: 16px 0 14px; border-bottom: 1px dashed var(--border); }
.reward-section:last-child { border-bottom: 0; }
.reward-section h3 { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; }
.reward-section .hint { margin: 2px 0 10px; font-size: 0.8rem; }
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.reward-opt {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 7px; min-height: 92px; padding: 12px 6px 10px;
  border-radius: 14px; border: 2px solid transparent; background: var(--surface-2); color: var(--text); font-size: 0.78rem; font-weight: 600; text-align: center;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}
.reward-opt:hover { transform: translateY(-2px); background: var(--surface-3); }
.reward-opt[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, var(--surface-2)); }
.reward-opt[aria-pressed='true']::after { content: '✓'; position: absolute; top: 5px; left: 8px; font-size: 0.75rem; font-weight: 800; color: var(--accent); }
.reward-opt.locked { opacity: 0.6; }
.reward-opt.locked > :not(.lock-tag) { filter: grayscale(1); }
.reward-opt.locked:hover { transform: none; }
.reward-opt .lock-tag { position: absolute; top: 5px; right: 5px; }
.reward-name:empty { display: none; }
.reward-avatar { width: 40px; height: 40px; font-size: 0.85rem; }
.reward-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, transparent); }
.reward-icon svg { width: 22px; height: 22px; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--border); }
.reward-opt .theme-swatch i { width: 20px; height: 20px; }

/* --- stili del countdown --- */
body[data-countdown='lcd'] .countdown, .cd-preview[data-countdown='lcd'] {
  font-family: var(--font-mono); font-weight: 500; font-style: italic; letter-spacing: 0.02em;
  color: var(--accent-2); text-shadow: 0 0 6px color-mix(in oklab, var(--accent-2) 80%, transparent), 0 0 22px color-mix(in oklab, var(--accent-2) 45%, transparent);
  transform: skewX(-6deg);
}
body[data-countdown='lcd'] .cd-sec { color: color-mix(in oklab, var(--accent-2) 60%, transparent); }
body[data-countdown='neon'] .countdown, .cd-preview[data-countdown='neon'] {
  font-weight: 300; letter-spacing: 0; color: #fff;
  text-shadow: 0 0 4px #fff, 0 0 12px var(--accent), 0 0 26px var(--accent), 0 0 48px var(--accent-2);
  animation: neon-flicker 6s linear infinite;
}
@keyframes neon-flicker { 0%, 92%, 96%, 100% { opacity: 1; } 93%, 95% { opacity: 0.55; } 94% { opacity: 0.9; } }
body[data-countdown='flip'] .countdown { font-size: calc(var(--ring) * 0.15); letter-spacing: 0; }
body[data-countdown='flip'] .countdown[data-size='hours'] { font-size: calc(var(--ring) * 0.13); }
.flip-d {
  position: relative; display: inline-block; min-width: 0.66em; margin: 0 0.025em; padding: 0.06em 0.04em; text-align: center; border-radius: 0.12em;
  color: var(--text); background: linear-gradient(180deg, var(--surface-3) 0 50%, color-mix(in oklab, var(--surface-3) 80%, #000) 50% 100%);
  box-shadow: 0 0.06em 0.12em rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.06);
  transform-origin: 50% 50%;
}
.flip-d::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: color-mix(in oklab, var(--bg) 70%, transparent); }
.flip-d.flipping { animation: flip-in 0.45s var(--ease) both; }
@keyframes flip-in { 0% { transform: perspective(300px) rotateX(-90deg); filter: brightness(1.5); } 100% { transform: perspective(300px) rotateX(0); } }
.flip-sep { display: inline-block; margin: 0 0.02em; opacity: 0.7; }
.cd-preview { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700; line-height: 1.6; }
.cd-preview[data-countdown='flip'] { padding: 0 6px; border-radius: 6px; background: linear-gradient(180deg, var(--surface-3) 0 50%, color-mix(in oklab, var(--surface-3) 80%, #000) 50% 100%); }

/* --- reazioni e azioni sui messaggi --- */
.msg { flex-wrap: wrap; }
.bubble { position: relative; }
/* il messaggio con il menu aperto sta sopra ai successivi (ogni riga animata crea un suo livello) */
.msg.picker-open, .msg:hover { z-index: 5; }
.reactions { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 3px 0 0 40px; }
.msg.mine .reactions { justify-content: flex-end; margin: 3px 40px 0 0; }
.msg.grouped .reactions { margin-left: 40px; }
.msg.mine.grouped .reactions { margin-left: 0; }
.reaction { padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); font-size: 0.78rem; line-height: 1.5; transition: transform 0.15s var(--ease-spring), border-color 0.2s; }
.reaction:hover { transform: scale(1.08); }
.reaction.mine { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, var(--surface-2)); }

/* barra sovrapposta accanto alla bolla: compare passando sopra, non occupa spazio */
.msg-tools {
  position: absolute; top: 50%; left: calc(100% + 6px); transform: translateY(-50%);
  display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.msg.mine .msg-tools { left: auto; right: calc(100% + 6px); }
.msg:hover .msg-tools, .msg.picker-open .msg-tools, .msg-tools:focus-within { opacity: 1; pointer-events: auto; }
.msg-tools button { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 0.95rem; line-height: 1; }
.msg-tools button:hover { background: var(--surface-2); color: var(--text); }
.msg-tools svg { width: 14px; height: 14px; }
/* il cestino c'è solo tenendo premuto Maiusc */
.tool-del { display: none !important; }
.shift-held .tool-del { display: grid !important; color: var(--danger) !important; }
.shift-held .msg.deletable:hover .bubble { outline: 2px solid color-mix(in oklab, var(--danger) 70%, transparent); outline-offset: 2px; }
.shift-held .msg.deletable:hover .tool-react { display: none; }
@media (hover: none) { .msg-tools { display: none; } }

/* menu delle reazioni: dentro la chat, mai fuori dal bordo */
.react-picker {
  position: absolute; bottom: calc(100% - 4px); left: 40px; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 34px); gap: 2px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: pop 0.15s var(--ease) both;
}
.react-picker.below { bottom: auto; top: calc(100% - 4px); }
.msg.mine .react-picker { left: auto; right: 40px; }
.react-picker button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; font-size: 1.15rem; transition: transform 0.15s var(--ease-spring), background 0.15s; }
.react-picker button:hover { transform: scale(1.18); background: var(--surface-2); }
.react-picker button.locked { filter: grayscale(1); opacity: 0.35; }
.react-picker .picker-del { grid-column: 1 / -1; width: auto; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: 0.85rem; font-weight: 700; color: var(--danger); background: color-mix(in oklab, var(--danger) 10%, transparent); }
.react-picker .picker-del svg { width: 15px; height: 15px; }

/* --- effetto del collega nella riga "è in pausa" --- */
.sys-msg[class*='fx-']::after { margin-left: 2px; font-size: 0.9rem; animation: fx-pop 0.9s var(--ease-spring) both; }
.sys-msg.fx-confetti::after { content: '🎊'; }
.sys-msg.fx-bubbles::after { content: '🫧'; }
.sys-msg.fx-fireworks::after { content: '🎆'; }
.sys-msg.fx-coffee::after { content: '☕'; }
.sys-msg.fx-founder::after { content: '🚀'; }
@keyframes fx-pop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.4) rotate(10deg); } 100% { transform: scale(1); } }

/* --- canvas degli effetti --- */
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; margin: 0; padding: 0; border: 0; background: transparent; pointer-events: none; z-index: 500; max-width: none; max-height: none; overflow: visible; }

/* --- temi esclusivi --- */
[data-theme='gold'] {
  --bg: #120d06; --bg-grad-1: #3d2a0a; --bg-grad-2: #2a1d05;
  --surface: #1b140a; --surface-2: #241a0d; --surface-3: #302311;
  --border: #4a3714; --text: #fff8e6; --text-2: #e5cf9a; --text-3: #a88d55;
  --accent: #f5c451; --accent-2: #fff1c1; --on-accent: #2a1c02;
  --break: #fde68a; --lunch: #fb923c; --work: #f5c451; --danger: #f87171;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.7);
  --glow: 0 0 22px rgb(245 196 81 / 0.45);
}
[data-theme='galaxy'] {
  --bg: #05030f; --bg-grad-1: #2a0f5c; --bg-grad-2: #072a4a;
  --surface: #0c0a1e; --surface-2: #14112b; --surface-3: #1d1940;
  --border: #2a2556; --text: #f1edff; --text-2: #b9b0e8; --text-3: #7d74b0;
  --accent: #8b5cf6; --accent-2: #38bdf8; --on-accent: #ffffff;
  --break: #38bdf8; --lunch: #f472b6; --work: #8b5cf6; --danger: #fb7185;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.8);
  --glow: 0 0 26px rgb(139 92 246 / 0.5);
}
[data-theme='galaxy'] body {
  background:
    radial-gradient(900px 500px at 80% 10%, rgb(139 92 246 / 0.35), transparent 60%),
    radial-gradient(700px 500px at 10% 90%, rgb(56 189 248 / 0.25), transparent 60%),
    radial-gradient(500px 300px at 50% 50%, rgb(244 114 182 / 0.12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme='holo'] {
  --bg: #0d0f1f; --bg-grad-1: #3b1d52; --bg-grad-2: #0f3b4a;
  --surface: #141729; --surface-2: #1c2036; --surface-3: #262b46;
  --border: #343a5c; --text: #f8f5ff; --text-2: #c7c3e6; --text-3: #8a86b0;
  --accent: #f0abfc; --accent-2: #67e8f9; --on-accent: #1a0f24;
  --break: #67e8f9; --lunch: #fcd34d; --work: #f0abfc; --danger: #fb7185;
  --shadow: 0 20px 60px -20px rgb(0 0 0 / 0.7);
  --glow: 0 0 24px rgb(240 171 252 / 0.45), 0 0 50px rgb(103 232 249 / 0.2);
}
[data-theme='holo'] .timeline-card, [data-theme='holo'] .stat, [data-theme='holo'] .team-card, [data-theme='holo'] .hello-card {
  border-image: linear-gradient(120deg, #f0abfc, #67e8f9, #fcd34d, #f0abfc) 1;
  border-radius: 0;
}
[data-theme='holo'] .brand-mark, [data-theme='holo'] .btn-primary { background: linear-gradient(120deg, #f0abfc, #a5b4fc, #67e8f9, #fcd34d); background-size: 200% 100%; animation: holo-shift 6s linear infinite; color: #1a0f24; }
@keyframes holo-shift { to { background-position: -200% 0; } }

/* --- motivo Lava dorata: la stessa lampada di lava, in oro --- */
[data-motif='lava-gold'] body::before {
  background:
    radial-gradient(ellipse 60% 35% at 50% 105%, rgb(245 158 11 / 0.2), transparent 70%),
    radial-gradient(ellipse 50% 25% at 50% -5%, rgb(253 224 71 / 0.12), transparent 70%);
  -webkit-mask-image: none; mask-image: none;
}
[data-motif='lava-gold'] .lava {
  display: block; position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; opacity: 0.32;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 45% 45%, rgb(0 0 0 / 0.35), #000 85%);
  mask-image: radial-gradient(ellipse 70% 75% at 45% 45%, rgb(0 0 0 / 0.35), #000 85%);
}
[data-motif='lava-gold'] .lava-inner i:nth-child(n) { --c1: #f59e0b; --c2: #fde047; }
[data-motif='lava-gold'] .lava-inner i:nth-child(3n) { --c1: #fbbf24; --c2: #b45309; }
.mp[data-m='lava-gold'] {
  background-image:
    radial-gradient(circle at 30% 70%, #f59e0b 0 22%, transparent 24%),
    radial-gradient(circle at 46% 46%, #fbbf24 0 14%, transparent 16%),
    radial-gradient(circle at 72% 32%, #fde047 0 17%, transparent 19%),
    radial-gradient(ellipse 80% 30% at 50% 108%, #f59e0b 0 70%, transparent 72%);
}

/* ======================= RESPONSIVE ======================= */
@media (max-width: 1180px) { :root { --chat-w: 340px; } }
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .chat-toggle { display: inline-grid; }
  .chat-close { display: inline-grid; }
  .chat {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
    width: min(420px, 100%); height: 100dvh;
    transform: translateX(100%); transition: transform 0.35s var(--ease);
    box-shadow: var(--shadow);
  }
  body.chat-open .chat { transform: none; }
  .theme-menu { right: 12px; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .brand-name { display: none; }
  #now-date { display: none; }
  .stage { padding: 20px 14px 32px; gap: 22px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; }
  .stat-icon { display: none; }
  .stat-label { font-size: 0.72rem; }
  .stat-value { font-size: 0.86rem; }
  .hello-card { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 18px; }
  .timeline-card { padding: 16px 16px 46px; }
  .tl-label:not(.edge-start):not(.edge-end) { font-size: 0; }
  .tl-label:not(.edge-start):not(.edge-end) b { font-size: 0.68rem; }
  .theme-menu { width: calc(100vw - 24px); }
  .break-row { grid-template-columns: 1fr 10px 1fr 36px; }
  .break-row input[type='time'] { min-width: 0; width: 100%; }
  .break-row .break-name { grid-column: 1 / -1; }
  .break-row .tag { display: none; }
  .lunch-day { flex-wrap: wrap; }
  .sheet-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .alert-particles { display: none; }
}
