:root{
  --page-bg:#f7f8f4;
  --surface:#ffffff;
  --ink:#1a2330;
  --muted:#7b8088;
  --line:rgba(26,35,48,0.09);
  --shadow:0 16px 38px rgba(15,63,39,0.09);
  --green:#0f3f27;
  --green-soft:#17693b;
  --gold:#d89b2b;
}
*{ box-sizing:border-box; }
body{
  margin:0;
  min-height:100vh;
  font-family:Arial, sans-serif;
  color:var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0 230px, var(--page-bg) 230px 100%);
}
.admin-logout-icon{
  position:fixed;
  top:14px;
  right:14px;
  z-index:50;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  padding:0;
  border:0;
  border-radius:999px;
  color:#1f2935;
  background:#ffffff;
  box-shadow:0 10px 24px rgba(20,28,38,0.16);
  cursor:pointer;
}
.admin-logout-icon svg{
  width:23px;
  height:23px;
  fill:none;
  stroke:currentColor;
  stroke-width:2.2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.admin-logout-icon:hover,
.admin-logout-icon:focus{
  color:#ffffff;
  background:#dc2626;
}
.admin-shell{
  width:min(100% - 16px, 1680px);
  margin:0 auto;
  padding:18px 0 44px;
}
.admin-topbar{
  display:flex;
  justify-content:space-between;
  gap:12px;
  width:min(100%, 1320px);
  margin:0 auto 16px;
}
.back-link,.secondary-link{
  color:#5f6a76;
  text-decoration:none;
  font-size:13px;
  font-weight:800;
}
.admin-hero{
  width:min(100%, 1320px);
  margin:0 auto 16px;
}
.admin-kicker,.section-kicker{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:6px 12px;
  border-radius:8px;
  background:#fff;
  border:1px solid var(--line);
  color:var(--green);
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:0.08em;
}
.admin-title{
  margin:16px 0 0;
  color:var(--green);
  font-size:clamp(38px, 5vw, 70px);
  font-weight:900;
  line-height:1.04;
}
.admin-subtitle{
  max-width:860px;
  margin:12px 0 0;
  color:var(--muted);
  font-size:15px;
  line-height:1.7;
}
.status-banner{
  width:min(100%, 1320px);
  margin:0 auto 16px;
  padding:12px 14px;
  border-radius:14px;
  background:#fff;
  box-shadow:var(--shadow);
  font-size:13px;
  font-weight:700;
  display:none;
}
.summary-grid{
  width:min(100%, 1320px);
  margin-left:auto;
  margin-right:auto;
  display:grid;
  gap:10px;
  margin-bottom:12px;
}
.summary-card,.surface-card{
  border-radius:12px;
  background:var(--surface);
  box-shadow:var(--shadow);
}
.admin-login-card{
  width:min(100%, 1320px);
  max-width:none;
  padding:0;
  margin:0 auto 18px;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}

.admin-password-message{
  margin:0 0 28px;
  color:#1f2935;
  font-size:16px;
  line-height:1.5;
}
.admin-login-form{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  max-width:none;
  margin:0;
}
.summary-card{
  position:relative;
  overflow:hidden;
  min-height:86px;
  padding:14px 16px;
  border:1px solid rgba(15,63,39,0.08);
}
.summary-card::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:5px;
  background:var(--green);
}
.summary-card:nth-child(2)::before{
  background:#d69e2e;
}
.summary-card:nth-child(3)::before{
  background:#16a34a;
}
.summary-card:nth-child(4)::before{
  background:#0ea5e9;
}
.summary-card span{
  display:block;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:#6f7780;
}
.summary-card strong{
  display:block;
  margin-top:7px;
  font-size:28px;
  line-height:1;
}
.admin-controls{
  width:min(100%, 1320px);
  margin-left:auto;
  margin-right:auto;
  padding:14px;
  margin-bottom:12px;
}
.status-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.status-tab{
  min-height:42px;
  padding:10px 16px;
  border:none;
  border-radius:999px;
  background:#f3f5f8;
  color:#415066;
  font:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  box-shadow:inset 0 0 0 1px #dfe4ea;
}
.status-tab.is-active{
  background:#1f2935;
  color:#fff;
  box-shadow:none;
}
.status-tab--all.is-active{
  background:#1f2935;
}
.status-tab--pending.is-active{
  background:#d69e2e;
}
.status-tab--confirmed.is-active{
  background:#16a34a;
}
.status-tab--cancelled.is-active{
  background:#dc2626;
}
.filters-row{
  display:grid;
  gap:12px;
}
.filter-status-field{
  align-content:start;
}
.form-field{
  display:flex;
  align-items:center;
  gap:4px;
}
.form-field span{
  font-size:16px;
  font-weight:400;
  text-transform:none;
  letter-spacing:0;
  color:#1f2935;
}
.form-field input,
.form-field select{
  width:100%;
  border:1px solid #dfe4ea;
  border-radius:0;
  padding:4px 8px;
  font:inherit;
  background:#fff;
}

.admin-login-form .form-field input{
  width:180px;
  min-height:28px;
}
.primary-btn,.secondary-btn,.ghost-btn{
  min-height:46px;
  border:none;
  border-radius:10px;
  padding:12px 14px;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  text-align:center;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.primary-btn{ background:var(--green); color:#fff; }
.secondary-btn{ background:#fff; color:#1f2935; box-shadow:inset 0 0 0 1px #dfe4ea; }
.ghost-btn{ background:#f5f6f8; color:#1f2935; }
.file-label{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.table-card{
  width:min(100%, 1320px);
  margin-left:auto;
  margin-right:auto;
  overflow:hidden;
}
.table-header{
  padding:16px;
  border-bottom:1px solid #ece8e2;
}
.table-header h2{
  margin:8px 0 0;
  font-size:25px;
  font-weight:300;
}
.table-wrap{
  overflow:auto;
}
table{
  width:100%;
  border-collapse:collapse;
}
th,td{
  padding:12px 14px;
  border-bottom:1px solid #ece8e2;
  text-align:left;
  vertical-align:top;
}
th{
  background:#fbfaf8;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:#6f7780;
}
td{
  font-size:13px;
  color:#28313d;
}
.date-stack{
  display:grid;
  gap:3px;
  min-width:130px;
}
.date-stack strong{
  color:#64748b;
  font-size:10px;
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
}
.date-stack em{
  color:#1f2935;
  font-size:13px;
  font-style:normal;
  font-weight:800;
  line-height:1.25;
}
.date-stack em + strong{
  margin-top:5px;
}
.booking-row.status-pending td{
  background:rgba(234,179,8,0.08);
}
.booking-row.status-confirmed td{
  background:rgba(34,197,94,0.08);
}
.booking-row.status-cancelled td{
  background:rgba(239,68,68,0.08);
}
.booking-detail-row[hidden]{
  display:none;
}
.booking-detail-row td{
  padding:0 16px 16px;
  background:#ffffff;
}
.booking-details-panel{
  margin:0;
  padding:16px;
  border-radius:12px;
  border:1px solid #dbeafe;
  background:linear-gradient(180deg, #f8fbff 0%, #eef7ff 100%);
  box-shadow:inset 4px 0 0 #0ea5e9;
}
.booking-details-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 12px;
}
.booking-details-head strong{
  color:#0f1728;
  font-size:16px;
}
.booking-details-head span{
  color:#64748b;
  font-size:12px;
  font-weight:800;
}
.booking-details-grid{
  display:grid;
  gap:10px;
}
.booking-detail-item{
  display:grid;
  gap:4px;
  min-width:0;
  padding:10px 12px;
  border-radius:10px;
  background:#ffffff;
  border:1px solid rgba(15,23,40,0.06);
}
.booking-detail-item span{
  color:#64748b;
  font-size:10px;
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
}
.booking-detail-item strong{
  color:#1f2935;
  font-size:13px;
  line-height:1.35;
  word-break:break-word;
}
.details-toggle{
  min-height:34px;
  padding:7px 12px;
  border:none;
  border-radius:999px;
  background:#e0f2fe;
  color:#075985;
  font:inherit;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
}
.details-toggle.is-open{
  background:#0ea5e9;
  color:#ffffff;
}
.booking-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.delete-booking{
  min-height:34px;
  padding:7px 12px;
  border:1px solid #dc2626;
  border-radius:999px;
  background:#fff5f5;
  color:#b91c1c;
  font:inherit;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
}
.delete-booking:hover,
.delete-booking:focus-visible{
  background:#dc2626;
  color:#ffffff;
}
.delete-booking:disabled{
  cursor:wait;
  opacity:0.65;
}
.status-select{
  min-height:36px;
  border:1px solid #dfe4ea;
  border-radius:8px;
  padding:6px 10px;
  font:inherit;
  background:#fff;
}
.status-select.status-pending{
  border-color:#e6b84f;
  background:#fff8df;
  color:#8a5a00;
}
.status-select.status-confirmed{
  border-color:#7ed49a;
  background:#ecfdf3;
  color:#166534;
}
.status-select.status-cancelled{
  border-color:#f5a3a3;
  background:#fff1f2;
  color:#b42318;
}
.admin-modal{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  background:rgba(20,28,38,0.48);
  z-index:999999;
}
.admin-modal[hidden]{
  display:none;
}
.admin-modal-card{
  width:min(100%, 560px);
  padding:22px;
  border-radius:16px;
  background:#fff;
  box-shadow:0 18px 48px rgba(20,28,38,0.22);
}
.admin-modal-card h2{
  margin:12px 0 0;
  font-size:28px;
  font-weight:300;
}
.admin-modal-card p{
  margin:10px 0 0;
  color:#6f7780;
  line-height:1.6;
}
.admin-modal-card textarea{
  width:100%;
  min-height:120px;
  border:1px solid #dfe4ea;
  border-radius:10px;
  padding:12px 14px;
  font:inherit;
  background:#fff;
  resize:vertical;
}
.modal-actions{
  display:grid;
  gap:12px;
  margin-top:16px;
}
.table-empty{
  padding:18px 16px;
  color:#6f7780;
}
.discount-chip{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:4px 10px;
  border-radius:999px;
  background:#eef4ff;
  color:#1d4ed8;
  font-size:12px;
  font-weight:800;
  letter-spacing:0.04em;
  text-transform:uppercase;
}
.discount-value{
  display:inline-block;
  margin-top:6px;
  color:#166534;
  font-weight:800;
}
.admin-dashboard[hidden],
.admin-login-card[hidden]{
  display:none;
}

.admin-login-form .primary-btn{
  min-height:42px;
  padding:10px 16px;
  border-radius:8px;
}
@media (min-width: 900px){
  .summary-grid{
    grid-template-columns:repeat(4, minmax(0, 1fr));
  }
  .filters-row{
    grid-template-columns:220px 1fr;
    align-items:end;
  }
  .modal-actions{
    grid-template-columns:160px 1fr;
  }
  .booking-details-grid{
    grid-template-columns:repeat(4, minmax(0, 1fr));
  }
  .booking-detail-item:nth-child(6),
  .booking-detail-item:nth-child(7),
  .booking-detail-item:nth-child(8){
    grid-column:span 2;
  }
}

@media (max-width: 899px){
  body{
    background:var(--page-bg);
  }
  .admin-shell{
    width:min(100% - 12px, 620px);
    padding:10px 0 28px;
  }
  .admin-logout-icon{
    top:10px;
    right:10px;
    width:38px;
    height:38px;
  }
  .status-banner{
    width:100%;
    margin-bottom:10px;
    border-radius:10px;
  }
  .summary-grid{
    width:100%;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:8px;
    margin-bottom:10px;
  }
  .summary-card{
    min-height:70px;
    padding:11px 12px 11px 14px;
    border-radius:10px;
  }
  .summary-card span{
    font-size:9px;
    letter-spacing:0.05em;
  }
  .summary-card strong{
    margin-top:5px;
    font-size:23px;
  }
  .admin-controls{
    width:100%;
    padding:12px;
    border-radius:10px;
  }
  .filters-row{
    gap:10px;
  }
  .form-field{
    align-items:stretch;
  }
  .form-field input,
  .form-field select{
    min-height:38px;
  }
  .status-tabs{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:8px;
  }
  .status-tab{
    min-height:38px;
    padding:8px 10px;
    border-radius:9px;
    font-size:12px;
  }
  .table-card{
    width:100%;
    border-radius:10px;
    overflow:visible;
    background:transparent;
    box-shadow:none;
  }
  .table-header{
    padding:12px 0;
    border-bottom:0;
  }
  .table-header h2{
    font-size:22px;
  }
  .table-wrap{
    overflow:visible;
  }
  table,
  thead,
  tbody{
    display:block;
    width:100%;
  }
  thead{
    display:none;
  }
  tr.booking-row{
    display:grid;
    gap:8px;
    margin-bottom:10px;
    padding:12px;
    border:1px solid rgba(15,63,39,0.1);
    border-radius:12px;
    background:#ffffff;
    box-shadow:0 10px 24px rgba(15,63,39,0.08);
  }
  .booking-row.status-pending,
  .booking-row.status-confirmed,
  .booking-row.status-cancelled{
    border-left:5px solid #d69e2e;
  }
  .booking-row.status-confirmed{
    border-left-color:#16a34a;
  }
  .booking-row.status-cancelled{
    border-left-color:#dc2626;
  }
  tr.booking-row td{
    display:grid;
    grid-template-columns:104px minmax(0, 1fr);
    gap:10px;
    align-items:start;
    padding:0;
    border:0;
    background:transparent !important;
    font-size:13px;
  }
  tr.booking-row td::before{
    content:attr(data-label);
    color:#64748b;
    font-size:10px;
    font-weight:900;
    letter-spacing:0.07em;
    text-transform:uppercase;
  }
  tr.booking-row td[data-label="Cliente"]{
    order:-2;
    grid-template-columns:1fr;
    gap:3px;
  }
  tr.booking-row td[data-label="Cliente"]::before{
    content:"Cliente";
  }
  tr.booking-row td[data-label="Cliente"] strong{
    color:var(--green);
    font-size:18px;
    line-height:1.15;
  }
  tr.booking-row td[data-label="Codice"]{
    order:-1;
  }
  tr.booking-row td[data-label="Sconto"]{
    display:none;
  }
  tr.booking-row td[data-label="Stato"],
  tr.booking-row td[data-label="Dettagli"]{
    grid-template-columns:1fr;
  }
  .status-select,
  .details-toggle{
    width:100%;
    min-height:42px;
  }
  .details-toggle{
    border-radius:9px;
  }
  .date-stack{
    min-width:0;
    grid-template-columns:1fr 1fr;
    gap:3px 8px;
  }
  .date-stack em + strong{
    margin-top:0;
  }
  tr.booking-detail-row{
    display:block;
    margin:-5px 0 12px;
  }
  tr.booking-detail-row[hidden]{
    display:none;
  }
  tr.booking-detail-row td{
    display:block;
    padding:0;
    border:0;
  }
  .booking-details-panel{
    padding:12px;
    border-radius:12px;
  }
  .booking-details-head{
    align-items:flex-start;
    flex-direction:column;
    gap:4px;
  }
  .booking-details-grid{
    gap:8px;
  }
  .booking-detail-item{
    padding:9px 10px;
    border-radius:8px;
  }
  .admin-modal{
    padding:12px;
  }
  .admin-modal-card{
    padding:16px;
    border-radius:12px;
  }
  .admin-modal-card h2{
    font-size:23px;
  }
  .modal-actions{
    grid-template-columns:1fr;
  }
}
