/* ui.css — pagine di servizio: login, installazione, amministrazione */

:root {
    --navy:    #12315E;
    --blue:    #1281CE;
    --blue-d:  #0F6BB5;
    --cyan:    #4FB3E8;
    --magenta: #C2247B;
    --grey-bg: #EEF1F6;
    --line:    #DDE2EA;
    --text:    #2B3240;
    --muted:   #6B7280;
    --danger:  #B3261E;
    --ok:      #1E9E5A;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--grey-bg);
    color: var(--text);
    font-family: 'Century Gothic', CenturyGothic, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
}
a { color: var(--blue-d); }
code { background: #EDF1F7; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.muted { color: var(--muted); }

.brand-block { text-align: center; margin-bottom: 18px; }
.brand-block img { max-width: 260px; width: 100%; height: auto; }

/* ------------------------------------------------------------- login/setup */
.auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 28px;
    background: radial-gradient(1100px 620px at 20% -10%, #FFFFFF 0%, #E9EEF6 45%, #DDE5F1 100%);
}
.auth-wrap.login-bg, body.login-bg {
    background-color: var(--grey-bg);
    background-image: linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)), url('../img/sfondo-login.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
body.login-bg { background-attachment: fixed; }
.auth-card {
    width: 100%; max-width: 400px;
    background: #fff; border-radius: 14px; padding: 30px 30px 22px;
    box-shadow: 0 14px 40px rgba(18,49,94,.16);
}
.auth-card h1 { font-size: 19px; margin: 0 0 4px; color: var(--navy); }
.auth-card p { margin: 0 0 16px; font-size: 13px; }
.auth-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.auth-card label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text); }
.auth-card input[type=text], .auth-card input[type=password], .auth-card input[type=email] {
    display: block; width: 100%; margin-top: 4px;
    font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #FBFCFE;
}
.auth-card input:focus { outline: 2px solid #BBD7F2; border-color: var(--blue); }
.auth-card button {
    width: 100%; margin-top: 8px; font: inherit; font-weight: 600;
    padding: 11px; border: 0; border-radius: 8px; cursor: pointer;
    background: linear-gradient(90deg, var(--navy), var(--blue)); color: #fff;
}
.auth-card button:hover { filter: brightness(1.08); }
.auth-card .foot { margin-top: 18px; text-align: center; font-size: 11px; color: var(--muted); }
.alert { background: #FDECEA; border: 1px solid #F3C0BA; color: var(--danger); padding: 9px 11px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; }
.ok-box { background: #E8F6EE; border: 1px solid #B6E0C8; color: #14663C; padding: 9px 11px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; }

/* ------------------------------------------------------------------- admin */
.top {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px;
    position: sticky; top: 0; z-index: 20;
}
.top img.logo { height: 34px; }
.top .sep { flex: 1; }
.top nav a {
    text-decoration: none; color: var(--text); font-weight: 600; font-size: 13px;
    padding: 7px 12px; border-radius: 6px;
}
.top nav a.on, .top nav a:hover { background: #EDF3FB; color: var(--navy); }
.top .who { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.3; }
.top .who b { color: var(--text); display: block; font-size: 13px; }

.page { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.page.page-budget { max-width: 1700px; }
.page h2 { color: var(--navy); font-size: 17px; margin: 26px 0 10px; }
.page h2:first-child { margin-top: 0; }

.card {
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: 16px 18px; margin-bottom: 16px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; color: var(--navy); border-bottom: 2px solid var(--line); padding: 7px 8px; font-size: 12px; }
table.list td { border-bottom: 1px solid #F0F2F6; padding: 6px 8px; vertical-align: middle; }
table.list tr:hover td { background: #FAFBFD; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.budget-grid { table-layout: fixed; }
table.budget-grid th:first-child, table.budget-grid td:first-child { width: 15%; }
table.budget-grid th:not(:first-child), table.budget-grid td:not(:first-child) { width: calc(85% / 13); }
table.budget-grid td { padding: 3px 4px; }
table.budget-grid td input[type=text] {
    width: 100%; box-sizing: border-box; font: inherit; font-size: 12px;
    padding: 7px 6px; border: 1px solid var(--line); border-radius: 5px;
    background: #FBFCFE; color: var(--text); text-align: right;
}
table.budget-grid td input[type=text]:focus { outline: 2px solid #BBD7F2; border-color: var(--blue); }
table.budget-grid td[data-totale] input { font-weight: 600; color: var(--navy); }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #EDF3FB; color: var(--navy); }
.tag.admin { background: #E8EEFB; color: #23408C; }
.tag.off { background: #F3F4F6; color: var(--muted); }
.tag.ok { background: #E8F6EE; color: #14663C; }

form.inline { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
form.inline label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
form.inline label > input[type=checkbox] { align-self: flex-start; margin-bottom: 8px; }
form.inline label:has(> input[type=checkbox]) { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; }
input[type=text], input[type=email], input[type=password], select, textarea {
    font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #FBFCFE; color: var(--text);
}
textarea { width: 100%; font-family: Consolas, 'Courier New', monospace; font-size: 12px; min-height: 220px; }
button, .btn {
    font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px;
    border: 0; border-radius: 6px; background: var(--blue); color: #fff; cursor: pointer; text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover { background: var(--blue-d); }
button.ghost, .btn.ghost { background: #EDF1F7; color: var(--text); }
button.ghost:hover { background: #E1E8F2; }
button.danger { background: var(--danger); }
button.danger:hover { background: #8F1E17; }
button.small { padding: 5px 10px; font-size: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--text); }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.foot-copy { text-align: center; font-size: 11px; color: var(--muted); padding: 18px 0 6px; }

/* -------------------------------------------------------------------- aiuto */
button.help {
    width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 13px; font-weight: 700;
    line-height: 22px; background: #EDF3FB; color: var(--navy); vertical-align: middle;
}
button.help:hover { background: #DCE8F7; }
.modal-overlay {
    position: fixed; inset: 0; z-index: 100; background: rgba(18,49,94,.45);
    display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-card {
    background: #fff; border-radius: 12px; padding: 22px 26px 26px; width: 100%; max-width: 640px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-card h2 { margin: 0 0 12px; color: var(--navy); font-size: 17px; }
.modal-card p { font-size: 13px; line-height: 1.6; margin: 0 0 10px; }
.modal-card ul { font-size: 13px; line-height: 1.6; margin: 0 0 10px; padding-left: 20px; }
.v-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* -------------------------------------------------------------------- menu */
/* Reportistica occupa le prime due colonne (l'elenco clienti ha bisogno di
   respiro); Budget e Gestione, più corte, si impilano nella terza. */
.menu-grid {
    display: grid; grid-template-columns: 1fr 1fr minmax(260px, 1fr); grid-auto-rows: min-content;
    align-items: start; gap: 18px; margin: 4px 0 30px;
}
.menu-grid > *:nth-child(1) { grid-column: 1 / 3; grid-row: 1 / 3; }
.menu-grid > *:nth-child(2) { grid-column: 3; grid-row: 1; }
.menu-grid > *:nth-child(3) { grid-column: 3; grid-row: 2; }
@media (max-width: 900px) {
    .menu-grid { grid-template-columns: 1fr; }
    .menu-grid > * { grid-column: 1 !important; grid-row: auto !important; }
}
.menu-tile {
    display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 24px 26px; text-decoration: none; color: var(--text);
    box-shadow: 0 2px 10px rgba(18,49,94,.05); transition: box-shadow .15s, transform .15s;
}
a.menu-tile:hover { box-shadow: 0 8px 24px rgba(18,49,94,.13); transform: translateY(-2px); }
.menu-tile h3 { margin: 0 0 8px; color: var(--navy); font-size: 18px; }
.menu-tile p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }

.menu-clienti { list-style: none; margin: 16px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); }
.menu-clienti li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.menu-clienti li:last-child { border-bottom: 0; }
.menu-clienti .nome { font-size: 13px; font-weight: 600; color: var(--text); }
.menu-clienti .azioni { display: flex; gap: 6px; flex-wrap: wrap; }
.menu-clienti .azioni a {
    font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px;
    background: #EDF3FB; color: var(--navy); text-decoration: none; white-space: nowrap;
}
.menu-clienti .azioni a:hover { background: #DCE8F7; }
.menu-clienti li.hint { color: var(--muted); font-size: 13px; padding: 4px 0; }
