:root {
  --ink: #1c1c1a;
  --muted: #77736d;
  --line: #dedbd5;
  --paper: #fff;
  --surface: #f5f4f1;
  --dark: #191917;
  --gold: #b88a42;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--surface); }
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  color: white;
  background: var(--dark);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; border-bottom: 1px solid #ffffff18; }
.brand img { width: 86px; height: 42px; object-fit: contain; filter: brightness(0) invert(1); }
.brand div, .sidebar-footer div { display: grid; gap: 2px; min-width: 0; }
.brand strong { font-size: 17px; }
.brand span, .sidebar-footer span { color: #aaa69f; font-size: 11px; }
.sidebar nav { display: grid; gap: 6px; margin-top: 25px; }
.nav-item {
  width: 100%;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 8px;
  color: #c4c0b9;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.nav-item.active, .nav-item:hover { color: white; background: #ffffff12; }
.nav-item small {
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 99px;
  color: #9f9a92;
  background: #ffffff10;
  font-size: 9px;
  text-transform: uppercase;
}
.nav-icon { width: 20px; color: var(--gold); font-size: 18px; text-align: center; }
.sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 25px;
  align-items: center;
  gap: 9px;
  border-top: 1px solid #ffffff18;
}
.sidebar-footer strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer button { border: 0; color: #aaa69f; background: transparent; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--dark) !important; background: var(--gold); font-weight: 850; }

main { margin-left: 250px; padding: 24px 30px 40px; }
.topbar { max-width: 1240px; margin: 0 auto 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
h1, h2, p { margin: 0; }
h1 { margin-top: 3px; font-size: 24px; letter-spacing: -.03em; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow.light { color: #c8c3bb; }
.top-actions { display: flex; gap: 8px; }
.icon-button, .primary-button, .outline-button, .text-button { border-radius: 8px; font-weight: 750; }
.icon-button { width: 39px; border: 1px solid var(--line); background: white; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; padding: 10px 15px; border: 0; color: white; background: var(--gold); }
.demo-pill {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 800;
}

.portal-view { display: none; }
.portal-view.active { display: block; }
body.report-workspace main {
  min-height: 100vh;
  padding: 0;
}
body.report-workspace .topbar,
body.report-workspace #view-rapportini .module-hero,
body.report-workspace #view-preventivi-hodaj .module-hero,
body.report-workspace #view-cantieri .module-hero,
body.report-workspace #view-parco-mezzi .module-hero,
body.report-workspace #view-scadenze-personale .module-hero {
  display: none;
}
body.report-workspace #view-rapportini,
body.report-workspace #view-preventivi-hodaj,
body.report-workspace #view-cantieri,
body.report-workspace #view-parco-mezzi,
body.report-workspace #view-scadenze-personale {
  height: 100vh;
}

.welcome {
  position: relative;
  max-width: 1240px;
  min-height: 220px;
  margin: 0 auto 28px;
  padding: 34px 38px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 15px;
  color: white;
  background: linear-gradient(120deg, #191917 0%, #292824 70%, #343128 100%);
  box-shadow: 0 18px 45px rgb(30 28 24 / 13%);
}
.welcome::after {
  content: "";
  position: absolute;
  right: 100px;
  width: 260px;
  height: 260px;
  border: 1px solid #ffffff12;
  border-radius: 50%;
  box-shadow: 0 0 0 55px #ffffff08, 0 0 0 110px #ffffff05;
}
.welcome h2 { max-width: 600px; margin: 8px 0 10px; font-size: clamp(28px, 3vw, 42px); line-height: 1.05; letter-spacing: -.045em; }
.welcome p { max-width: 570px; color: #bbb7b0; font-size: 13px; line-height: 1.5; }
.welcome-mark { position: absolute; z-index: 1; right: 50px; color: #ffffff10; font-size: 92px; font-weight: 950; letter-spacing: -.1em; }

.quick-section, .overview-grid { max-width: 1240px; margin: 0 auto; }
.section-title, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.section-title { margin-bottom: 14px; }
.section-title h2, .panel-heading h2 { margin-top: 3px; font-size: 18px; letter-spacing: -.02em; }
.text-button { padding: 6px; border: 0; color: var(--gold); background: transparent; font-size: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.quick-card {
  min-height: 116px;
  padding: 16px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  text-align: left;
  box-shadow: 0 5px 18px rgb(30 28 24 / 4%);
}
.quick-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.active-card { border-color: #dcc59d; }
.demo-card { position: relative; }
.demo-card::after {
  content: "solo demo";
  position: absolute;
  top: 9px;
  right: 10px;
  color: #9f9a92;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.quick-card > span:nth-child(2) { display: grid; gap: 4px; }
.quick-card strong { font-size: 13px; }
.quick-card small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.quick-card b { color: #aaa59d; }
.card-icon, .activity-icon { display: grid; place-items: center; border-radius: 9px; font-size: 19px; font-weight: 800; }
.card-icon { width: 38px; height: 38px; }
.rapportini .card-icon, .rapportini-bg { color: #866429; background: #f3e8d5; }
.preventivi .card-icon, .preventivi-bg { color: #8a6934; background: #f4ead8; }
.contabilita .card-icon { color: #377657; background: #deeee5; }
.cantieri .card-icon, .cantieri-bg { color: #49709b; background: #e3ebf4; }
.documenti .card-icon, .documenti-bg { color: #79598e; background: #eee6f2; }
.mezzi .card-icon, .mezzi-bg { color: var(--gold); background: #f3e8d5; }
.scadenze .card-icon, .scadenze-bg { color: #9d4141; background: #f3dddd; }
.fleet-symbol { color: var(--gold) !important; }
.fleet-symbol::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h10v9h2.2l1.7-4H21l2 4v3h-2.1a3 3 0 0 1-5.8 0H9.9a3 3 0 0 1-5.8 0H2V8a2 2 0 0 1 1-2Zm14.8 7L17 15h3.8l-1-2h-2ZM7 16.5A1.5 1.5 0 1 0 7 19.5a1.5 1.5 0 0 0 0-3Zm11 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM5 8v5h6V8H5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h10v9h2.2l1.7-4H21l2 4v3h-2.1a3 3 0 0 1-5.8 0H9.9a3 3 0 0 1-5.8 0H2V8a2 2 0 0 1 1-2Zm14.8 7L17 15h3.8l-1-2h-2ZM7 16.5A1.5 1.5 0 1 0 7 19.5a1.5 1.5 0 0 0 0-3Zm11 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM5 8v5h6V8H5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.overview-grid { margin-top: 28px; display: grid; grid-template-columns: 1.55fr .85fr; gap: 14px; }
.upcoming-panel { max-width: 1240px; margin: 14px auto 0; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 5px 18px rgb(30 28 24 / 4%); }
.activity-row { padding: 13px 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; border-bottom: 1px solid #ebe9e5; }
.activity-list, .upcoming-list { margin-top: 5px; }
.activity-row { width: 100%; border-width: 0 0 1px; border-radius: 0; background: transparent; text-align: left; }
.activity-row:hover { background: #faf8f4; }
.activity-row:last-child { padding-bottom: 0; border: 0; }
.activity-icon { width: 36px; height: 36px; }
.activity-row div { display: grid; gap: 3px; }
.activity-row strong { font-size: 12px; }
.activity-row span, .activity-row time { color: var(--muted); font-size: 11px; }
.activity-empty { padding: 24px 4px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.status { padding: 5px 8px; border-radius: 99px; color: #377657; background: #deeee5; font-size: 10px; font-weight: 800; }
.status.demo { color: #79598e; background: #eee6f2; }
.muted-row { opacity: .72; }
.month-value { padding: 24px 0 18px; display: grid; gap: 5px; border-bottom: 1px solid #ebe9e5; }
.month-value span, .month-stats span { color: var(--muted); font-size: 11px; }
.month-value strong { font-size: 27px; letter-spacing: -.04em; }
.month-stats { padding: 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.month-stats div { display: grid; gap: 4px; }
.month-stats strong { font-size: 13px; }
.estimate-month-list {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding-top: 2px;
}
.estimate-month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #ebe9e5;
}
.estimate-month-row div {
  display: grid;
  gap: 2px;
}
.estimate-month-row strong {
  font-size: 12px;
}
.estimate-month-row span {
  color: var(--muted);
  font-size: 10px;
}
.estimate-month-row b {
  color: #6f4d16;
  font-size: 12px;
  white-space: nowrap;
}
.positive { color: #377657; }
.negative { color: #9d4141; }
.outline-button { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 9px; border: 1px solid var(--line); color: var(--ink); background: white; }
.disabled-action {
  color: #aaa59d;
  background: #f8f7f4;
  cursor: not-allowed;
}

.module-hero {
  max-width: 1240px;
  min-height: 190px;
  margin: 0 auto 24px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 6px 22px rgb(30 28 24 / 5%);
}
.module-hero.rapportini-hero { border-color: #e4cfa9; background: #fffaf2; }
.module-hero.preventivi-hero { border-color: #dcc59d; background: #fffaf2; }
.module-hero.cantieri-hero { border-color: #cbd9e7; background: #f5f9fd; }
.module-hero.mezzi-hero { border-color: #cbdccf; background: #f5faf6; }
.module-hero.scadenze-hero { border-color: #e7c4c4; background: #fff7f7; }
.module-hero h2 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -.045em;
}
.module-hero p {
  max-width: 620px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.module-actions { display: grid; gap: 10px; min-width: 210px; }
.module-counter {
  min-width: 210px;
  padding: 13px 14px;
  display: grid;
  gap: 4px;
  border: 1px solid #e4cfa9;
  border-radius: 10px;
  background: white;
}
.module-counter span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.3;
}
.module-counter strong {
  color: #6f4d16;
  font-size: 22px;
  letter-spacing: 0;
}
.locked-badge {
  padding: 10px 13px;
  border-radius: 99px;
  color: #79598e;
  background: #eee6f2;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.module-grid {
  max-width: 1240px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.module-grid .panel h3, .site-card h3 {
  margin: 8px 0 7px;
  font-size: 18px;
}
.module-grid .panel p, .site-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.metric { display: grid; gap: 9px; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 25px; letter-spacing: -.035em; }
.table-panel { max-width: 1240px; margin: 0 auto; }
.table-panel .outline-button { width: auto; min-width: 160px; }
.demo-table {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  border: 1px solid #ebe9e5;
  border-radius: 9px;
}
.demo-table > * {
  padding: 13px;
  border-bottom: 1px solid #ebe9e5;
  font-size: 12px;
}
.demo-table > *:nth-last-child(-n + 3) { border-bottom: 0; }
.demo-table span { color: var(--muted); }
.site-card { min-height: 190px; }
.documenti-hero { border-color: #dfd0e7; background: #fcf9fd; }
.document-builder {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}
.document-sidebar {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 14px;
}
.document-editor {
  display: grid;
  gap: 13px;
}
.document-archive { padding: 16px; }
.document-archive-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.document-archive h3 { margin: 4px 0 0; font-size: 17px; }
.document-archive .counter {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #73551f;
  background: #f3e8d5;
  font-size: 11px;
  font-weight: 850;
}
.document-database-status {
  margin: 12px 0 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 8px;
  color: var(--muted);
  background: #f7f5f1;
  font-size: 10px;
}
.document-database-status span.online { color: #377657; }
.document-database-status .text-button { padding: 2px; }
.document-search {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 11px;
}
.document-list {
  max-height: 250px;
  margin-top: 9px;
  display: grid;
  gap: 6px;
  overflow: auto;
}
.document-card {
  width: 100%;
  padding: 10px;
  display: grid;
  gap: 3px;
  border: 1px solid #e7e3dc;
  border-radius: 8px;
  color: var(--ink);
  background: white;
  text-align: left;
}
.document-card:hover,
.document-card.active { border-color: #c9aa74; background: #fffaf1; }
.document-card strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.document-card span,
.document-card time { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.document-empty { padding: 15px 5px; color: var(--muted); font-size: 10px; text-align: center; }
.document-editor-heading {
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}
.document-editor h3 { margin: 4px 0 0; font-size: 18px; }
.autosave-status { color: var(--muted); font-size: 10px; white-space: nowrap; }
.document-editor label {
  display: grid;
  gap: 6px;
  color: #4c4944;
  font-size: 11px;
  font-weight: 800;
}
.document-editor input,
.document-editor textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfaf8;
  font: 500 13px/1.45 inherit;
  resize: vertical;
}
.document-editor input:focus,
.document-editor textarea:focus {
  outline: 2px solid #b88a4233;
  border-color: var(--gold);
  background: white;
}
.document-editor-hint {
  margin: -2px 0 0;
  padding: 10px 11px;
  border-radius: 9px;
  color: #6f675d;
  background: #f7f2e9;
  font-size: 11px;
  line-height: 1.45;
}
.company-details { padding-top: 2px; border-top: 1px solid #ebe9e5; }
.company-details summary {
  padding: 10px 0 0;
  color: #6f675d;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
}
.company-details[open] { display: grid; gap: 12px; }
.document-save-button { width: 100%; margin-top: 2px; }
.document-editor-actions { padding-top: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.document-editor-actions .document-reset { grid-column: 1 / -1; }
.document-canvas {
  min-width: 0;
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #e9e7e2;
  box-shadow: inset 0 1px 4px rgb(30 28 24 / 5%);
}
.document-sheet {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 20mm 19mm 18mm;
  display: flex;
  flex-direction: column;
  color: #25231f;
  background: white;
  box-shadow: 0 12px 35px rgb(30 28 24 / 14%);
  font-family: Arial, Helvetica, sans-serif;
  zoom: .7;
}
.letterhead {
  min-height: 31mm;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 18mm;
}
.letterhead-logo img { width: 54mm; height: 26mm; object-fit: contain; object-position: left center; }
.letterhead-company { display: grid; justify-items: end; gap: 1mm; text-align: right; font-size: 8.6pt; line-height: 1.22; }
.letterhead-company strong { max-width: 82mm; margin-bottom: 1.2mm; font-size: 11.5pt; line-height: 1.2; }
.letterhead-company span:empty { display: none; }
.letterhead-rule { height: 1.4mm; margin: 4mm 0 9mm; background: linear-gradient(90deg, var(--gold), #d7bd91 64%, transparent); }
.document-word-editor {
  flex: 1;
  min-height: 194mm;
  padding: 2mm 0 10mm;
  border: 0;
  outline: 0;
  font-size: 11pt;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.document-word-editor:empty::before {
  content: attr(data-placeholder);
  color: #aaa49b;
}
.document-word-editor:focus {
  outline: .35mm solid rgb(184 138 66 / 18%);
  outline-offset: 2mm;
}
.letterhead-footer {
  margin-top: auto;
  padding-top: 4mm;
  display: flex;
  justify-content: space-between;
  gap: 8mm;
  border-top: .35mm solid #b88a42;
  color: #655f56;
  font-size: 8pt;
  line-height: 1.4;
}
.letterhead-footer span { text-align: right; }
body.document-exporting .document-sheet { box-shadow: none; zoom: 1; }
body.document-exporting .document-word-editor:focus { outline: 0; }
.document-auth-dialog {
  width: min(410px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}
.document-auth-dialog::backdrop { background: rgb(20 19 17 / 58%); }
.document-auth-dialog form { padding: 24px; display: grid; gap: 15px; }
.document-auth-dialog h3 { margin: 4px 0 0; font-size: 22px; }
.document-auth-dialog label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
}
.document-auth-dialog input {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.document-auth-feedback { min-height: 16px; color: #9d4141; font-size: 11px; }
.document-auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rapportini-embed {
  max-width: none;
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: white;
  box-shadow: none;
}
.embed-toolbar {
  min-height: 90px;
  padding: 22px 24px 22px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #ffffff18;
  color: white;
  background: var(--dark);
}
.embed-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.embed-chevron {
  width: 18px;
  height: 18px;
  display: grid !important;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: var(--gold) !important;
  font-size: 18px !important;
  font-weight: 800;
  line-height: 1;
}
.embed-toolbar h3 {
  margin: 0 0 2px;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0;
}
.embed-toolbar .embed-subtitle {
  display: block;
  color: #aaa69f;
  font-size: 12px !important;
  line-height: 1.15;
}
.embed-report-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.embed-counter {
  min-height: 36px;
  padding: 6px 11px;
  display: grid;
  place-items: center start;
  border: 1px solid #ffffff2e;
  border-radius: 8px;
  color: white;
  background: #ffffff10;
}
.embed-counter span {
  color: #aaa69f;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}
.embed-counter strong {
  font-size: 13px;
  line-height: 1.2;
}
.embed-command {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid #ffffff45;
  border-radius: 8px;
  color: white;
  background: transparent;
  font-weight: 750;
  font-size: 13px;
}
.embed-command.primary {
  border-color: transparent;
  background: var(--gold);
}
.embed-archive-command {
  display: none;
}
.embed-command[hidden],
.embed-profile[hidden],
.embed-profile-menu[hidden] {
  display: none;
}
.embed-profile {
  position: relative;
}
.embed-profile-button {
  min-height: 36px;
  max-width: 285px;
  padding: 8px 11px 8px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ffffff45;
  border-radius: 8px;
  color: white;
  background: transparent;
  font-weight: 750;
  font-size: 13px;
}
.embed-profile-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.embed-profile-arrow {
  color: var(--gold);
  font-size: 14px;
  line-height: 1;
}
.embed-profile-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  min-width: 150px;
  padding: 6px;
  border: 1px solid #ffffff1f;
  border-radius: 9px;
  background: #22211e;
  box-shadow: 0 14px 32px rgb(0 0 0 / 28%);
}
.embed-profile-menu button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: transparent;
  text-align: left;
  font-weight: 750;
}
.embed-profile-menu button:hover {
  background: #ffffff12;
}
.embed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.embed-actions .outline-button {
  width: auto;
  min-width: 96px;
}
.embed-actions .outline-button.active {
  border-color: #d4b47e;
  color: #7b5921;
  background: #f7ecd8;
}
.rapportini-embed iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
  border: 0;
  background: #f5f4f1;
}
.demo-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: 310px;
  padding: 12px 14px;
  border-radius: 10px;
  color: white;
  background: #191917;
  box-shadow: 0 14px 36px rgb(0 0 0 / 22%);
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.demo-toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }

@media (max-width: 1000px) {
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .document-builder { grid-template-columns: 1fr; }
  .document-sidebar { position: static; }
  .document-sheet { zoom: .9; }
}

@media (max-width: 700px) {
  body { padding-bottom: 82px; }
  .sidebar { display: none; }
  main { margin: 0; padding: 18px 14px 30px; }
  .topbar { margin-bottom: 16px; }
  .topbar h1 { font-size: 20px; }
  .top-actions .icon-button { display: none; }
  .top-actions { align-items: center; }
  .demo-pill { display: none; }
  .primary-button { padding: 9px 11px; font-size: 11px; }
  .embed-archive-command {
    display: inline-flex;
  }
  .welcome { min-height: 190px; margin-bottom: 22px; padding: 24px 21px; border-radius: 12px; }
  .welcome h2 { font-size: 29px; }
  .welcome p { max-width: 280px; font-size: 11px; }
  .welcome-mark { right: 20px; bottom: -10px; font-size: 60px; }
  .welcome::after { display: none; }
  .section-title h2, .panel-heading h2 { font-size: 16px; }
  .quick-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-card {
    min-height: 132px;
    padding: 13px;
    grid-template-columns: 1fr;
    align-content: space-between;
    gap: 8px;
  }
  .quick-card b { display: none; }
  .overview-grid { margin-top: 22px; }
  .month { order: -1; }
  .panel { padding: 16px; }
  .module-hero {
    min-height: 0;
    padding: 22px;
    display: grid;
    border-radius: 12px;
  }
  .module-hero h2 { font-size: 33px; }
  .module-actions { min-width: 0; }
  .embed-actions { justify-content: stretch; }
  .embed-actions .outline-button,
  .embed-actions .text-button {
    width: 100%;
  }
  .rapportini-embed iframe {
    min-height: 0;
  }
  .demo-table { grid-template-columns: 62px minmax(0, 1fr); }
  .demo-table b { grid-column: 2; padding-top: 0; }
  .demo-table > *:nth-last-child(-n + 3) { border-bottom: 1px solid #ebe9e5; }
  .document-canvas { padding: 12px; }
  .document-sheet { margin: 0; zoom: .42; }
  .document-form-grid { grid-template-columns: 1fr; }
  .document-list { max-height: 220px; }
  .mobile-nav {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 0;
    height: 70px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--line);
    background: white;
    box-shadow: 0 -8px 24px rgb(30 28 24 / 9%);
  }
  .mobile-nav button {
    display: grid;
    place-items: center;
    gap: 1px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: 9px;
    font-weight: 750;
  }
  .mobile-nav button span, .mobile-nav a span { font-size: 18px; }
  .mobile-nav button.active { color: var(--gold); }
  .mobile-nav a {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
  }
  .mobile-nav .mobile-create span {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--dark);
    box-shadow: 0 5px 15px rgb(0 0 0 / 20%);
    font-size: 25px;
  }
  .mobile-create-backdrop {
    position: fixed;
    z-index: 28;
    inset: 0;
    background: rgb(25 25 23 / 34%);
  }
  .mobile-create-sheet {
    position: fixed;
    z-index: 29;
    right: 10px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    left: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    box-shadow: 0 18px 55px rgb(0 0 0 / 22%);
  }
  .mobile-create-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .mobile-create-head h3 {
    margin: 2px 0 0;
    font-size: 18px;
    letter-spacing: 0;
  }
  .mobile-create-head button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: #f7f5f1;
    font-size: 20px;
    font-weight: 800;
  }
  .mobile-create-options {
    margin-top: 12px;
    display: grid;
    gap: 8px;
  }
  .mobile-create-options button {
    width: 100%;
    min-height: 64px;
    padding: 12px;
    display: grid;
    gap: 3px;
    border: 1px solid #e2ddd3;
    border-radius: 10px;
    color: var(--ink);
    background: #fbfaf7;
    text-align: left;
  }
  .mobile-create-options strong {
    font-size: 14px;
  }
  .mobile-create-options span {
    color: var(--muted);
    font-size: 11px;
  }
}

@media print {
  @page { size: A4; margin: 0; }
  body { padding: 0; background: white; }
  body > .sidebar,
  body > main > :not(#view-documenti),
  #view-documenti > :not(.document-builder),
  .document-editor,
  .document-archive,
  .mobile-nav,
  .demo-toast { display: none !important; }
  main { margin: 0; padding: 0; }
  #view-documenti { display: block !important; }
  .document-builder,
  .document-canvas { display: block; margin: 0; padding: 0; border: 0; background: white; }
  .document-sheet { width: 210mm; min-height: 297mm; margin: 0; box-shadow: none; zoom: 1; }
}

@media (max-width: 700px) {
  :root {
    --mobile-nav-height: 78px;
  }

  body {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    background: #f5f4f1;
  }

  main {
    padding: 12px 12px 24px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    margin: -12px -12px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: #f5f4f1;
  }

  .topbar h1 {
    font-size: 18px;
    letter-spacing: 0;
  }

  .top-actions {
    display: none;
  }

  .welcome {
    min-height: 0;
    margin: 0 0 16px;
    padding: 22px 18px;
    align-items: start;
    border-radius: 10px;
  }

  .welcome h2 {
    max-width: 290px;
    font-size: 25px;
    line-height: 1.12;
    letter-spacing: 0;
  }

  .welcome p {
    max-width: 310px;
    font-size: 12px;
  }

  .welcome-mark {
    right: 14px;
    bottom: -7px;
    font-size: 46px;
  }

  .section-title {
    margin-bottom: 10px;
  }

  .section-title .text-button {
    display: none;
  }

  .quick-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .quick-card {
    min-height: 72px;
    padding: 12px;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    align-content: center;
    border-radius: 10px;
  }

  .quick-card strong {
    font-size: 14px;
  }

  .quick-card small {
    font-size: 11px;
  }

  .quick-card b {
    display: block;
  }

  .overview-grid {
    margin-top: 14px;
    gap: 10px;
  }

  .month {
    order: 0;
  }

  .panel {
    border-radius: 10px;
    box-shadow: none;
  }

  body.report-workspace {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  body.report-workspace main {
    height: calc(100vh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  body.report-workspace #view-rapportini,
  body.report-workspace #view-preventivi-hodaj,
  body.report-workspace #view-cantieri,
  body.report-workspace #view-parco-mezzi,
  body.report-workspace #view-scadenze-personale {
    height: 100%;
    min-height: 0;
  }

  .embed-toolbar {
    min-height: 58px;
    padding: 10px 12px;
    align-items: center;
  }

  .embed-toolbar h3 {
    font-size: 15px;
  }

  .embed-toolbar .embed-subtitle {
    display: none;
  }

  .embed-report-actions {
    gap: 6px;
  }

  .embed-command,
  .embed-profile-button {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .embed-profile-button {
    max-width: 140px;
  }

  .rapportini-embed {
    height: 100%;
  }

  .rapportini-embed iframe {
    min-height: 0;
    height: 100%;
  }

  .module-hero {
    margin: 0 0 12px;
    padding: 18px;
    border-radius: 10px;
  }

  .module-hero h2 {
    font-size: 28px;
    letter-spacing: 0;
  }

  .module-hero p {
    font-size: 12px;
  }

  .document-builder {
    gap: 12px;
  }

  .document-sidebar {
    gap: 10px;
  }

  .document-editor-actions {
    grid-template-columns: 1fr;
  }

  .document-canvas {
    margin: 0 -12px;
    padding: 10px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .document-sheet {
    transform-origin: top left;
    zoom: .5;
  }

  .mobile-nav {
    height: var(--mobile-nav-height);
    padding: 6px 4px calc(7px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  .mobile-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav button {
    min-width: 0;
    height: 58px;
    padding: 5px 2px;
    display: grid;
    grid-template-rows: 24px 13px;
    align-content: center;
    justify-items: center;
    gap: 3px;
    place-items: center;
    border-radius: 10px;
    font-size: 9px;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
  }

  .mobile-nav button > span {
    width: 24px;
    height: 24px;
    margin: 0 auto;
    display: grid;
    place-items: center;
  }

  .mobile-nav button.active {
    color: #6f4d16;
    background: #f7ecd8;
  }

  .mobile-nav button span,
  .mobile-nav a span {
    font-size: 18px;
  }

  .mobile-nav .mobile-create {
    grid-template-rows: 1fr;
    align-content: center;
    justify-content: center;
    padding: 0;
  }

  .mobile-nav .mobile-create span {
    width: 42px;
    height: 42px;
    margin: 0 auto;
    font-size: 24px;
  }
  .mobile-create-backdrop {
    position: fixed;
    z-index: 28;
    inset: 0;
    background: rgb(25 25 23 / 34%);
  }
  .mobile-create-sheet {
    position: fixed;
    z-index: 29;
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + 10px + env(safe-area-inset-bottom));
    left: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    box-shadow: 0 18px 55px rgb(0 0 0 / 22%);
  }
  .mobile-create-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .mobile-create-head h3 {
    margin: 2px 0 0;
    font-size: 18px;
    letter-spacing: 0;
  }
  .mobile-create-head button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: #f7f5f1;
    font-size: 20px;
    font-weight: 800;
  }
  .mobile-create-options {
    margin-top: 12px;
    display: grid;
    gap: 8px;
  }
  .mobile-create-options button {
    width: 100%;
    min-height: 64px;
    padding: 12px;
    display: grid;
    gap: 3px;
    border: 1px solid #e2ddd3;
    border-radius: 10px;
    color: var(--ink);
    background: #fbfaf7;
    text-align: left;
  }
  .mobile-create-options strong {
    font-size: 14px;
  }
  .mobile-create-options span {
    color: var(--muted);
    font-size: 11px;
  }
}

@media (max-width: 700px) {
  body.report-workspace #view-parco-mezzi {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  body.report-workspace #view-parco-mezzi .mezzi-embed {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  body.report-workspace #parco-mezzi-frame {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    display: block;
  }
}
