/* Sync Augusto — stile (colori ispirati al logo: blu navy, ciano, arancio) */
:root {
    --navy-950: #08213b;
    --navy-900: #0b2a4a;
    --navy-800: #0f3a63;
    --navy-700: #1a5188;
    --blue: #2b7fd1;
    --cyan: #35c3f0;
    --orange: #f08a24;
    --red: #d3202a;
    --green: #17a673;
    --bg: #f2f5fa;
    --card: #ffffff;
    --text: #1b2b3c;
    --muted: #6a7b8d;
    --line: #e3e9f1;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 40, 70, .05), 0 8px 24px rgba(15, 40, 70, .06);
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-primary: var(--blue);
    --bs-primary-rgb: 43, 127, 209;
    --bs-link-color: var(--navy-700);
}

body { font-family: var(--bs-body-font-family); color: var(--text); background: var(--bg); }
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--muted) !important; }

.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--navy-700); --bs-btn-border-color: var(--navy-700); --bs-btn-hover-bg: var(--navy-800); --bs-btn-hover-border-color: var(--navy-800); --bs-btn-active-bg: var(--navy-900); }
.btn-accent { background: linear-gradient(135deg, #f59a3c, var(--orange)); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(240, 138, 36, .35); }
.btn-accent:hover { color: #fff; filter: brightness(.96); transform: translateY(-1px); }
.btn-accent:disabled { opacity: .6; }
.form-control, .form-select { border-radius: 10px; border-color: #d5deea; padding: .6rem .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 .22rem rgba(43, 127, 209, .15); }
.form-label { font-weight: 600; font-size: .85rem; }

/* ---------- Layout con sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 1040; display: flex; flex-direction: column;
    background: linear-gradient(175deg, var(--navy-900) 0%, var(--navy-950) 100%); color: #d6e3f2; padding: 1.25rem 1rem; transition: transform .25s; }
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; padding: .25rem .5rem 1.5rem; }
.brand img { width: 52px; height: 52px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.brand span { display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font-size: 1.5rem; letter-spacing: .5px; }
.brand small { color: var(--cyan); font-size: .8rem; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; }
.sidebar .nav-link { color: #b9cde3; border-radius: 12px; padding: .7rem .9rem; display: flex; align-items: center; gap: .75rem; font-weight: 500; margin-bottom: .2rem; transition: .15s; }
.sidebar .nav-link i { font-size: 1.15rem; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(90deg, rgba(53, 195, 240, .22), rgba(53, 195, 240, .04)); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 1rem; display: grid; gap: .6rem; }
.user-card { display: flex; align-items: center; gap: .7rem; color: #fff; padding: .4rem .5rem; border-radius: 12px; }
.user-card:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.user-card small { color: #8fb0d1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--cyan)); flex: none; }
.btn-logout { background: rgba(255, 255, 255, .07); color: #d6e3f2; border: 0; text-align: left; }
.btn-logout:hover { background: rgba(211, 32, 42, .25); color: #fff; }
.sidebar-backdrop { display: none; }

.content { margin-left: 260px; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.5rem; position: sticky; top: 0; z-index: 1020;
    background: rgba(242, 245, 250, .85); backdrop-filter: blur(10px); }
@media (min-width: 992px) { .topbar { padding-left: 1.5rem; } }
.page-title { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.btn-icon { border: 0; background: #fff; box-shadow: var(--shadow); width: 42px; height: 42px; padding: 0; display: grid; place-items: center; }
.env-badge { font-size: .75rem; font-weight: 600; padding: .35rem .7rem; border-radius: 99px; }
.env-badge.local { background: #fff4e5; color: #b36200; }
.env-badge.online { background: #e3f7ee; color: #0b7a53; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(8, 33, 59, .5); z-index: 1030; }
    .content { margin-left: 0; }
}

/* ---------- Card ---------- */
.card-x { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-x > .card-x-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.card-x > .card-x-head i { color: var(--blue); }
.card-x-body { padding: 1.25rem; }

.hero { border-radius: 20px; padding: 1.75rem; color: #fff; position: relative; overflow: hidden;
    background: radial-gradient(circle at 90% 10%, rgba(53, 195, 240, .45), transparent 45%), linear-gradient(135deg, var(--navy-800), var(--navy-950)); box-shadow: 0 14px 34px rgba(11, 42, 74, .28); }
.hero::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .05); }
.hero small.lbl { text-transform: uppercase; letter-spacing: 2px; font-size: .72rem; color: #9fc4e8; font-weight: 600; }
.hero .big { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hero .chip { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255, 255, 255, .12); padding: .35rem .75rem; border-radius: 99px; font-size: .85rem; }

.kpi { padding: 1.15rem 1.25rem; display: flex; gap: 1rem; align-items: center; height: 100%; }
.kpi .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.kpi .ico.b { background: #e6f1fc; color: var(--blue); }
.kpi .ico.o { background: #fff1e0; color: var(--orange); }
.kpi .ico.g { background: #e3f7ee; color: var(--green); }
.kpi .val { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi .lbl { color: var(--muted); font-size: .82rem; }

/* ---------- Tabelle ---------- */
.table-modern { --bs-table-bg: transparent; margin: 0; }
.table-modern thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: #f8fafd; white-space: nowrap; padding: .75rem 1rem; }
.table-modern td { padding: .75rem 1rem; vertical-align: middle; border-color: var(--line); }
.table-modern tbody tr:hover { background: #f7faff; }
.bar { height: 6px; border-radius: 6px; background: #e8eef6; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: 6px; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.pill.ok { background: #e3f7ee; color: #0b7a53; }
.pill.warn { background: #fff4e0; color: #a35a00; }
.pill.err { background: #fde8ea; color: #a5121b; }
.pill.mute { background: #eef2f7; color: var(--muted); }
.tag-table { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; background: #eef4fb; color: var(--navy-700); padding: .15rem .5rem; border-radius: 6px; }

.nav-pills .nav-link { border-radius: 10px; font-weight: 500; color: var(--text); box-shadow: var(--shadow); }
.nav-pills .nav-link.active { background: var(--navy-800); color: #fff; }

/* ---------- Upload ---------- */
.dropzone { display: block; border: 2px dashed #b9cde3; border-radius: var(--radius); padding: 2.2rem 1rem; text-align: center; cursor: pointer; background: #f8fbff; transition: .2s; }
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: #eef6ff; transform: scale(1.005); }
.dropzone i { font-size: 2.6rem; color: var(--blue); }
.filelist .item { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px; margin-top: .5rem; background: #fff; }
.filelist .item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.mode-opt { border: 2px solid var(--line); border-radius: 14px; padding: .9rem 1rem; cursor: pointer; display: block; height: 100%; transition: .15s; }
.mode-opt:hover { border-color: #b9cde3; }
.btn-check:checked + .mode-opt { border-color: var(--blue); background: #f0f7ff; box-shadow: 0 0 0 3px rgba(43, 127, 209, .12); }

/* ---------- Anteprima dati ---------- */
.grid-wrap { overflow: auto; max-height: calc(100vh - 330px); min-height: 260px; border-radius: 0 0 var(--radius) var(--radius); }
.grid { margin: 0; font-size: .84rem; --bs-table-bg: #fff; }
.grid th { position: sticky; top: 0; z-index: 2; background: #f3f7fc; white-space: nowrap; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.grid th a { color: inherit; }
.grid th a:hover { color: var(--blue); }
.grid th.sorted { color: var(--blue); }
.grid td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; padding: .5rem .75rem; border-color: #eef2f7; }
.grid td.act, .grid th.act { position: sticky; left: 0; z-index: 3; background: #fff; max-width: none; border-right: 1px solid var(--line); box-shadow: 2px 0 6px rgba(15, 40, 70, .04); }
.grid th.act { background: #f3f7fc; z-index: 4; }
.grid tbody tr:hover td { background: #f5f9ff; }
.grid .nullv { color: #b4c0ce; font-size: .75rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; }
.chips a { white-space: nowrap; padding: .4rem .85rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: .85rem; font-weight: 500; }
.chips a:hover { border-color: var(--blue); color: var(--blue); }
.chips a.on { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-row { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--muted); }
.btn-row:hover { background: #e6f1fc; color: var(--blue); }
.btn-row.del:hover { background: #fde8ea; color: var(--red); }
.field-type { font-size: .68rem; color: var(--muted); font-weight: 500; margin-left: .35rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty i { font-size: 2.5rem; opacity: .5; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-hero { position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 3rem;
    background: radial-gradient(circle at 20% 15%, rgba(53, 195, 240, .35), transparent 40%), radial-gradient(circle at 85% 90%, rgba(240, 138, 36, .25), transparent 40%), linear-gradient(160deg, var(--navy-800), var(--navy-950)); }
.login-hero::before, .login-hero::after { content: ''; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); }
.login-hero::before { width: 620px; height: 620px; left: -200px; bottom: -260px; }
.login-hero::after { width: 420px; height: 420px; right: -140px; top: -160px; }
.login-hero img { width: min(300px, 55%); filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .45)); animation: flo 6s ease-in-out infinite; position: relative; z-index: 1; }
@keyframes flo { 50% { transform: translateY(-10px); } }
.login-hero h2 { margin-top: 1.75rem; font-weight: 700; letter-spacing: -.01em; position: relative; z-index: 1; }
.login-hero p { color: #a9c6e4; max-width: 380px; position: relative; z-index: 1; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 2.25rem; box-shadow: 0 20px 50px rgba(15, 40, 70, .12); }
.login-box .mini { width: 56px; display: none; margin: 0 auto 1rem; }
.input-icon { position: relative; }
/* niente azzurro/giallo del riempimento automatico del browser */
.input-icon input:-webkit-autofill,
.input-icon input:-webkit-autofill:hover,
.input-icon input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--text) !important;
    transition: background-color 600000s 0s;
}
.input-icon input[readonly] { background-color: #fff; cursor: text; }
.input-icon > i.lead { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: #8fa3b8; }
.input-icon .form-control { padding-left: 2.6rem; }
.input-icon .btn-eye { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: #8fa3b8; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; } .login-hero { display: none; } .login-box .mini { display: block; } }
