:root {
  --navy: #183255;     /* navy ufficiale Haier Europe */
  --blue: #1e518a;
  --blue-logo: #004AAD;
  --grey: #4d555b;
  --bg: #f2f5f8;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Calibri, "Segoe UI", system-ui, sans-serif;
  color: var(--grey);
  background: var(--bg);
}

.hidden { display: none !important; }
.muted { opacity: 0.85; font-size: 0.85rem; }

/* ===================== LOGIN VIEW ===================== */
#login-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  /* sfondo lobby + overlay navy per leggibilità */
  background:
    linear-gradient(rgba(24, 50, 85, 0.55), rgba(24, 50, 85, 0.75)),
    url("assets/backgrounds/bg-lobby.webp") center/cover no-repeat;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  padding: 2.5rem 2.5rem 2.75rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.login-card .logo {
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
}

.login-card h1 {
  color: var(--navy);
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
}

.login-card p {
  color: var(--grey);
  font-size: 0.95rem;
  margin: 0 0 1.75rem;
}

.btn-sso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1.6rem;
  font: inherit;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease;
}
.btn-sso:hover { background: #0f2340; }
.btn-sso svg { width: 18px; height: 18px; }

/* ===================== APP VIEW ===================== */
#app-view {
  min-height: 100vh;
  /* sfondo HQ Haier Europe + velo chiaro per leggibilità delle card */
  background:
    linear-gradient(rgba(242, 245, 248, 0.82), rgba(242, 245, 248, 0.92)),
    url("assets/backgrounds/bg-atrio.webp") center/cover fixed no-repeat;
}

header {
  background: var(--navy);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header .logo { height: 34px; width: auto; display: block; }

.header-right { display: flex; align-items: center; gap: 0.8rem; }
.header-right .muted { color: #d6e0ec; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); }

main {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  gap: 1.5rem;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.card h2 { color: var(--navy); margin-top: 0; }

.dropzone {
  border: 2px dashed #b8c4d6;
  border-radius: 8px;
  padding: 1.75rem;
  text-align: center;
  margin-bottom: 1rem;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover { border-color: var(--blue); background: #eaf0f7; }

/* Elenco dei file selezionati (multi-file) */
.file-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: #f4f7fb;
  border: 1px solid #e0e7f0;
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
}
.file-list .fl-name { color: var(--navy); word-break: break-all; }
.file-list .fl-size { color: var(--grey); opacity: 0.8; white-space: nowrap; margin-left: auto; }
.file-list .fl-remove {
  background: transparent;
  border: none;
  color: #b02a37;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  flex: 0 0 auto;
}
.file-list .fl-remove:hover { color: #7d1d27; }
.file-list .fl-total {
  justify-content: flex-end;
  background: transparent;
  border: none;
  font-weight: bold;
  color: var(--navy);
  padding-right: 0.7rem;
}
.file-hint { font-size: 0.8rem; color: var(--grey); opacity: 0.8; margin: -0.5rem 0 0.75rem; }
.file-hint.over { color: #b02a37; opacity: 1; font-weight: bold; }

label { display: block; margin: 0.75rem 0; font-size: 0.9rem; }
input, textarea {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid #ccd4df;
  border-radius: 6px;
  font: inherit;
}
input[type="file"] { border: none; padding-left: 0; }

button:not(.btn-ghost):not(.btn-sso):not(.tab):not(.mode-tab) {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
button:not(.btn-ghost):not(.btn-sso):not(.tab):not(.mode-tab):hover { background: var(--navy); }

.status { display: flex; align-items: center; gap: 0.6rem; margin-top: 1rem; }
.spinner {
  width: 18px; height: 18px;
  border: 3px solid #ccd4df;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result { margin-top: 1rem; padding: 0.8rem; border-radius: 6px; }
.result.ok { background: #e6f4ea; color: #1e7e34; }
.result.ko { background: #fdecea; color: #b02a37; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  background: #e4e9f0; color: var(--grey);
  border: none; padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font: inherit;
}
.tab.active { background: var(--navy); color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.45rem; border-bottom: 1px solid #e4e9f0; }
th { color: var(--navy); }

/* Bottoni azione nello storico (download / copy link) */
.link-btn {
  background: transparent;
  border: 1px solid var(--blue);
  color: var(--blue);
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
}
.link-btn:hover { background: var(--blue); color: #fff; }

/* Badge "problema di consegna" nello storico Inviate: l'invio è andato a buon
   fine ma il destinatario non è riuscito a ritirare il file (vedi tab "Delivery
   issues"). Giallo/ambra per distinguerlo da un errore rosso di invio. */
.badge-issue {
  display: inline-block;
  background: #fff4e5;
  color: #8a5a00;
  border: 1px solid #f5c37b;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: help;
}

/* ===== File Request: switch Send/Request, form fornitore, note formati ===== */
.mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.mode-tab {
  background: #e4e9f0; color: var(--grey);
  border: none; padding: 0.55rem 1.2rem; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600;
}
.mode-tab.active { background: var(--navy); color: #fff; }
.mode-tab:not(.active):hover { background: #d3dbe6; }

/* Riga form con due campi affiancati (First/Last name) */
.form-row { margin-bottom: 0.2rem; }
.form-row.two { display: flex; gap: 0.8rem; }
.form-row.two label { flex: 1; }

/* Nota sui formati ammessi nel box di upload */
.formats-note {
  font-size: 0.8rem; color: var(--grey); margin: 0.4rem 0 0.2rem;
}
