/* ════════════════════════════════════════════════════════════
   Mos.AI: pulsante nella barra in alto, pagina /mosaic, consenso OAuth
   ════════════════════════════════════════════════════════════ */

/* ── Marchio ── */
.mosaic-word { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; letter-spacing: -.03em; }
.mosaic-word b {
    font-weight: 700;
    background: linear-gradient(100deg, #a78bfa, #f472b6 45%, #fb923c 90%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    background-size: 200% 100%; animation: ms-shine 6s linear infinite;
}
@keyframes ms-shine { to { background-position: -200% 0; } }

/* ── Pulsante nella barra in alto ── */
.mosaic-btn {
    position: relative; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px;
    border-radius: 999px; font-size: 13.5px; color: var(--text); isolation: isolate; white-space: nowrap;
    background: var(--surface-solid); transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s;
    box-shadow: 0 6px 22px -10px rgba(236, 72, 153, .8);
}
.mosaic-btn::before {
    /* bordo luminoso che gira */
    content: ""; position: absolute; inset: -1.5px; border-radius: inherit; z-index: -2;
    background: conic-gradient(from var(--ms-angle, 0deg), #8b5cf6, #ec4899, #f97316, #06b6d4, #8b5cf6);
    animation: ms-spin 4s linear infinite;
}
.mosaic-btn::after { content: ""; position: absolute; inset: 1px; border-radius: inherit; z-index: -1; background: var(--surface-solid); }
.mosaic-btn .ic { width: 16px; height: 16px; color: #f472b6; animation: ms-twinkle 2.4s ease-in-out infinite; }
.mosaic-btn .mosaic-word { font-size: 14.5px; }
.mosaic-btn:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 10px 30px -10px rgba(236, 72, 153, 1), 0 0 0 4px rgba(139, 92, 246, .12); }
.mosaic-btn:hover::before { animation-duration: 1.6s; }
.mosaic-btn.active::after { background: linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(236, 72, 153, .18)), var(--surface-solid); }
@property --ms-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes ms-spin { to { --ms-angle: 360deg; } }
@keyframes ms-twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(1.2) rotate(18deg); opacity: .8; } }
@media (max-width: 760px) {
    .mosaic-btn { padding: 0 10px; height: 34px; }
    .mosaic-btn .mosaic-word { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .mosaic-btn::before, .mosaic-btn .ic, .mosaic-word b, .ms-tiles i, .ms-wire i { animation: none !important; }
}

/* ── Pagina ── */
.ms { display: flex; flex-direction: column; gap: 22px; max-width: 1240px; margin: 0 auto; }

.ms-hero {
    position: relative; overflow: hidden; border-radius: 26px; padding: 44px 44px 40px;
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: center;
    background:
        radial-gradient(700px 420px at 100% 0%, rgba(236, 72, 153, .28), transparent 62%),
        radial-gradient(600px 420px at 0% 100%, rgba(6, 182, 212, .20), transparent 65%),
        linear-gradient(140deg, #15102b 0%, #1d1240 50%, #2a0f33 100%);
    color: #f4f4f8; border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 30px 80px -30px rgba(76, 29, 149, .6);
}
.ms-tiles { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: 1fr; gap: 6px; padding: 6px; opacity: .55; pointer-events: none; mask-image: linear-gradient(100deg, transparent 0%, #000 45%, transparent 100%); -webkit-mask-image: linear-gradient(100deg, transparent 0%, #000 45%, transparent 100%); }
.ms-tiles i { border-radius: 7px; background: var(--c); opacity: 0; animation: ms-tile 6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes ms-tile { 0%, 100% { opacity: 0; transform: scale(.85); } 45% { opacity: .22; transform: scale(1); } 60% { opacity: .1; } }
.ms-hero__text, .ms-chat { position: relative; z-index: 1; }
.ms-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #f9a8d4; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); padding: 6px 12px; border-radius: 999px; }
.ms-kicker .ic { width: 15px; height: 15px; }
.ms-word { font-size: clamp(56px, 8vw, 96px); line-height: .95; margin: 18px 0 10px; color: #fff; }
.ms-claim { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; letter-spacing: -.02em; }
.ms-claim em { font-style: normal; background: linear-gradient(90deg, #67e8f9, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ms-lead { margin-top: 14px; font-size: 15.5px; line-height: 1.65; color: rgba(244, 244, 248, .82); max-width: 560px; }
.ms-lead b { color: #fff; }
.ms-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.ms-btn-big { height: 46px; padding: 0 20px; font-size: 14.5px; border-radius: 14px; }
.ms-hero .btn:not(.btn-primary) { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff; }
.ms-hero .btn:not(.btn-primary):hover { background: rgba(255, 255, 255, .14); }
.ms-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 26px; font-size: 12.5px; color: rgba(244, 244, 248, .6); }
.ms-logos b { color: rgba(244, 244, 248, .92); font-weight: 600; padding: 3px 10px; border-radius: 8px; background: rgba(255, 255, 255, .07); }
.ms-logos .muted { color: rgba(244, 244, 248, .55); }

/* chat d'esempio */
.ms-chat { background: #f7f6fc; color: #16142a; border-radius: 20px; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6); overflow: hidden; }
.ms-chat__bar { display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; background: #fff; border-bottom: 1px solid #ebe8f5; font-size: 12.5px; font-weight: 600; color: #6b6889; }
.ms-chat__bar i { width: 10px; height: 10px; border-radius: 50%; background: #e2dff0; }
.ms-chat__bar span { margin-left: 8px; }
.ms-chat__bar em { margin-left: auto; font-style: normal; display: inline-flex; align-items: center; gap: 5px; color: #7c3aed; background: #f1ebff; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; }
.ms-chat__bar em .ic { width: 13px; height: 13px; }
.ms-chat__body { display: flex; flex-direction: column; gap: 10px; padding: 18px; min-height: 330px; }
.ms-chat > small { display: block; text-align: right; padding: 0 14px 10px; font-size: 10.5px; color: #9a97b2; }
.ms-msg, .ms-tool { opacity: 0; animation: ms-in .55s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: var(--d); }
@keyframes ms-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.ms-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; }
.ms-msg--me { align-self: flex-end; background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; border-bottom-right-radius: 5px; font-weight: 500; }
.ms-msg--ai { align-self: flex-start; background: #fff; border: 1px solid #ebe8f5; border-bottom-left-radius: 5px; }
.ms-mini { display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 6px 10px; background: #f7f6fc; border-radius: 10px; font-size: 12.5px; }
.ms-mini b { font-family: 'Space Grotesk', sans-serif; color: #7c3aed; }
.ms-pill { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ms-pill--red { background: #ffe4e9; color: #e11d48; }
.ms-pill--amber { background: #fff3d6; color: #b45309; }
.ms-tool { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; color: #6d28d9; background: #f1ebff; border: 1px solid #e0d4ff; padding: 5px 12px 5px 8px; border-radius: 999px; }
.ms-tool code { font-size: 11.5px; color: #4c1d95; }
.ms-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #c4b5fd; border-top-color: #7c3aed; animation: ms-rot .8s linear infinite; }
@keyframes ms-rot { to { transform: rotate(360deg); } }

/* pilastri */
.ms-pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ms-pillars > div { padding: 18px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.ms-pillars b { display: block; color: var(--text); font-family: 'Space Grotesk', sans-serif; font-size: 16px; margin: 10px 0 4px; }
.ms-ico { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--grad-soft); border: 1px solid rgba(139, 92, 246, .3); color: var(--accent); }

/* sezioni */
.ms-sec { padding: 28px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); }
.ms-sec__head { margin-bottom: 20px; }
.ms-sec__head h2 { font-size: 24px; }
.ms-sec__head p { color: var(--muted); margin-top: 6px; max-width: 760px; line-height: 1.6; }
.ms-sec__head abbr { text-decoration: underline dotted; cursor: help; }

.ms-video { border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 24px 60px -24px rgba(76, 29, 149, .7); aspect-ratio: 16 / 9; }
.ms-video video { width: 100%; height: 100%; display: block; }

/* come funziona */
.ms-flow { display: flex; align-items: stretch; gap: 0; }
.ms-node { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 12px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); }
.ms-node > span { font-size: 30px; line-height: 1.2; height: 38px; }
.ms-node > span.mosaic-word { font-size: 28px; }
.ms-node b { font-family: 'Space Grotesk', sans-serif; font-size: 15px; }
.ms-node small { color: var(--muted); font-size: 12px; }
.ms-node--accent { background: var(--grad-soft); border-color: rgba(236, 72, 153, .4); box-shadow: var(--shadow-glow); }
.ms-wire { flex: 0 0 46px; position: relative; align-self: center; height: 2px; background: linear-gradient(90deg, var(--border-strong), var(--border-strong)); }
.ms-wire i { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: ms-wire 1.8s linear infinite; }
@keyframes ms-wire { from { left: 0; } to { left: calc(100% - 8px); } }

/* argomenti */
.ms-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.ms-topic { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); transition: transform .2s, border-color .2s, box-shadow .2s; }
.ms-topic:hover { transform: translateY(-2px); border-color: rgba(139, 92, 246, .45); box-shadow: 0 16px 40px -22px rgba(139, 92, 246, .7); }
.ms-topic header { display: flex; align-items: center; gap: 10px; }
.ms-topic h3 { font-size: 16px; }
.ms-topic__ico { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); }
.ms-topic p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.ms-lock { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); padding: 3px 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.ms-lock .ic { width: 12px; height: 12px; }
.ms-qs { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.ms-q { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; font: inherit; font-size: 13px; color: var(--text); padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; }
button.ms-q:hover { background: var(--grad-soft); border-color: rgba(139, 92, 246, .35); }
.ms-q .ic { width: 14px; height: 14px; opacity: 0; color: var(--accent); transition: opacity .15s; }
button.ms-q:hover .ic { opacity: 1; }
.ms-topic.is-off { opacity: .55; }
.ms-topic.is-off:hover { transform: none; box-shadow: none; border-color: var(--border); }
.ms-topic.is-off .ms-q { cursor: default; }
.ms-note { margin-top: 16px; font-size: 13px; color: var(--muted); }
.ms-note b { color: var(--text-2); }

/* collegamento */
.ms-url { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: 16px; background: var(--grad-soft); border: 1px solid rgba(139, 92, 246, .35); margin-bottom: 18px; }
.ms-url__label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.ms-url code { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; min-width: 200px; word-break: break-all; }
.ms-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ms-tab { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2); padding: 9px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; transition: all .15s; }
.ms-tab:hover { color: var(--text); border-color: var(--border-strong); }
.ms-tab.active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 8px 22px -10px rgba(236, 72, 153, .8); }
.ms-panel { padding: 22px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); animation: ms-in .35s ease both; }
.ms-steps-wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; }
.ms-steps { list-style: none; margin: 0; padding: 0; counter-reset: ms; display: flex; flex-direction: column; gap: 16px; }
.ms-steps > li { counter-increment: ms; position: relative; padding-left: 46px; line-height: 1.6; color: var(--text-2); font-size: 14px; }
.ms-steps > li::before { content: counter(ms); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: #fff; background: var(--grad); }
.ms-steps b { color: var(--text); }
.ms-steps a { color: var(--accent); text-decoration: underline; }
.ms-aside { padding: 16px 18px; border-radius: 14px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.ms-aside h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.ms-aside ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.ms-code { position: relative; margin-top: 8px; border-radius: 12px; background: #0f0d1c; border: 1px solid rgba(255, 255, 255, .08); }
.ms-code pre { margin: 0; padding: 12px 52px 12px 14px; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; color: #e9e6ff; white-space: pre-wrap; word-break: break-all; }
.ms-code .btn { position: absolute; top: 7px; right: 7px; }
.ms-code:not(.ms-code--token) .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }

/* collegamenti */
.ms-links-grid .card h3 { font-size: 16px; }
.ms-fresh { margin: 12px 0; padding: 14px; border-radius: 14px; background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .35); font-size: 13px; }
.ms-fresh small { color: var(--muted); }
.ms-link { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); margin-top: 10px; }
.ms-link__ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 18px; }
.ms-empty { padding: 18px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; }
.ms-usage { display: flex; flex-direction: column; }
.ms-use { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ms-use:first-child { border-top: 0; }
.ms-use__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.ms-use.is-err .ms-use__dot { background: var(--danger); }

/* da sapere */
.ms-know { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ms-know > div { padding: 16px 18px; border-radius: 16px; background: var(--surface-2); }
.ms-know h3 { font-size: 15px; margin-bottom: 6px; }
.ms-know p { color: var(--text-2); font-size: 13px; line-height: 1.6; }
.ms-faq { margin-top: 16px; border-radius: 14px; border: 1px solid var(--border); padding: 4px 16px; }
.ms-faq summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.ms-faq dl { margin: 0 0 12px; }
.ms-faq dt { font-weight: 600; margin-top: 10px; }
.ms-faq dd { margin: 2px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }

@media (max-width: 1000px) {
    .ms-hero { grid-template-columns: 1fr; padding: 32px 26px; }
    .ms-steps-wrap { grid-template-columns: 1fr; }
    .ms-flow { flex-direction: column; }
    .ms-wire { flex: 0 0 26px; width: 2px; height: auto; align-self: center; }
    .ms-wire i { animation-name: ms-wire-v; left: -3px; }
    @keyframes ms-wire-v { from { top: 0; } to { top: calc(100% - 8px); } }
}
@media (max-width: 760px) {
    .ms-pillars, .ms-know { grid-template-columns: 1fr; }
    .ms-sec { padding: 20px 16px; }
    .ms-hero { padding: 26px 18px; border-radius: 20px; }
    .ms-chat__body { min-height: 0; }
}

/* ── Pagina del consenso OAuth (/oauth/authorize) ── */
.oa-body { display: grid; place-items: center; padding: 24px 16px; }
.oa-card { width: 100%; max-width: 480px; padding: 30px 28px; border-radius: 24px; background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow); }
.oa-brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 22px; }
.oa-brand .mosaic-word { font-size: 28px; }
.oa-brand small { color: var(--muted); }
.oa-app { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.oa-logo { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; color: #fff; background: var(--grad); box-shadow: 0 10px 30px -10px rgba(236, 72, 153, .8); font-family: 'Space Grotesk', sans-serif; font-weight: 700; }
.oa-logo--client { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.oa-link { width: 60px; height: 2px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 10px); }
.oa-card h1 { font-size: 22px; text-align: center; line-height: 1.3; }
.oa-sub { text-align: center; color: var(--muted); margin-top: 6px; }
.oa-sub b { color: var(--text); }
.oa-list { list-style: none; padding: 0; margin: 22px 0; display: flex; flex-direction: column; gap: 12px; }
.oa-list li { display: flex; gap: 12px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.oa-list li > span { font-size: 18px; }
.oa-list b { display: block; color: var(--text); }
.oa-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oa-actions .btn { height: 44px; justify-content: center; }
.oa-foot { margin-top: 14px; text-align: center; font-size: 12px; color: var(--muted); }
.oa-card p { line-height: 1.6; color: var(--text-2); }
