﻿:root{
  --topbar:#5f6b87;
  --topbar-dark:#47516a;
  --bg:#f3f5f8;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --line:#d9dee7;
  --row:#f7f8fb;
  --row2:#ffffff;
  --danger:#ffd6d6;
  --btn:#eef1f6;
  --btn-border:#9aa7bd;

  /* badge */
  --badge-bg:#eef2ff;
  --badge-border:#c7d2fe;
  --badge-text:#1f2937;

  --badge-done-bg:#eaf7ee;
  --badge-done-border:#bfe7ca;
  --badge-done-text:#14532d;

  --badge-missing-bg:#fff2f2;
  --badge-missing-border:#f7b4b4;
  --badge-missing-text:#7f1d1d;

  --shadow: 0 1px 0 rgba(0,0,0,.04);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color:var(--text);
}

.topbar{
  background: linear-gradient(90deg, var(--topbar), var(--topbar-dark));
  padding:10px 14px;
  color:#fff;
  display:flex;
  align-items:center;
  gap:12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.brand .logo {
  height: 64px;
  width: auto;
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.user{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:12px;
  font-size:14px;
}
.user-name{
  font-weight:700;
}
.logout-form{
  margin:0;
}
.logout-btn{
  color:#fff;
  background:rgba(127,29,29,.14);
  border:1px solid #fecaca;
  border-radius:8px;
  padding:8px 12px;
  cursor:pointer;
  font-weight:700;
  transition:background .15s ease, border-color .15s ease, transform .05s ease;
}
.logout-btn:hover{
  background:rgba(185,28,28,.28);
  border-color:#fca5a5;
}
.logout-btn:active{
  transform:translateY(1px);
}

.search{
  flex:1;
  display:flex;
  justify-content:center;
}
.search input{
  width:min(720px, 90%);
  border:1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.15);
  color:#fff;
  padding:10px 12px;
  border-radius:8px;
  outline:none;
}
.search input::placeholder{color:rgba(255,255,255,.75)}

.userbox{
  display:flex; gap:10px; align-items:center;
  font-size:14px;
}
.userbox a, .userbox button{
  color:#fff;
  text-decoration:none;
  background: rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.22);
  border-radius:8px;
  padding:8px 10px;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.userbox a:hover, .userbox button:hover{
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.28);
}
.userbox a:active, .userbox button:active{ transform: translateY(1px); }

.nav{
  background:#e6e9f1;
  border-bottom:1px solid var(--line);
  padding:10px 14px;
  display:flex;
  gap:14px;
  flex-wrap:wrap;
}
.nav a{
  text-decoration:none;
  color:#27324a;
  padding:8px 10px;
  border-radius:8px;
  transition: background .15s ease, border-color .15s ease;
}
.nav a:hover{
  background:#fff;
  border:1px solid var(--line);
}
.nav a.active{
  background:#fff;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
}

.container{
  padding:14px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:10px;
  overflow:hidden;
  box-shadow: var(--shadow);
}

.table{
  width:100%;
  border-collapse:collapse;
}
.table th{
  text-transform:none;
  font-weight:700;
  font-size:13px;
  background:#f0f2f7;
  border-bottom:1px solid var(--line);
  padding:12px 10px;
  text-align:left;
}
.table td{
  padding:12px 10px;
  border-bottom:1px solid var(--line);
  font-size:14px;
  vertical-align: top;
}
.table tr:nth-child(odd){background:var(--row)}
.table tr:nth-child(even){background:var(--row2)}
.table tr.late{
  background: var(--danger) !important;
}

.pills{
  display:flex; gap:8px; flex-wrap:wrap;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  background:#fafbfe;
}
.pill{
  border:1px solid var(--line);
  background:#fff;
  padding:8px 10px;
  border-radius:999px;
  text-decoration:none;
  color:#27324a;
  font-size:13px;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.pill:hover{ background:#f6f8ff; }
.pill:active{ transform: translateY(1px); }
.pill.active{
  border-color:#9aa7bd;
  background:#f3f6ff;
}

.controls{
  padding:12px 14px;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  border-bottom:1px solid var(--line);
}
.controls input[type="text"]{
  padding:9px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  min-width:260px;
  outline:none;
}
.controls input[type="text"]:focus{
  border-color:#9aa7bd;
  box-shadow: 0 0 0 3px rgba(154,167,189,.25);
}

.btn{
  background:var(--btn);
  border:1px solid var(--btn-border);
  border-radius:8px;
  padding:9px 10px;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{
  background:#e7ebf3;
  border-color:#7f8ea8;
}
.btn:active{ transform: translateY(1px); }
.btn-icon-only{
  width:36px;
  height:36px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  line-height:1;
}
.btn-danger-soft{
  color:#8a1f1f;
  background:#fff5f5;
  border-color:#efb2b2;
}
.btn-danger-soft:hover{
  color:#6f1515;
  background:#ffe8e8;
  border-color:#dc8c8c;
}
.btn-pdf{
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  color:#19324d;
  font-weight:700;
  background:#f3fbf7;
  border-color:#81b29a;
  box-shadow:0 1px 2px rgba(25,50,77,.08);
}
.btn-pdf:hover{
  background:#e9f7ef;
  border-color:#4f8f6b;
}
.btn-pdf .btn-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;
  height:22px;
  border-radius:6px;
  background:#ffffff;
  border:1px solid rgba(79,143,107,.35);
  line-height:1;
}

.small{
  color:var(--muted);
  font-size:12px;
}
.inline{display:inline}
.note{font-size:12px;color:var(--muted);margin-top:6px}
.progress-cell{
  min-width:190px;
}
.progress-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
  font-size:12px;
}
.progress-label-work{
  color:#075985;
  font-weight:700;
}
.progress-label-done{
  color:#14532d;
  font-weight:700;
}
.progress-track{
  height:10px;
  width:100%;
  overflow:hidden;
  border-radius:999px;
  background:#e6eaf2;
  border:1px solid #cfd6e3;
}
.progress-fill{
  height:100%;
  min-width:4px;
  border-radius:999px;
  background:#4f83cc;
}
.progress-fill-done{
  background:#35a065;
}
.messages{
  display:grid;
  gap:8px;
  margin-bottom:12px;
}
.message{
  border:1px solid var(--line);
  background:#fff;
  border-radius:8px;
  padding:10px 12px;
  font-size:14px;
}
.message-success{
  border-color:#bfe7ca;
  background:#eaf7ee;
  color:#14532d;
}
.message-warning{
  border-color:#f6d58f;
  background:#fff8e6;
  color:#7a4b00;
}
.message-error{
  border-color:#f7b4b4;
  background:#fff2f2;
  color:#7f1d1d;
}
.anticipo-modal{
  position:fixed;
  inset:0;
  z-index:20;
}
.anticipo-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.38);
}
.anticipo-modal__panel{
  position:relative;
  z-index:1;
  width:min(760px, calc(100vw - 28px));
  margin:12vh auto 0;
  background:#fff;
  border:1px solid var(--line);
  border-radius:10px;
  padding:16px;
  box-shadow:0 18px 48px rgba(15,23,42,.22);
}
.anticipo-modal textarea,
.anticipo-modal input[type="date"]{
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  outline:none;
}

/* =========================
   NUOVO: Badge status
   ========================= */
.badge{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid var(--badge-border);
  background:var(--badge-bg);
  color:var(--badge-text);
  white-space:nowrap;
}
.badge-todo{
  border-color: var(--badge-border);
  background: var(--badge-bg);
  color: var(--badge-text);
}
.badge-done{
  border-color: var(--badge-done-border);
  background: var(--badge-done-bg);
  color: var(--badge-done-text);
}
.badge-missing{
  border-color: var(--badge-missing-border);
  background: var(--badge-missing-bg);
  color: var(--badge-missing-text);
}

/* =========================
   NUOVO: comandi più ordinati
   ========================= */
.cmds{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.cmds input[name="missing_note"]{
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  min-width:200px;
  outline:none;
}
.cmds input[name="missing_note"]:focus{
  border-color:#9aa7bd;
  box-shadow: 0 0 0 3px rgba(154,167,189,.25);
}

/* =========================
   UFFICIO: bottoni filtro come "pills"
   ========================= */
.btn.active{
  border-color:#9aa7bd;
  background:#f3f6ff;
}

/* =========================================================
   CUSTOMER AUTH NEW UI
========================================================= */

body.customer-auth{
  background:#f5f6fa;
}

.customer-auth-layout{

  min-height:calc(100vh - 84px);

  display:flex;
  align-items:center;
  justify-content:center;

  padding:40px 20px;
}

.customer-auth-box{

  width:100%;
  max-width:560px;

  background:#fff;

  border-radius:28px;

  padding:42px 38px;

  box-shadow:
    0 10px 40px rgba(15,23,42,.08);

  border:1px solid #edf0f5;
}

.customer-auth-logo{

  text-align:center;

  margin-bottom:22px;
}

.customer-auth-logo img{

  width:120px;

  height:auto;
}

.customer-auth-title{

  text-align:center;

  font-size:40px;

  font-weight:800;

  margin:0;

  color:#0f172a;
}

.customer-auth-subtitle{

  text-align:center;

  color:#667085;

  margin-top:18px;

  margin-bottom:50px;

  font-size:16px;

  line-height:1.5;
}

.customer-field{

  margin-bottom:26px;
}

.customer-field label{

  display:block;

  margin-bottom:12px;

  font-size:16px;

  font-weight:600;

  color:#1e293b;
}

.modern-input{

  width:100%;

  border:none;

  background:#eef2ff;

  border-radius:20px;

  padding:22px 24px;

  font-size:22px;

  color:#0f172a;
}

.modern-input:focus{

  outline:none;

  box-shadow:
    0 0 0 4px rgba(99,102,241,.15);
}

.customer-login-btn{

  width:100%;

  margin-top:22px;

  border:none;

  border-radius:20px;

  padding:22px;

  cursor:pointer;

  background:#0b1b5c;

  color:#fff;

  font-size:26px;

  font-weight:700;

  transition:.2s;
}

.customer-login-btn:hover{

  background:#132875;
}

.customer-divider{

  text-align:center;

  margin:34px 0;

  color:#98a2b3;

  font-size:20px;

  position:relative;
}

.customer-divider:before,
.customer-divider:after{

  content:"";

  position:absolute;

  top:50%;

  width:38%;

  height:1px;

  background:#e5e7eb;
}

.customer-divider:before{
  left:0;
}

.customer-divider:after{
  right:0;
}

.customer-secondary-btn{

  width:100%;

  display:block;

  text-align:center;

  padding:22px;

  margin-bottom:18px;

  border-radius:20px;

  text-decoration:none;

  background:#f8fafc;

  border:1px solid #e5e7eb;

  color:#334155;

  font-size:24px;

  font-weight:600;

  transition:.18s;
}

.customer-secondary-btn:hover{

  background:#eef2ff;
}

.customer-footer{

  text-align:center;

  margin-top:40px;

  color:#98a2b3;

  font-size:18px;
}

.customer-error{

  background:#fff1f2;

  border:1px solid #fecdd3;

  color:#be123c;

  border-radius:18px;

  padding:18px;

  margin-bottom:24px;

  font-size:18px;
}
