/* Area clienti StudioFlow — mobile-first, nessuna build */
:root {
    --brand: #0d9488;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 76px; /* spazio per la bottom nav */
}

/* ------------------------------------------------------------- Header */
.topbar {
    background: var(--brand);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.topbar .brand img { max-height: 32px; border-radius: 6px; }
.topbar form button {
    background: rgb(255 255 255 / .15);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
}

main { max-width: 640px; margin: 0 auto; padding: 16px; }

h1 { font-size: 20px; margin-bottom: 4px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.sub { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }

/* ------------------------------------------------------------- Flash */
.flash { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.flash.ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.flash.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.flash.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ------------------------------------------------------------- Card */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}

.day-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    margin: 18px 0 8px;
}

.lesson { display: flex; align-items: center; gap: 12px; }
.lesson .dot { width: 10px; height: 42px; border-radius: 5px; flex-shrink: 0; }
.lesson .info { flex: 1; min-width: 0; }
.lesson .info .name { font-weight: 700; font-size: 15px; }
.lesson .info .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.lesson .side { text-align: right; flex-shrink: 0; }
.lesson .posti { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* ------------------------------------------------------------- Bottoni */
.btn {
    display: inline-block;
    border: 0;
    border-radius: 9px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn.brand { background: var(--brand); color: #fff; }
.btn.ghost { background: transparent; color: var(--danger); border: 1px solid #fecaca; }
.btn.gray { background: #f1f5f9; color: #334155; border: 1px solid var(--border); }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------- Badge */
.badge {
    display: inline-block;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
}
.badge.ok { background: #ecfdf5; color: #065f46; }
.badge.warn { background: #fffbeb; color: #92400e; }
.badge.err { background: #fef2f2; color: #991b1b; }
.badge.gray { background: #f1f5f9; color: #475569; }

/* ------------------------------------------------------------- Form */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel] {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
}
input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.errore { color: var(--danger); font-size: 12.5px; margin-top: 3px; }

/* ------------------------------------------------------------- Login */
.auth-wrap { max-width: 400px; margin: 8vh auto 0; padding: 0 16px; }
.auth-card { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 4px 24px rgb(30 41 59 / .08); }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo img { max-height: 56px; }
.auth-logo .nome { font-size: 22px; font-weight: 800; color: var(--brand); }
.auth-links { text-align: center; margin-top: 16px; font-size: 13.5px; }
.auth-links a { color: var(--brand); }

/* ------------------------------------------------------------- Bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 9px 4px 7px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.bottom-nav a .ico { display: block; font-size: 21px; line-height: 1.2; }
.bottom-nav a.active { color: var(--brand); }

/* ------------------------------------------------------------- Righe dato */
.rows .row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.rows .row:last-child { border-bottom: 0; }
.rows .row .k { color: var(--muted); }
.rows .row .v { font-weight: 600; text-align: right; }

@media (min-width: 640px) {
    main { padding: 24px 16px; }
}

/* ------------------------------------------------------ Modale conferma */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    pointer-events: none;
}
.modal.open { visibility: visible; pointer-events: auto; }

.modal .backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / .5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .22s ease;
}
.modal.open .backdrop { opacity: 1; }

.modal .sheet {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 22px 22px 0 0;
    padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 40px rgb(15 23 42 / .25);
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
}
.modal.open .sheet { transform: translateY(0); }

.modal .grip {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 0 auto 16px;
}
.modal .m-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 2px auto 12px;
    background: color-mix(in srgb, var(--brand) 14%, #fff);
}
.modal .m-icon.danger { background: #fef2f2; }
.modal h3 { font-size: 18px; text-align: center; margin-bottom: 6px; }
.modal .m-text { text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.5; margin-bottom: 20px; }
.modal .m-actions { display: flex; flex-direction: column; gap: 10px; }
.modal .m-actions .btn { padding: 14px 16px; font-size: 15px; }
.modal .btn.danger { background: var(--danger); color: #fff; }

@media (min-width: 640px) {
    .modal { align-items: center; }
    .modal .sheet { border-radius: 20px; padding-bottom: 22px; }
    .modal .grip { display: none; }
    .modal .m-actions { flex-direction: row-reverse; }
    .modal .m-actions .btn { flex: 1; }
}

/* Rispetta chi preferisce meno animazioni */
@media (prefers-reduced-motion: reduce) {
    .modal .sheet, .modal .backdrop { transition: none; }
}
