:root{
  --bg:#eef3f7;
  --panel:#ffffff;
  --card:#ffffff;
  --text:#10263a;
  --muted:#5f7083;
  --border:#d6e0ea;
  --accent:#2c7fc0;
  --accent-2:#1f5e92;
  --teal:#25a36a;
  --soft:#e7f1f8;
  --warn:#d53e4f;
  --gold:#d9c94d;
  --shadow:0 18px 55px rgba(6,24,38,.14);
  --brand-stripe: linear-gradient(90deg, #e33c48, #d9c94d 35%, #25a36a 68%, #2c7fc0);
}
*{box-sizing:border-box}
body{
  margin:0;
  min-height:100vh;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at top right, rgba(44,127,192,.18), transparent 32%),
    radial-gradient(circle at 20% 0%, rgba(37,163,106,.12), transparent 28%),
    linear-gradient(180deg, #eef3f7 0%, #f8fbfd 100%);
  color:var(--text)
}
a{color:inherit;text-decoration:none}
.shell{width:min(1240px,calc(100% - 32px));margin:0 auto;padding:28px 0 40px}
.wide{width:min(1480px,calc(100% - 32px))}
.loader{display:grid;place-items:center;min-height:70vh;gap:12px}
.loader{justify-items:center;text-align:center}
.brand{
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--accent-2);
  font-size:.78rem;
}
.app-brand,
.hero-brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.brand-mark{
  width:58px;
  height:58px;
  border-radius:18px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff;
  font-size:1.05rem;
  font-weight:800;
  letter-spacing:.08em;
  box-shadow:0 12px 26px rgba(37,99,235,.16);
  flex:0 0 auto;
}
.app-brand img,
.hero-brand img,
.access-logo{
  display:block;
  max-width:100%;
}
.app-brand img{
  width:132px;
  height:auto;
}
.hero-brand img{
  width:148px;
  height:auto;
}
.hero-brand{
  padding:10px 14px;
  border-radius:18px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(214,224,234,.85);
  box-shadow:0 12px 24px rgba(6,24,38,.06);
}
.hero-band{
  margin-top:12px;
  height:8px;
  border-radius:999px;
  background:var(--brand-stripe);
}
.hero-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 14px;
  border-radius:999px;
  background:#eff6ff;
  color:#1d4ed8;
  font-size:.84rem;
  font-weight:700;
  border:1px solid #dbeafe;
}
.card,.panel,.login-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:24px;
  padding:20px;
  box-shadow:var(--shadow);
}
.login-card{
  max-width:560px;
  margin:7vh auto 0;
  position:relative;
  overflow:hidden;
  text-align:center;
  display:grid;
  justify-items:center;
}
.login-card::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.96)),
    url("branding/accesso/sfondo-accesso.jpg") center/cover no-repeat;
  z-index:0;
}
.login-card > *{position:relative;z-index:1}
.login-card .stack{
  width:100%;
  justify-content:stretch;
}
.login-card label{
  text-align:left;
}
.login-card .hero-badge{
  justify-self:center;
}
.login-card .muted,
.login-card .message{
  text-align:center;
}
.login-card .portal-footer{
  width:100%;
}
.topbar{
  position:relative;
  overflow:hidden;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:20px;
  margin-bottom:22px;
  padding:28px 30px;
}
.topbar::after{
  content:"";
  position:absolute;
  inset:auto -80px -60px auto;
  width:260px;
  height:260px;
  background:radial-gradient(circle, rgba(37,99,235,.16), transparent 70%);
  pointer-events:none;
}
.topbar::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:6px;
  background:var(--brand-stripe);
}
.topbar h1{
  margin:.2rem 0 .35rem;
  font-size:clamp(2rem,4vw,3rem);
  line-height:1.05;
}
.actions,.stack{display:flex;gap:12px;align-items:stretch;flex-wrap:wrap}
.actions{justify-content:flex-end;align-items:center}
.stack{flex-direction:column}
.two-col-form{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px 16px;
}
.span-2{
  grid-column:1 / -1;
}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px}
.panel-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:16px;margin-bottom:16px}
h1,h2,p{margin:0}
.muted,.message{color:var(--muted)}
.message{margin-top:12px;min-height:1.2em}
label{display:grid;gap:6px}
label span{font-size:.9rem;color:var(--muted)}
.field-title{
  display:block;
  margin:0 0 8px;
  font-size:.9rem;
  color:var(--muted);
}
input,select,button,.button{
  font:inherit;
  border-radius:12px;
  border:1px solid var(--border);
  padding:12px 14px;
  background:#ffffff;
  color:var(--text)
}
input,select{width:100%}
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear{
  display:none;
}
button,.button{
  cursor:pointer;
  background:linear-gradient(180deg,var(--accent-2),#1d4ed8);
  color:#fff;
  font-weight:700;
  box-shadow:0 10px 20px rgba(37,99,235,.12)
}
button.secondary,.button.secondary{
  background:#ffffff;
  color:#1d4ed8
}
button.secondary.danger-ghost,
.button.secondary.danger-ghost{
  color:#b91c1c;
  border-color:#f1b4b4;
}
button.danger{background:linear-gradient(180deg,#ef4444,#dc2626)}
.password-row{
  position:relative;
  display:block;
}
.password-row input{
  padding-right:54px;
}
.password-toggle{
  position:absolute;
  top:50%;
  right:10px;
  width:34px;
  height:34px;
  min-width:34px;
  padding:0;
  display:grid;
  place-items:center;
  transform:translateY(-50%);
  line-height:1;
  border:none;
  border-radius:999px;
  background:transparent;
  color:var(--accent-2);
  box-shadow:none;
}
.password-toggle:hover,
.password-toggle:focus-visible{
  background:#eef6fd;
}
.icon-eye{
  position:relative;
  display:block;
  width:21px;
  height:14px;
  border:2px solid currentColor;
  border-radius:999px;
}
.icon-eye::before{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:5px;
  height:5px;
  border-radius:50%;
  background:currentColor;
  transform:translate(-50%,-50%);
}
.password-toggle.is-visible .icon-eye{
  transform:none;
}
.password-toggle.is-visible .icon-eye::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:2px;
  height:24px;
  border-radius:999px;
  background:currentColor;
  transform:translate(-50%,-50%) rotate(45deg);
}
.forgot-password{
  align-self:flex-start;
  padding:10px 0;
  border:none;
  background:transparent !important;
  box-shadow:none;
  color:var(--accent-2);
  font-weight:700;
  text-align:left;
}
.forgot-password:hover{text-decoration:underline}
.forgot-password-panel{
  display:grid;
  gap:10px;
  margin-top:12px;
  padding:14px 16px;
  border-radius:16px;
  border:1px solid var(--border);
  background:#f9fbfd;
}
.forgot-password-panel h2{
  font-size:1rem;
  color:var(--accent-2);
}
.project-card{
  display:grid;
  gap:14px;
  align-content:start;
  min-height:190px;
}
.project-card header{display:flex;gap:12px;align-items:center}
.icon{
  width:46px;
  height:46px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:#eff6ff;
  color:#1d4ed8;
  border:1px solid #dbeafe;
  font-size:1.1rem;
  font-weight:800
}
.project-card .meta{display:grid;gap:4px}
.project-card strong{font-size:1.05rem}
.project-card .desc{color:var(--muted);min-height:3.2em;line-height:1.5}
.project-card .button{
  justify-self:start;
}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px;border-bottom:1px solid var(--border);text-align:left;vertical-align:top}
.table th{font-size:.85rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.table-actions{display:flex;gap:8px;flex-wrap:wrap}
.listino-picker{
  display:grid;
  gap:10px;
}
.listino-picker select{
  min-height:148px;
}
.modal{
  position:fixed;
  inset:0;
  z-index:80;
  display:grid;
  place-items:center;
  padding:24px;
}
.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(8,20,32,.52);
}
.modal-panel{
  position:relative;
  z-index:1;
  width:min(1040px,100%);
  max-height:min(86vh,900px);
  overflow:auto;
  border-radius:22px;
  border:1px solid var(--border);
  background:#ffffff;
  box-shadow:0 26px 72px rgba(6,24,38,.24);
  padding:20px;
}
.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:16px;
}
.modal-eyebrow{
  margin:0 0 4px;
  color:var(--accent-2);
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:.78rem;
  font-weight:800;
}
.modal-header h2{
  font-size:1.4rem;
}
.modal-body{
  display:grid;
  gap:18px;
}
.preview-summary{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}
.preview-stat{
  border:1px solid var(--border);
  border-radius:16px;
  background:#f9fbfd;
  padding:14px;
  display:grid;
  gap:6px;
}
.preview-stat .label{
  color:var(--muted);
  font-size:.84rem;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.preview-stat .value{
  font-size:1.08rem;
  font-weight:800;
  color:var(--text);
}
.preview-section{
  display:grid;
  gap:10px;
}
.preview-bu-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.preview-section h3{
  margin:0;
  font-size:1rem;
  color:var(--accent-2);
}
.preview-table{
  width:100%;
  border-collapse:collapse;
}
.preview-table th,
.preview-table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
}
.preview-table th{
  color:var(--muted);
  font-size:.82rem;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.preview-empty{
  margin:0;
  color:var(--muted);
}
.hidden{display:none !important}
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.small{font-size:.9rem}
.project-profile-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.project-profile-card{
  border:1px solid var(--border);
  border-radius:16px;
  background:#f9fbfd;
  padding:14px;
  display:grid;
  gap:12px;
}
.project-profile-card h3{
  margin:0;
  font-size:1rem;
  color:var(--accent-2);
}
.project-profile-note{
  margin:0;
  color:var(--muted);
  font-size:.85rem;
  line-height:1.45;
}
.project-profile-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.check-grid{
  display:grid;
  gap:8px;
}
.check-row{
  display:flex;
  align-items:flex-start;
  gap:8px;
  font-size:.92rem;
  color:var(--text);
}
.check-row input[type="checkbox"]{
  width:auto;
  margin-top:2px;
}
.portal-footer{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:28px;
  margin:18px 0 0;
  padding:18px 22px;
  border-radius:18px;
  background:rgba(255,255,255,.86);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  flex-wrap:wrap;
}
.portal-footer img{
  display:block;
  max-height:64px;
  width:auto;
}
body[data-page="login"] .shell{
  width:min(760px,calc(100% - 32px));
}
body[data-page="login"] .login-card{
  padding:26px 28px 28px;
}
body[data-page="dashboard"] .topbar,
body[data-page="admin"] .topbar{
  background:rgba(255,255,255,.94);
}
body[data-page="dashboard"] .project-card .button,
body[data-page="admin"] .project-card .button{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
}
body[data-page="login"] .button,
body[data-page="login"] button{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
}
body[data-page="login"] .button.secondary,
body[data-page="login"] button.secondary,
body[data-page="dashboard"] .button.secondary,
body[data-page="dashboard"] button.secondary,
body[data-page="admin"] .button.secondary,
body[data-page="admin"] button.secondary{
  background:#fff;
  color:var(--accent-2);
}
body[data-page="login"] .password-toggle{
  background:transparent;
}
@media (max-width: 900px){
  .topbar{flex-direction:column}
  .actions{justify-content:flex-start}
  .two-col-form{grid-template-columns:1fr}
  .span-2{grid-column:auto}
  .project-profile-grid{grid-template-columns:1fr}
  .preview-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .preview-bu-grid{grid-template-columns:1fr}
  .modal{padding:14px}
  .modal-header{flex-direction:column}
}

body[data-page="landing"],
body[data-page="login"],
body[data-page="dashboard"],
body[data-page="admin"]{
  background:
    radial-gradient(circle at top center, rgba(104,167,255,.14), transparent 26%),
    linear-gradient(180deg, #eef3f7 0%, #f8fbfd 100%);
}

body[data-page] .shell{
  width:min(1480px,calc(100% - 32px));
}

body[data-page="dashboard"] .shell,
body[data-page="admin"] .shell{
  padding-top:20px;
}

body[data-page] .topbar{
  position:relative;
  overflow:hidden;
  padding:22px 24px;
  border:1px solid rgba(214,224,234,.92);
  border-radius:28px;
  background:rgba(255,255,255,.86);
  backdrop-filter:blur(18px);
  box-shadow:
    0 20px 48px rgba(15,33,68,.14),
    inset 0 1px 0 rgba(255,255,255,.22);
}

body[data-page] .topbar::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:6px;
  background:var(--brand-stripe);
}

body[data-page] .topbar::after{
  content:"";
  position:absolute;
  inset:auto -80px -60px auto;
  width:260px;
  height:260px;
  background:radial-gradient(circle, rgba(37,99,235,.16), transparent 70%);
  pointer-events:none;
}

body[data-page] .hero-brand{
  gap:14px;
}

body[data-page] .hero-badge{
  box-shadow:0 10px 22px rgba(44,127,192,.14);
}

body[data-page] .card,
body[data-page] .panel,
body[data-page] .login-card{
  border-radius:26px;
  box-shadow:0 18px 40px rgba(15,33,68,.12);
}

body[data-page="login"] .login-card{
  max-width:640px;
  margin:7vh auto 0;
}

body[data-page="login"] .app-brand{
  gap:14px;
}

body[data-page="login"] .brand-mark{
  width:64px;
  height:64px;
  font-size:1.1rem;
}

body[data-page="login"] .app-brand img{
  width:220px;
}

body[data-page="login"] .login-card::before{
  background:
    linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.96)),
    url("branding/accesso/sfondo-accesso.jpg") center/cover no-repeat;
}

body[data-page="dashboard"] .grid{
  grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
}

body[data-page="dashboard"] #projectsGrid{
  gap:18px;
}

body[data-page="dashboard"] .dashboard-hero{
  display:grid;
  gap:8px;
}

body[data-page="dashboard"] .dashboard-title-row{
  display:grid;
  grid-template-columns:1fr;
  grid-template-rows:auto auto;
  column-gap:16px;
  row-gap:4px;
  align-items:center;
}

body[data-page="dashboard"] .dashboard-title-row .brand-mark{
  grid-column:1;
  grid-row:2;
  align-self:center;
}

body[data-page="dashboard"] .dashboard-title-copy{
  display:contents;
}

body[data-page="dashboard"] .dashboard-title-copy .brand{
  grid-column:1;
  grid-row:1;
  margin:0;
}

body[data-page="dashboard"] .dashboard-title-copy h1{
  grid-column:1;
  grid-row:2;
  margin:0;
}

body[data-page="dashboard"] .dashboard-user-info{
  margin-top:6px;
  font-size:.96rem;
  line-height:1.5;
}

body[data-page="dashboard"] .dashboard-content{
  display:grid;
  gap:18px;
  padding:22px;
}

body[data-page="dashboard"] .dashboard-content .section-title{
  margin-bottom:0;
}

body[data-page="dashboard"] .dashboard-content .grid{
  margin-top:2px;
}

body[data-page="dashboard"] .project-card{
  border:1px solid rgba(214,224,234,.9);
  background:linear-gradient(180deg,#fff 0%, #f9fcff 100%);
  box-shadow:0 12px 28px rgba(15,33,68,.08);
}

body[data-page="dashboard"] .project-card::before{
  content:"";
  display:block;
  height:6px;
  margin:-20px -20px 10px;
  border-radius:24px 24px 0 0;
  background:var(--brand-stripe);
}

body[data-page="admin"] .section-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 18px;
}

body[data-page="admin"] .section-tabs button{
  background:#e7eff6;
  color:#173044;
  border-color:#d7e3ee;
  box-shadow:none;
}

body[data-page="admin"] .section-tabs button:hover{
  filter:brightness(1.01);
}

body[data-page="admin"] .section-tabs button.primary{
  background:linear-gradient(180deg,var(--accent-2),#1d4ed8);
  color:#fff;
  border-color:transparent;
}

body[data-page="admin"] .section-tabs button.active{
  background:linear-gradient(180deg,var(--accent-2),#1d4ed8);
  color:#fff;
  border-color:transparent;
}

body[data-page="admin"] .panel-grid{
  align-items:start;
}

body[data-page] .portal-footer{
  justify-content:center;
  align-items:center;
  gap:18px;
  padding:14px 18px;
}

body[data-page] .portal-footer img{
  display:block;
  max-height:42px;
  width:auto;
  object-fit:contain;
}

body[data-page] .portal-footer img:first-child{
  margin-right:0;
  flex:0 0 auto;
}

body[data-page] .portal-footer img:nth-child(2){
  flex:0 0 auto;
  max-height:42px;
}

body[data-page="login"] .portal-footer{
  gap:30px;
  padding:22px 28px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.86);
  box-shadow:var(--shadow);
}

body[data-page="login"] .portal-footer img{
  display:block;
  max-height:88px;
  width:auto;
}

body[data-page="login"] .portal-footer img:nth-child(1){
  max-height:76px;
  margin-right:0;
}

body[data-page="login"] .portal-footer img:nth-child(2){
  max-height:96px;
}

@media (max-width: 900px){
  body[data-page] .topbar{
    padding:18px;
    border-radius:22px;
  }

  body[data-page] .card,
  body[data-page] .panel,
  body[data-page] .login-card{
    border-radius:20px;
  }

  body[data-page="login"] .portal-footer{
    gap:14px;
    padding:16px;
  }

  body[data-page="login"] .app-brand img{
    width:178px;
  }

  body[data-page="login"] .portal-footer img:nth-child(1){
    max-height:58px;
  }

  body[data-page="login"] .portal-footer img:nth-child(2){
    max-height:70px;
  }
}

@media (max-width: 760px){
  body[data-page] .shell{
    width:min(100% - 16px, 1600px);
  }

  body[data-page="dashboard"] .shell,
  body[data-page="admin"] .shell{
    padding-top:12px;
  }
}
