/* Notturna gialla theme: tokens, fonts, base elements and shared components. */

@font-face { font-family: "Saira"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/saira-400.93d9873a4340.woff2") format("woff2"); }
@font-face { font-family: "Saira"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/saira-500.bab77b8176af.woff2") format("woff2"); }
@font-face { font-family: "Saira"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/saira-600.3e5976f9c4d8.woff2") format("woff2"); }
@font-face { font-family: "Saira Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/saira-condensed-700.d45311136272.woff2") format("woff2"); }
@font-face { font-family: "Saira Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/saira-condensed-800.3c4bf68ff47e.woff2") format("woff2"); }

:root {
    --bg: #111412;
    --surface: #1b201c;
    --raised: #242b25;
    --line: #2c332d;
    --text: #f2f4ee;
    --muted: #a3ab9f;
    --accent: #fcdd0d;
    --accent-hover: #ffe866;
    --on-accent: #111412;
    --warn: #ffb347;
    --warn-bg: #2a2114;
    --warn-line: #6b4a1a;
    --danger: #ff7a6e;
    --danger-bg: #2a1614;
    --danger-line: #6b2620;
    --success: #7ee0a1;
    --success-bg: #14261b;
    --success-line: #1f4a30;
    /* Same-club marks in the generator: the symbol carries the meaning, the color helps. */
    --club-a: #fcdd0d;
    --club-b: #5cc8ff;
    --club-c: #6fdc8c;
    --club-d: #ff7ab6;
    --radius-sm: 10px;
    --radius: 12px;
    --radius-lg: 16px;
    --tap: 44px;
    --topbar-h: 64px;
    --font-body: "Saira", system-ui, -apple-system, sans-serif;
    --font-display: "Saira Condensed", "Saira", system-ui, sans-serif;
    color-scheme: dark;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--topbar-h); }
/* Big screens: sizes are in rem, so the whole site grows instead of shrinking into a strip. */
@media (min-width: 1600px) { html { font-size: 112.5%; } }
@media (min-width: 2200px) { html { font-size: 125%; } }
/* Column layout so the footer sits at the bottom of the window on short pages. */
body { display: flex; flex-direction: column; min-height: 100dvh; margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.45 var(--font-body); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 800; line-height: 1; text-transform: uppercase; }
h1 { font-size: clamp(2.25rem, 7vw, 3.5rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
p { margin: 0 0 0.75rem; }
[hidden] { display: none !important; }
.text-muted { color: var(--muted); }
.eyebrow { font: 600 0.8125rem var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.section-title { font: 700 0.9375rem var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tag { align-self: flex-start; padding: 4px 10px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* --- Forms --- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
    width: 100%; min-width: 0; min-height: 48px; margin: 0; padding: 0 14px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--text); font: 500 1.0625rem var(--font-body);
}
textarea { padding: 12px 14px; }
select {
    appearance: none; -webkit-appearance: none; padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none' stroke='%23a3ab9f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
input[readonly] { background: transparent; border-style: dashed; color: var(--accent); cursor: default; }
input::placeholder { color: var(--muted); opacity: 0.7; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled, select:disabled { opacity: 0.5; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: 0.875rem; color: var(--muted); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack > div, .form-stack > p { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.form-stack label { font-size: 0.875rem; }
.helptext { font-size: 0.8125rem; color: var(--muted); }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 0.875rem; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 0.8125rem; color: var(--muted); }
.check { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); font-size: 1rem; color: var(--text); cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.grid > * { min-width: 0; }

/* --- Buttons --- */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); margin: 0; padding: 0 18px;
    border: 1px solid transparent; border-radius: var(--radius);
    background: var(--accent); color: var(--on-accent);
    font: 800 1.25rem/1 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase;
    text-decoration: none; cursor: pointer;
}
button:hover, .btn:hover { background: var(--accent-hover); color: var(--on-accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-lg { min-height: 56px; font-size: 1.375rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-secondary, .btn-outline, .btn-ghost, .btn-danger { font: 500 0.9375rem/1 var(--font-body); letter-spacing: 0; text-transform: none; }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-secondary:hover { background: var(--raised); color: var(--text); }
.btn-outline { background: transparent; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn-outline:hover { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--on-accent); font-weight: 600; }
.btn-danger:hover { background: #ff978d; color: var(--on-accent); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.875rem; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
    min-height: var(--tap); padding: 0; border: 0; background: none;
    color: var(--muted); font: 400 0.9375rem var(--font-body); letter-spacing: 0; text-transform: none; text-decoration: none;
}
.back-link:hover { background: none; color: var(--text); }

/* --- Surfaces --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.card-quiet { background: transparent; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: var(--tap); height: var(--tap); border-radius: 50%;
    background: var(--surface); border: 1px solid var(--line);
    color: var(--text); font-weight: 600; font-size: 0.9375rem; text-decoration: none;
}
a.avatar:hover, .avatar[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.avatar-lg { width: 72px; height: 72px; background: var(--raised); color: var(--accent); font: 800 1.75rem var(--font-display); }

/* --- Alerts & messages --- */
.alert-info, .alert-warning, .alert-error { margin: 0; padding: 10px 14px; border: 1px solid; border-radius: var(--radius); font-size: 0.9375rem; }
.alert-info { background: var(--raised); border-color: var(--line); color: var(--text); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.alert-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.alert-info p, .alert-warning p, .alert-error p { margin: 0; }
.admin-invite { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.admin-invite-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-invite-actions form { margin: 0; }
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.message { margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
/* Flash messages (_messages.html) carry a close button. */
.messages .message { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 14px; transition: opacity 0.3s; }
.message > span { padding: 6px 0; }
.message-close { flex-shrink: 0; width: var(--tap); min-height: var(--tap); padding: 0; border: 0; background: transparent; color: inherit; font: 400 1.5rem/1 var(--font-body); opacity: 0.7; }
.message-close:hover { background: transparent; color: inherit; opacity: 1; }
.message-hide { opacity: 0; }
.message-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.message-success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.message-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: 8px 0; text-align: left; border-top: 1px solid var(--line); font-weight: 500; }
thead th { border-top: 0; color: var(--muted); font-size: 0.8125rem; }
th.num, td.num { text-align: right; }
td.num { font: 700 1.125rem var(--font-display); }

/* --- Segmented control --- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.segmented button { min-height: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 500 0.9375rem var(--font-body); letter-spacing: 0; text-transform: none; }
.segmented button:hover { background: var(--raised); color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.segmented button:disabled { background: transparent; color: var(--muted); }

/* --- Dialogs --- */
dialog { width: min(480px, calc(100vw - 32px)); max-height: 85vh; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
dialog h2 { font-size: 2rem; margin-bottom: 6px; }
dialog > p { color: var(--muted); }
.dialog-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; margin-top: 16px; }
.check-list { display: flex; flex-direction: column; margin-top: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.check-list .check { min-height: 52px; padding: 0 14px; border-top: 1px solid var(--line); font-weight: 600; }
.save-mode { margin: 0 0 12px; }
.check-list > .check:first-child { border-top: 0; }
.check-list .check.sub { min-height: 44px; padding-left: 32px; border-top: 0; font-weight: 400; font-size: 0.9375rem; color: var(--muted); }

/* --- Shell --- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--topbar-h); padding: env(safe-area-inset-top) 20px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { display: block; width: auto; height: 36px; }
.topbar-user { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-identity { display: none; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1.2; }
.topbar-identity strong { font-weight: 600; font-size: 0.9375rem; }
.topbar-identity small { color: var(--muted); font-size: 0.8125rem; }
.topbar-logout { display: none; margin: 0; }
.topbar-nav[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.topbar-nav-locked { opacity: 0.6; border-style: dashed; }
@media (max-width: 479px) {
    /* Calendario + Eventi + avatar must fit a 360 px phone. */
    .topbar { gap: 6px; padding-left: 16px; padding-right: 16px; }
    .topbar-user { gap: 6px; }
    .topbar-nav { gap: 4px; padding: 0 8px; }
    .brand-logo { height: 26px; }
}
.page { width: 100%; max-width: 84rem; margin: 0 auto; padding: 16px 20px 32px; }
.narrow { width: 100%; max-width: 40rem; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

@media (min-width: 720px) {
    :root { --topbar-h: 68px; }
    .topbar { padding: 0 48px; }
    .topbar-identity, .topbar-logout { display: flex; }
    .page { padding: 32px 48px 48px; }
}

@media (max-width: 719px) {
    dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-bottom: 0; border-radius: 20px 20px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

@media print {
    :root { --bg: #fff; --surface: #fff; --raised: #f2f2f2; --line: #bbb; --text: #000; --muted: #444; --accent: #000; }
    .topbar, button, .btn, .no-print, dialog { display: none !important; }
    body { display: block; min-height: 0; background: #fff; color: #000; }
}

/* --- Footer --- */
.site-footer { width: 100%; max-width: 84rem; margin: auto auto 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.site-footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.site-footer a, .site-footer .link-button { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--muted); }
.site-footer a:hover, .site-footer .link-button:hover { color: var(--text); }
.site-footer p { margin: 0; }
.link-button { min-height: 0; padding: 0; border: 0; background: none; font: inherit; letter-spacing: 0; text-transform: none; text-decoration: underline; cursor: pointer; }
.link-button:hover { background: none; }
.auth-legal { color: var(--muted); font-size: 0.875rem; }
@media (min-width: 720px) { .site-footer { padding-left: 48px; padding-right: 48px; } }

/* --- Profile --- */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head > div { min-width: 0; }
.profile-head h1 { overflow-wrap: anywhere; }
.profile-head p { margin: 4px 0 0; }
.profile-email { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.profile-email > div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.profile-email a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; white-space: nowrap; }
.profile-logout { margin: 0; }
@media (min-width: 720px) { .profile-logout { display: none; } }

/* --- Account management pages (allauth "manage" layout) --- */
.manage h2 { margin-top: 12px; }
.form-stack > .manage-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.card .btn-secondary { background: var(--raised); }
.email-option { flex-direction: row; align-items: center; gap: 12px; min-height: var(--tap); color: var(--text); font-size: 1rem; cursor: pointer; }
.email-option-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--raised); color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
