:root {
  --green: #3b9e42;
  --green-dark: #1e6e2c;
  --green-header: #1f6b2b;
  --red: #d93b3b;
  --border: #d8dce0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #2a2a2a;
  display: flex;
  justify-content: center;
  padding: 24px;
}

.page-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

/* Prev/next arrows to cycle between the two dashboard views */
.page-nav {
  width: 1600px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-dark);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-arrow:hover { background: #f2f2f2; }
.nav-arrow .i-icon { width: 20px; height: 20px; }
.i-icon.flip { transform: scaleX(-1); }

.page-dots { display: flex; align-items: center; gap: 7px; }
.page-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #666;
}
.page-dots span.active {
  background: var(--green);
  width: 20px;
  border-radius: 4px;
}

.app {
  display: flex;
  
  max-width: 100%;
  min-height: 900px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.sidebar {
  width: 260px;
  background: #f4f5f6;
  padding: 24px 0;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 24px;
  font-weight: 700;
  font-size: 15px;
  color: #333;
}
.brand .logo-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-style: italic;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
}
.sidebar nav a.active { background: #e3e6e9; font-weight: 700; }
.sidebar nav a .i-icon { width: 18px; height: 18px; color: #444; }
.sidebar nav a.active .i-icon { color: var(--green-header); }

.content {
  flex: 1;
  background: #fff;
  padding: 28px 32px;
  overflow-x: auto;
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.search-wrap { position: relative; width: 340px; max-width: 100%; }
.search-wrap .i-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--green-dark);
}
.search {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

/* Inline line-icon system (hand-drawn, stroke-only, no external assets) */
.i-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.i-icon.sm { width: 12px; height: 12px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
}
.page-header h1 {
  font-size: 26px;
  text-align: center;
  margin: 0;
  color: #333;
}
.page-header .badge {
  position: absolute;
  right: 0;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.page-header .clock-logo {
  position: absolute;
  left: 0;
  width: 60px; height: 60px; border-radius: 50%;
  border: 2px solid var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--green);
}

.btn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
/* Compact rows (utility buttons below the main nav) hug their own content
   instead of stretching to fill the row, matching the source screenshot. */
.btn-row.compact { justify-content: flex-start; }
.btn-row.compact .pill-btn { flex: none; min-width: 0; padding: 10px 18px; }
.btn-row.compact.right { justify-content: flex-end; }
.pill-btn {
  flex: 1;
  min-width: 150px;
  text-align: center;
  padding: 12px 10px;
  border-radius: 8px;
  background: #8bc98f;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .3px;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.pill-btn.active { background: var(--green-header); }
.pill-btn.dark { background: #5c1414; }
.pill-btn.outline {
  background: #fff;
  color: var(--red);
  border: 1.5px solid var(--red);
}
.pill-btn.outline.green {
  color: var(--green-dark);
  border-color: var(--green-dark);
}

.info-line {
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 14px;
  text-decoration: underline;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 900px;
  table-layout: fixed;
}
thead tr { background: var(--green-header); color: #fff; }
th, td {
  padding: 14px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  word-wrap: break-word;
}
th { font-weight: 600; font-size: 12.5px; }
td .muted { color: #6b6b6b; font-size: 12px; }
tbody tr:hover { background: #fafafa; }

/* Column widths for the prenotazioni table (9 cols), shared with the summary
   grid below it so the two stay pixel-aligned. AZIONI is kept wide enough to
   hold two 30px icon buttons side by side without wrapping the row. */
.table-prenotazioni th:nth-child(1), .table-prenotazioni td:nth-child(1) { width: 4%; }
.table-prenotazioni th:nth-child(2), .table-prenotazioni td:nth-child(2) { width: 13%; }
.table-prenotazioni th:nth-child(3), .table-prenotazioni td:nth-child(3) { width: 22%; }
.table-prenotazioni th:nth-child(4), .table-prenotazioni td:nth-child(4) { width: 9%; }
.table-prenotazioni th:nth-child(5), .table-prenotazioni td:nth-child(5) { width: 13%; }
.table-prenotazioni th:nth-child(6), .table-prenotazioni td:nth-child(6) { width: 8%; }
.table-prenotazioni th:nth-child(7), .table-prenotazioni td:nth-child(7) { width: 12%; }
.table-prenotazioni th:nth-child(8), .table-prenotazioni td:nth-child(8) { width: 8%; }
.table-prenotazioni th:nth-child(9), .table-prenotazioni td:nth-child(9) { width: 11%; }

/* Column widths for the invitati table (10 cols) - sized separately since it
   has one more column (ASSICURATO / TIPO UTENTE split) than the prenotazioni table. */
.table-inviti th:nth-child(1), .table-inviti td:nth-child(1) { width: 4%; }
.table-inviti th:nth-child(2), .table-inviti td:nth-child(2) { width: 13%; }
.table-inviti th:nth-child(3), .table-inviti td:nth-child(3) { width: 24%; }
.table-inviti th:nth-child(4), .table-inviti td:nth-child(4) { width: 9%; }
.table-inviti th:nth-child(5), .table-inviti td:nth-child(5) { width: 7%; }
.table-inviti th:nth-child(6), .table-inviti td:nth-child(6) { width: 9%; }
.table-inviti th:nth-child(7), .table-inviti td:nth-child(7) { width: 9%; }
.table-inviti th:nth-child(8), .table-inviti td:nth-child(8) { width: 8%; }
.table-inviti th:nth-child(9), .table-inviti td:nth-child(9) { width: 5%; }
.table-inviti th:nth-child(10), .table-inviti td:nth-child(10) { width: 12%; }

.row-penale td { vertical-align: top; padding-top: 18px; }

.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.badge-status.paid { color: #1e6e2c; }
.badge-status.manage {
  background: var(--green);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
}
.badge-status.penale {
  background: #e08a2b;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  justify-content: center;
}
.summary-inner .stat .value.warn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.summary-inner .stat .value.warn .i-icon { color: #c9781a; }

.importo-penale-cell { text-align: center; }
.importo-block {
  display: inline-block;
  text-align: left;
}
.importo-top {
  text-align: center;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
  margin-bottom: 8px;
  font-size: 14px;
}
.riaccredito-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
  
}
.riaccredito-value {
  font-weight: 700;
  font-size: 14px;
  margin: 2px 0 10px;
}
.penale-wrap { text-align: left; }

.actions-cell { text-align: center; }
.actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 76px;
  margin: 0 auto;
}
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
}
.icon-btn .i-icon { width: 15px; height: 15px; }
.icon-btn.dl { background: #333; }
.icon-btn.edit { background: #333; }
.icon-btn.del { background: var(--red); }
.icon-btn.mail { background: #2f7fd1; }
.icon-btn.spoki {
  background: var(--green);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 6px 8px;
  width: auto;
  gap: 4px;
}
.icon-btn.spoki .i-icon { width: 12px; height: 12px; }

/* Outer grid mirrors the table's 9 columns so .summary-inner can be
   placed exactly under PRENOTATO DA -> IMPORTO, like in the source screenshot. */
.summary-box {
  display: grid;
  grid-template-columns: 4fr 13fr 22fr 9fr 13fr 8fr 12fr 8fr 11fr;
  margin-top: 12px;
  min-width: 900px;
}
.summary-inner {
  grid-column: 3 / 8;
  border: 2px solid var(--green-dark);
  border-radius: 10px;
  background: #f2f9f2;
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 25fr 13fr 10fr 12fr;
  align-items: center;
  gap: 12px;
}
.summary-inner .company { font-weight: 700; text-align: left; }
.summary-inner .company .sub { display:block; font-weight: 400; font-size: 12px; color: #666; }
.summary-inner .stat { text-align: center; }
.summary-inner .stat label { display: block; font-size: 12px; color: #555; margin-bottom: 6px; }
.summary-inner .stat .value {
  padding: 8px 16px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  font-weight: 700;
}
.summary-inner .stat .value.warn { color: #1e6e2c; border-color: #1e6e2c; }

.checkbox { width: 16px; height: 16px; }
