:root {
  --bg: #f8f9fa;
  --text: #2b4a76;
  --muted: #67748e;
  --border: #d2d6da;
  --brand-dark: #1f3a8a;
  --brand: #3f74b8;
  --brand-light: #8ccdf2;
  --grad: linear-gradient(310deg, #1f3a8a 0%, #3f74b8 55%, #8ccdf2 100%);
  --shadow: 0 20px 27px 0 rgba(0, 0, 0, .05);
  --shadow-lg: 0 8px 26px -4px rgba(20, 20, 20, .15), 0 8px 9px -5px rgba(20, 20, 20, .06);
  --radius: 1rem;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Open Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
h1, h2 { margin: 0; color: var(--text); }
h2 { font-size: 1.15rem; font-weight: 700; }
.muted { color: var(--muted); margin: .25rem 0 0; }
.small { font-size: .8rem; }
.r { text-align: right; }

/* ---------- bottoni ---------- */
.btn {
  border: 0; border-radius: .5rem; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .03em;
  padding: .8rem 1.5rem;
  box-shadow: 0 4px 7px -1px rgba(0,0,0,.11), 0 2px 4px -1px rgba(0,0,0,.07);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: scale(1.02); box-shadow: 0 7px 14px rgba(50,50,93,.1), 0 3px 6px rgba(0,0,0,.08); }
.btn-primary { background: var(--grad); color: #fff; }
.btn-dark { background: linear-gradient(310deg, #141727, #3a416f); color: #fff; }
.btn-sm { padding: .5rem 1rem; }
.btn-block { width: 100%; margin-top: 1.5rem; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; overflow-x: hidden; }
.login-art {
  position: fixed; top: 0; right: 0; bottom: 0; width: 42%;
  background:
    radial-gradient(circle at 70% 25%, rgba(140,205,242,.55), transparent 45%),
    radial-gradient(circle at 30% 80%, rgba(31,58,138,.9), transparent 55%),
    linear-gradient(160deg, #8ccdf2 0%, #3f74b8 40%, #2b5183 70%, #1f3a8a 100%);
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%);
  border-bottom-left-radius: 2.5rem;
}
.login-art::after {               /* onde come nel logo */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 38%;
  background:
    radial-gradient(120% 70% at 20% 100%, rgba(31,58,138,.85) 40%, transparent 41%),
    radial-gradient(120% 60% at 90% 100%, rgba(43,81,131,.8) 45%, transparent 46%);
}
.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh; width: 58%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.login-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2.5rem 2.25rem; width: 100%; max-width: 400px;
}
.login-logo { display: block; width: 200px; max-width: 70%; margin: 0 auto 1.25rem; }
.title-gradient {
  font-size: 1.8rem; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
label { display: block; font-size: .8rem; font-weight: 700; margin: 1.1rem 0 .4rem .2rem; }
input[type=text], input[type=password] {
  width: 100%; padding: .7rem .85rem; font: inherit; font-size: .9rem; color: var(--text);
  border: 1px solid var(--border); border-radius: .5rem; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(63,116,184,.25); }
.alert {
  margin-top: 1rem; padding: .7rem .9rem; border-radius: .5rem;
  background: #fde8ea; color: #c40d1e; font-size: .85rem; font-weight: 600;
}
.footer-note { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 1.5rem; }

@media (max-width: 900px) {
  .login-art { display: none; }
  .login-wrap { width: 100%; }
}

/* ---------- navbar ---------- */
.navbar {
  position: sticky; top: .75rem; z-index: 10;
  margin: .75rem auto 0; max-width: 1100px; width: calc(100% - 2rem);
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.25rem;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(200%) blur(30px); -webkit-backdrop-filter: saturate(200%) blur(30px);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; }
.brand img { height: 34px; }
.nav-right { display: flex; align-items: center; gap: .75rem; }
.nav-right form { margin: 0; }
.user-chip {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  background: #f0f2f5; border-radius: 2rem; padding: .3rem .8rem;
}

/* ---------- contenuto ---------- */
.container { max-width: 1100px; margin: 1.75rem auto; padding: 0 1rem; }
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; margin-bottom: 1.5rem;
}
.card-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.stat { text-align: right; }
.stat-label { display: block; font-size: .7rem; text-transform: uppercase; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.stat-value { font-size: 1.3rem; font-weight: 700; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: 2.5rem 1rem; text-align: center; cursor: pointer;
  border: 2px dashed #c9d3e3; border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfcfe, #f4f7fb);
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: #eef4fb; }
.dropzone.over { transform: scale(1.01); }
.drop-icon {
  width: 64px; height: 64px; border-radius: 1rem; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); margin-bottom: .6rem;
}

/* ---------- coda upload ---------- */
.queue { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .75rem; }
.q-item { border-radius: .75rem; padding: .9rem 1rem; background: #f8f9fa; }
.q-top { display: flex; justify-content: space-between; gap: 1rem; font-size: .88rem; }
.q-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-info { color: var(--muted); white-space: nowrap; }
.bar { height: 6px; border-radius: 1rem; background: #e3e8ef; margin-top: .55rem; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--grad); border-radius: 1rem; transition: width .2s; }
.q-item.done .bar > div { background: linear-gradient(310deg, #17ad37, #98ec2d); }
.q-item.error { background: #fdf0f1; }
.q-item.error .q-info { color: #c40d1e; }

/* ---------- tabella ---------- */
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: .6rem .75rem; border-bottom: 1px solid #e9ecef;
}
th.r { text-align: right; }
td { padding: .75rem; border-bottom: 1px solid #f0f2f5; }
td.name { font-weight: 600; word-break: break-all; }
tr.empty td { color: var(--muted); text-align: center; padding: 1.5rem; }
