body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #F8F8F8;
}

:root {
    --ct-ink: #1A2740;
    --ct-navy: #1A2740;
    --ct-accent: #1D7BAD;
    --ct-bronze: #C47A2C;
    --ct-amber: #C47A2C;
    --ct-muted: #64748b;
    --ct-border: rgba(15, 23, 42, 0.08);
    --ct-paper: #F8F8F8;
}

.app-body { background: #F8F8F8; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1 1 auto; width: 100%; padding: 1.75rem 2rem 3rem; }

@media (max-width: 768px) {
    .app-main { padding: 1.25rem 1rem 2rem; }
}

.app-header {
    background: linear-gradient(135deg, #040A10, #3AA0D4);
    padding: 1rem 2rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: auto;
}

.nav-toggle {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: transparent;
    color: #fff;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font: inherit;
    font-weight: 600;
}

.brand-link {
    display: flex;
    align-items: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    text-decoration: none;
}
.brand-link:hover { text-decoration: none; }
.brand-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}
.guest-logo {
    display: block;
    margin: 0 auto;
    height: 56px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
}

.main-nav { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.main-nav a {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}
.main-nav a:hover, .main-nav a:focus { color: #fff; border-color: rgba(255, 255, 255, 0.35); text-decoration: none; }
.main-nav a.active { border-color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.15); color: #fff; }

.user-pill { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; color: #fff; }

@media (max-width: 992px) {
    .app-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
    .brand { width: 100%; }
    .nav-toggle { display: inline-flex; }
    .main-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        padding: 0.25rem 0 0.5rem;
    }
    .main-nav.is-open { display: flex; }
    .main-nav a { text-align: center; padding: 0.7rem 1rem; }
    .user-pill { margin-left: 0; justify-content: space-between; width: 100%; }
    .page-head { flex-direction: column; }
    .page-head .btn, .page-actions .btn { width: 100%; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .btn, .form-control, .form-select { min-height: 2.75rem; }
    input, select, textarea { font-size: 16px !important; }
}

@media (max-width: 768px) {
    .app-main { padding: 1.25rem 1rem 2rem; padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
    .guest-body main { padding-top: 1.5rem; padding-bottom: 2rem; }
    .guest-logo { height: 44px; }
    .staff-totali { grid-template-columns: 1fr; }
}

.btn-primary {
    background: linear-gradient(135deg, #1A2740, #1D7BAD);
    border: none;
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #1A2740, #2296D1);
    color: #fff;
}
.btn-gradient {
    background: linear-gradient(135deg, #1A2740, #1D7BAD);
    border: none;
    color: #fff;
    border-radius: 999px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
.btn-gradient:hover, .btn-gradient:focus-visible {
    color: #fff;
    background: linear-gradient(135deg, #1A2740, #2296D1);
}
.btn-outline-primary { color: #1D7BAD; border-color: #1D7BAD; }
.btn-outline-primary:hover { background: #1D7BAD; color: #fff; }
.card { border: none; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06); border-radius: 16px; }
.table th { white-space: nowrap; }
textarea { resize: vertical; }
.table-stacked thead { background-color: #f8f9fa; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; font-size: 1.85rem; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--ct-muted);
    margin-bottom: 0.25rem;
}
.lead-copy { color: var(--ct-muted); margin: 0.25rem 0 0; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.stat-card span { display: block; color: var(--ct-muted); font-size: 0.85rem; }
.stat-card strong { font-size: 1.6rem; }

.idea-capture { background: linear-gradient(180deg, #fff, #f7fbfe); }
.empty-state {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.nav-badge {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0.05rem 0.4rem;
    margin-left: 0.2rem;
    border-radius: 999px;
    background: #fbbf24;
    color: var(--ct-ink);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
}
.notice-list { padding: 0.5rem 1rem; }
.notice-list a { text-decoration: none; color: inherit; display: block; }
.notice-list li.is-unread { background: #eef6fb; margin: 0 -1rem; padding: 0.45rem 1rem; border-radius: 8px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--ct-border);
}
.plain-list li:last-child { border-bottom: 0; }
.plain-list .time { font-variant-numeric: tabular-nums; color: var(--ct-accent); font-weight: 600; min-width: 3rem; }
.plain-list li.is-done span { text-decoration: line-through; color: var(--ct-muted); }
.check-btn {
    border: 1px solid #c7d2de;
    background: #fff;
    border-radius: 999px;
    width: 1.5rem;
    height: 1.5rem;
    line-height: 1;
    padding: 0;
    color: var(--ct-accent);
}

.idea-tile {
    display: block;
    background: #fff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    min-height: 8rem;
}
.idea-tile:hover { color: inherit; }
.idea-tile strong { display: block; margin-bottom: 0.2rem; }
.idea-tile span { color: var(--ct-muted); font-size: 0.82rem; }
.idea-tile p { margin: 0.5rem 0 0; color: #334155; font-size: 0.92rem; }

.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1.2rem; }
.markdown-body p { line-height: 1.55; }
.markdown-body ul { padding-left: 1.2rem; }
.md-code { background: #0f172a; color: #e2e8f0; padding: 0.9rem; border-radius: 10px; }
.md-check.is-done { text-decoration: line-through; color: var(--ct-muted); }

.chip-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
    border: 1px solid var(--ct-border);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    background: #fff;
    cursor: pointer;
}
.chip input { margin-right: 0.35rem; }
.pill {
    display: inline-block;
    background: #e8f3fa;
    color: var(--ct-ink);
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    margin: 0 0.25rem 0.25rem 0;
    font-size: 0.85rem;
}
.proposta { padding: 0.6rem 0; border-bottom: 1px solid var(--ct-border); }
.filter-pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-pills a {
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--ct-border);
    text-decoration: none;
    color: var(--ct-ink);
    background: #fff;
}
.filter-pills a.active { background: var(--ct-navy); color: #fff; border-color: var(--ct-navy); }
.row-done td, .row-done strong { color: var(--ct-muted); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
}
.cal-head {
    text-align: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ct-muted);
    padding: 0.3rem 0;
}
.cal-day {
    background: #fff;
    min-height: 7.5rem;
    border-radius: 12px;
    padding: 0.45rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}
.cal-day.is-out { opacity: 0.45; }
.cal-day.is-today { outline: 2px solid var(--ct-accent); }
.cal-day-n { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 0.3rem; }
.cal-add { color: var(--ct-accent); text-decoration: none; font-size: 1.1rem; }
.cal-ev {
    display: block;
    font-size: 0.75rem;
    border-radius: 6px;
    padding: 0.15rem 0.35rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}
.cal-ev.is-meeting { background: #e0f1fb; color: #1A2740; }
.cal-ev.is-task { background: #f8ead6; color: #7a4a12; }
.cal-ev.is-done { opacity: 0.55; text-decoration: line-through; }

@media (max-width: 767.98px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .cal-grid { grid-template-columns: 1fr; }
    .cal-head { display: none; }
    .cal-day { min-height: auto; }
    .cal-day.is-out { display: none; }
    .table-stacked thead { display: none; }
    .table-stacked tr { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid var(--ct-border); }
    .table-stacked td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: 0.2rem 0; }
    .table-stacked td::before { content: attr(data-label); color: var(--ct-muted); font-weight: 600; }
}

@media (min-width: 768px) and (max-width: 1100px) {
    .cal-day { min-height: 6.2rem; }
}

.staff-totali {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.staff-card {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    background: #fff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 8px 24px rgba(26, 36, 32, 0.06);
}
.staff-avatar {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: #1D7BAD;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.staff-avatar.is-admin { background: #1A2740; color: #fff; }
.staff-meta { min-width: 0; }
.staff-meta strong { display: block; }
.staff-meta small { color: var(--ct-muted); }
.staff-grid { display: grid; gap: 0.75rem; }
.role-choice {
    border: 1px solid var(--ct-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    background: #fff;
    cursor: pointer;
    display: block;
    height: 100%;
}
.role-choice input { margin-right: 0.4rem; }
.guest-body { background: var(--ct-paper) !important; }

.rec-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.rec-timer {
    font-variant-numeric: tabular-nums;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    min-width: 8rem;
}
.rec-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
#box-registrazione.is-recording {
    outline: 2px solid #c0392b;
    outline-offset: 2px;
}
.js-rec.is-recording .rec-timer { color: #c0392b; }

#rec-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(10, 22, 40, 0.72);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
#rec-overlay.is-on { display: flex; }
.rec-overlay-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 1.75rem;
    max-width: 26rem;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.rec-overlay-box h2 { font-size: 1.25rem; margin: 0.75rem 0 0.35rem; }
.rec-overlay-spin {
    width: 2.4rem;
    height: 2.4rem;
    margin: 0 auto;
    border: 4px solid #e8eef4;
    border-top-color: #1D7BAD;
    border-radius: 50%;
    animation: recspin 0.8s linear infinite;
}
@keyframes recspin { to { transform: rotate(360deg); } }
.rec-overlay-bar {
    height: 10px;
    background: #e8eef4;
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0 0.5rem;
}
.rec-overlay-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #1A2740, #1D7BAD);
    transition: width 0.25s linear;
}
.rec-overlay-pct { font-size: 1.4rem; font-weight: 700; margin: 0; }
.rec-overlay-eta, .rec-overlay-fase { color: #64748b; margin: 0.25rem 0 0; }

@media (max-width: 767.98px) {
    .staff-totali { grid-template-columns: 1fr; }
}
