:root {
  --ink: #0c1520;
  --ink-soft: #152433;
  --panel: rgba(18, 32, 48, 0.72);
  --panel-solid: #132233;
  --line: rgba(212, 184, 122, 0.18);
  --text: #f3efe6;
  --muted: #9aa8b8;
  --champagne: #d4b87a;
  --champagne-deep: #b8954a;
  --tc: #d4b87a;
  --tl: #5eb0c9;
  --i: #c97b6a;
  --ok: #6fbf8c;
  --danger: #d66a6a;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --scroll-size: 8px;
  --scroll-track: rgba(8, 14, 22, 0.55);
  --scroll-thumb: rgba(212, 184, 122, 0.32);
  --scroll-thumb-hover: rgba(212, 184, 122, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

/* Scrollbar sottili, allineate al tema (Firefox + WebKit/Chromium/Edge) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: var(--scroll-size);
  height: var(--scroll-size);
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scroll-thumb), rgba(184, 149, 74, 0.38));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scroll-thumb-hover), rgba(184, 149, 74, 0.62));
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ambiance {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(212, 184, 122, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 0%, rgba(94, 176, 201, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(201, 123, 106, 0.08), transparent 55%),
    linear-gradient(165deg, #0a121c 0%, #101c2a 45%, #0c1520 100%);
}

.ambiance::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  background: rgba(12, 21, 32, 0.55);
  position: sticky;
  top: 0;
  z-index: 20;
  animation: fadeDown 0.6s ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--champagne);
  color: var(--champagne);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.brand-tag {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: 0.25rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--line);
}

.user-avatar-btn,
.avatar-preview-wrap {
  position: relative;
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  border: 1px solid rgba(212, 184, 122, 0.45);
  background: rgba(212, 184, 122, 0.12);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.user-avatar-btn {
  font: inherit;
  color: var(--champagne);
  transition: border-color 0.15s, transform 0.15s;
}

.user-avatar-btn:hover {
  border-color: var(--champagne);
  transform: translateY(-1px);
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--champagne);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.avatar-edit-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.avatar-preview-wrap {
  width: 3rem;
  height: 3rem;
  cursor: default;
}

.avatar-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.user-chip {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--champagne);
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  animation: fadeDown 0.55s ease both;
}

.login-screen[hidden],
#appShell[hidden] {
  display: none !important;
}

.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem 1.75rem;
  display: grid;
  gap: 1rem;
  backdrop-filter: blur(18px);
}

.login-brand {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-brand .brand-mark {
  margin: 0 auto 0.85rem;
}

.login-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.login-brand p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-error {
  margin: 0;
  color: #f0a0a0;
  font-size: 0.86rem;
  text-align: center;
}

.login-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.user-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "username password displayname"
    "role role role"
    "avatar avatar avatar";
  gap: 0.65rem 0.75rem;
  align-items: end;
  width: 100%;
}

.user-fields .field-username { grid-area: username; }
.user-fields .field-password { grid-area: password; }
.user-fields .field-displayname { grid-area: displayname; }
.user-fields .field-role { grid-area: role; max-width: 14rem; }
.user-fields .field-avatar { grid-area: avatar; }

.user-fields .field {
  min-width: 0;
}

.user-fields .field > span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  min-height: 1.2em;
}

.user-fields input,
.user-fields select {
  width: 100%;
  min-height: 2.65rem;
  box-sizing: border-box;
  margin: 0;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) { width: 22%; }
.users-table th:nth-child(2),
.users-table td:nth-child(2) { width: 34%; }
.users-table th:nth-child(3),
.users-table td:nth-child(3) { width: 22%; }
.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 22%; }

.porters-table tbody tr.selected {
  background: rgba(212, 184, 122, 0.12);
}

@media (max-width: 1100px) {
  .user-fields {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "username password"
      "displayname displayname"
      "role role"
      "avatar avatar";
  }

  .user-fields .field-role {
    max-width: none;
  }
}

@media (max-width: 700px) {
  .user-menu {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    width: 100%;
    justify-content: space-between;
  }

  .user-fields {
    grid-template-columns: 1fr;
    grid-template-areas:
      "username"
      "password"
      "displayname"
      "role"
      "avatar";
  }

  .user-fields .field-role {
    max-width: none;
  }
}

.export-menu {
  position: relative;
}

.export-card {
  width: min(440px, 100%);
}

.export-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0.35rem 0 1rem;
}

.export-type {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.export-type:hover {
  border-color: rgba(212, 184, 122, 0.4);
  color: var(--text);
}

.export-type.active {
  color: var(--champagne);
  border-color: rgba(212, 184, 122, 0.55);
  background: rgba(212, 184, 122, 0.12);
}

.export-format-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.export-format-row .btn {
  flex: 1;
  justify-content: center;
  text-align: center;
}

.date-picker-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.date-picker-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.date-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 15rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.date-trigger:hover,
.date-trigger[aria-expanded="true"] {
  border-color: rgba(212, 184, 122, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.date-trigger-text {
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
}

.date-trigger-icon {
  display: grid;
  place-items: center;
  color: var(--champagne);
  opacity: 0.9;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 40;
  width: min(320px, calc(100vw - 2rem));
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  animation: modalIn 0.22s ease;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.cal-month {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.cal-nav {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.cal-nav:hover {
  color: var(--text);
  border-color: rgba(212, 184, 122, 0.45);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
  margin-bottom: 0.35rem;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
}

.cal-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
}

.cal-day:hover:not(:disabled) {
  background: rgba(212, 184, 122, 0.12);
}

.cal-day.muted {
  color: rgba(154, 168, 184, 0.35);
}

.cal-day.selected {
  background: linear-gradient(135deg, var(--champagne), var(--champagne-deep));
  color: #1a1205;
  font-weight: 600;
}

.cal-day.has-event:not(.selected)::after {
  content: "";
  position: absolute;
  bottom: 0.28rem;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: var(--champagne);
}

.cal-day.today:not(.selected) {
  box-shadow: inset 0 0 0 1px rgba(94, 176, 201, 0.55);
}

.cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.cal-legend {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.cal-dot.has {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--champagne);
  display: inline-block;
}

.cal-today {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.field select,
.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(212, 184, 122, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.btn {
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, opacity 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--champagne), var(--champagne-deep));
  color: #1a1205;
  box-shadow: 0 8px 24px rgba(212, 184, 122, 0.22);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(212, 184, 122, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #c45c5c, #a94444);
  color: #fff8f8;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(169, 68, 68, 0.25);
}

.btn-danger.ghost {
  background: transparent;
  color: #f0b0b0;
  border-color: rgba(214, 106, 106, 0.35);
  box-shadow: none;
}

.layout {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.5rem 1.25rem 2.75rem;
  box-sizing: border-box;
}

.accordion {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--panel);
  backdrop-filter: blur(12px);
  margin-bottom: 1rem;
  overflow: hidden;
  animation: rise 0.7s ease both;
}

.accordion-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.95rem 1.25rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.accordion-trigger:hover {
  background: rgba(255, 255, 255, 0.03);
}

.accordion-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.accordion-summary {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accordion-chevron {
  flex-shrink: 0;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--champagne);
  border-bottom: 2px solid var(--champagne);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -0.2rem;
}

.accordion.is-open .accordion-chevron {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.accordion-panel {
  display: none;
  padding: 0 1.1rem 1.15rem;
}

.accordion.is-open > .accordion-panel,
.accordion.is-open > .accordion-trigger-row + .accordion-panel {
  display: block;
}

.accordion-trigger-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.85rem;
}

.accordion-trigger-row .accordion-trigger {
  flex: 1;
  min-width: 0;
}

.side-panel.accordion {
  margin-bottom: 0;
  position: sticky;
  top: 5.5rem;
}

.side-panel.accordion .accordion-panel {
  padding: 0;
}

.side-panel.accordion .legend {
  padding: 0 1.25rem 1rem;
}

#indicatorsAccordion .hero-stats {
  margin-bottom: 0.85rem;
}

#indicatorsAccordion .status-stats {
  margin-bottom: 0;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.status-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.status-tile {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s, box-shadow 0.25s;
  animation: rise 0.7s ease both;
}

.status-tile:nth-child(1) { animation-delay: 0.28s; }
.status-tile:nth-child(2) { animation-delay: 0.34s; }
.status-tile:nth-child(3) { animation-delay: 0.4s; }

.status-tile:hover,
.status-tile.active {
  transform: translateY(-2px);
  border-color: rgba(212, 184, 122, 0.4);
  box-shadow: var(--shadow);
}

.status-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  opacity: 0.75;
}

.accent-confirmed::before { background: var(--ok); }
.accent-arrived::before { background: var(--tl); }
.accent-cancelled::before { background: var(--danger); }

.status-tile .stat-value {
  font-size: 2.2rem;
}

.stat-tile {
  position: relative;
  overflow: hidden;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s, box-shadow 0.25s;
  animation: rise 0.7s ease both;
}

.stat-tile:nth-child(1) { animation-delay: 0.05s; }
.stat-tile:nth-child(2) { animation-delay: 0.12s; }
.stat-tile:nth-child(3) { animation-delay: 0.19s; }
.stat-tile:nth-child(4) { animation-delay: 0.26s; }

.stat-tile:hover,
.stat-tile.active {
  transform: translateY(-3px);
  border-color: rgba(212, 184, 122, 0.4);
  box-shadow: var(--shadow);
}

.stat-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--champagne);
  opacity: 0.7;
}

.accent-tc::before { background: var(--tc); }
.accent-tl::before { background: var(--tl); }
.accent-i::before { background: var(--i); }

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  margin: 0.35rem 0 0.15rem;
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

.stat-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.toolbar {
  margin-bottom: 1.25rem;
  animation: rise 0.7s ease 0.3s both;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.segmented {
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.seg {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.seg.active {
  background: rgba(212, 184, 122, 0.18);
  color: var(--champagne);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field > span {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.field.inline {
  min-width: 9rem;
}

.field.grow {
  flex: 1;
  min-width: 14rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1.25rem;
  align-items: start;
  animation: rise 0.75s ease 0.35s both;
}

.content-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.list-panel {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--panel);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.list-panel.accordion {
  margin-bottom: 0;
}

.list-panel.accordion .accordion-panel {
  padding: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.list-panel.accordion.is-open > .accordion-panel {
  display: flex;
  height: auto;
  max-height: none;
  overflow: visible;
}

.list-panel .table-wrap {
  /* Solo la tabella scrolla: lascia sempre spazio alla paginazione sotto */
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(52vh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.list-panel .pagination {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  border-top: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.22);
}

.list-panel .expand-btn,
#chartsAccordion .expand-btn {
  margin-right: 0.35rem;
  flex-shrink: 0;
}

.expand-icon-close[hidden],
.expand-icon-open[hidden] {
  display: none !important;
}

/* Modalità a tutto schermo (prenotazioni / grafici) */
.accordion.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 80;
  margin: 0;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  box-shadow: none;
  animation: fadeDown 0.25s ease both;
  overflow: hidden;
}

.accordion.is-expanded .accordion-trigger-row {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 21, 32, 0.92);
  backdrop-filter: blur(12px);
}

.accordion.is-expanded.is-open > .accordion-panel,
.accordion.is-expanded > .accordion-panel,
.accordion.is-expanded > .accordion-trigger-row + .accordion-panel {
  display: flex !important;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.list-panel.is-expanded .table-wrap {
  max-height: none;
  flex: 1 1 0%;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.list-panel.is-expanded.accordion.is-open > .accordion-panel,
.list-panel.is-expanded > .accordion-panel {
  height: auto;
  max-height: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#chartsAccordion.is-expanded > .accordion-panel,
#chartsAccordion.is-expanded.is-open > .accordion-panel {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.accordion.is-expanded .expand-icon-open {
  display: none !important;
}

.accordion.is-expanded .expand-icon-close {
  display: block !important;
}

#chartsAccordion.is-expanded .charts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.25rem 0.5rem 1rem;
}

#chartsAccordion.is-expanded .chart-wrap,
#chartsAccordion.is-expanded .chart-wrap-bar {
  height: min(36vh, 360px);
}

#chartsAccordion.is-expanded .chart-wrap-wide {
  height: min(42vh, 420px);
}

body.panel-expanded {
  overflow: hidden;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  padding: 1rem 1.1rem 1.15rem;
  min-width: 0;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.chart-sub {
  margin: 0.2rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

.chart-wrap-bar {
  height: 260px;
}

.chart-wrap-wide {
  height: 280px;
}

.charts-empty {
  margin: 0.5rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card-wide {
    grid-column: auto;
  }

  #chartsAccordion.is-expanded .charts-grid {
    grid-template-columns: 1fr;
  }

  #chartsAccordion.is-expanded .chart-wrap,
  #chartsAccordion.is-expanded .chart-wrap-bar,
  #chartsAccordion.is-expanded .chart-wrap-wide {
    height: min(40vh, 320px);
  }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line);
}

.page-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-size select {
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
  /* Stesso colore della colonna P (.people); color-scheme dark evita testo chiaro su sfondo bianco su Windows */
  color: var(--champagne);
  color-scheme: dark;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  outline: none;
}

.page-size select option {
  color: var(--champagne);
  background-color: var(--panel-solid);
}

.page-info {
  margin: 0;
  color: var(--champagne);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.page-numbers {
  display: flex;
  gap: 0.25rem;
}

.page-btn {
  font: inherit;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.page-btn:hover {
  color: var(--text);
  border-color: rgba(212, 184, 122, 0.4);
}

.page-btn.active {
  color: #1a1205;
  background: linear-gradient(135deg, var(--champagne), var(--champagne-deep));
  border-color: transparent;
  font-weight: 600;
}

#pagePrev:disabled,
#pageNext:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th:nth-child(1),
.data-table td:nth-child(1) { width: 16%; }
.data-table th:nth-child(2),
.data-table td:nth-child(2) { width: 4%; }
.data-table th:nth-child(3),
.data-table td:nth-child(3) { width: 8%; }
.data-table th:nth-child(4),
.data-table td:nth-child(4) { width: 7%; }
.data-table th:nth-child(5),
.data-table td:nth-child(5) { width: 32%; }
.data-table th:nth-child(6),
.data-table td:nth-child(6) { width: 10%; }
.data-table th:nth-child(7),
.data-table td:nth-child(7) { width: 23%; }

.data-table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0.2rem 0.25rem;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.sort-btn::after {
  content: "⇅";
  font-size: 0.7rem;
  opacity: 0.35;
}

.sort-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sort-btn.active {
  color: var(--champagne);
}

.sort-btn.active[data-dir="asc"]::after {
  content: "▲";
  opacity: 0.9;
}

.sort-btn.active[data-dir="desc"]::after {
  content: "▼";
  opacity: 0.9;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  font-size: 0.92rem;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr.cancelled {
  opacity: 0.45;
}

.data-table tbody tr.cancelled .name {
  text-decoration: line-through;
}

.name {
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.people {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--champagne);
}

.booker-chip {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(212, 184, 122, 0.12);
  border: 1px solid rgba(212, 184, 122, 0.28);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--champagne);
}

.booker-chip.empty {
  opacity: 0.4;
  background: transparent;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.type-badge.TC {
  color: var(--tc);
  background: rgba(212, 184, 122, 0.12);
  border-color: rgba(212, 184, 122, 0.28);
}

.type-badge.TL {
  color: var(--tl);
  background: rgba(94, 176, 201, 0.12);
  border-color: rgba(94, 176, 201, 0.28);
}

.type-badge.I {
  color: #e0a090;
  background: rgba(201, 123, 106, 0.12);
  border-color: rgba(201, 123, 106, 0.28);
}

.notes-cell {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  vertical-align: top;
}

.notes-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.status-pill {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-pill.confirmed { color: var(--ok); }
.status-pill.arrived { color: var(--tl); }
.status-pill.cancelled { color: var(--danger); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.icon-action {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}

.icon-action svg {
  width: 1.05rem;
  height: 1.05rem;
  pointer-events: none;
}

.icon-action:hover {
  color: var(--champagne);
  border-color: rgba(212, 184, 122, 0.45);
  background: rgba(212, 184, 122, 0.1);
  transform: translateY(-1px);
}

.icon-action.ok:hover {
  color: var(--ok);
  border-color: rgba(111, 191, 140, 0.5);
  background: rgba(111, 191, 140, 0.12);
}

.icon-action.danger {
  color: #d09090;
  border-color: rgba(214, 106, 106, 0.35);
}

.icon-action.danger:hover {
  color: #f0b0b0;
  border-color: rgba(214, 106, 106, 0.6);
  background: rgba(214, 106, 106, 0.14);
}

.icon-action::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.45rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.35rem 0.55rem;
  border-radius: 7px;
  background: #0d1824;
  border: 1px solid rgba(212, 184, 122, 0.35);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.icon-action:hover::after,
.icon-action:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.label-short {
  display: none;
}

/* Rinforzo: su desktop forza etichette complete anche se la finestra è stretta */
html.is-desktop .label-short {
  display: none !important;
}

html.is-desktop .label-full {
  display: inline !important;
}

html.is-tablet .label-full {
  display: none;
}

html.is-tablet .label-short {
  display: inline;
}

.icon-btn,
.tiny-btn {
  font: inherit;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tiny-btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}

.tiny-btn:hover,
.icon-btn:hover {
  color: var(--text);
  border-color: rgba(212, 184, 122, 0.4);
}

.tiny-btn.danger {
  color: #e0a0a0;
  border-color: rgba(214, 106, 106, 0.35);
}

.tiny-btn.danger:hover {
  color: #f0c0c0;
  border-color: rgba(214, 106, 106, 0.6);
  background: rgba(214, 106, 106, 0.12);
}

.remove-card {
  width: min(440px, 100%);
}

.remove-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.remove-lead strong {
  color: var(--text);
  font-weight: 600;
}

.remove-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.remove-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  font: inherit;
}

.remove-option:hover:not(:disabled) {
  border-color: rgba(212, 184, 122, 0.45);
  background: rgba(212, 184, 122, 0.08);
  transform: translateY(-1px);
}

.remove-option.danger:hover:not(:disabled) {
  border-color: rgba(214, 106, 106, 0.55);
  background: rgba(214, 106, 106, 0.1);
}

.remove-option:disabled,
.remove-option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.remove-option-icon {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(212, 184, 122, 0.12);
  color: var(--champagne);
}

.remove-option.danger .remove-option-icon {
  background: rgba(214, 106, 106, 0.14);
  color: #e09090;
}

.remove-option-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.remove-option-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.remove-option-desc {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.panel-head .tiny-btn {
  margin-left: auto;
}

.porters-card {
  width: min(1040px, 100%);
}

.porters-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.porter-form-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.porters-form-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.porter-fields {
  display: grid;
  grid-template-columns: 5.5rem minmax(7rem, 1fr) minmax(8rem, 1.15fr) minmax(9rem, 0.95fr);
  grid-template-areas:
    "initials first last phone"
    "notes notes notes notes";
  gap: 0.65rem 0.75rem;
  align-items: end;
}

.porter-fields .field-initials { grid-area: initials; }
.porter-fields .field:nth-child(2) { grid-area: first; }
.porter-fields .field:nth-child(3) { grid-area: last; }
.porter-fields .field-phone { grid-area: phone; }
.porter-fields .field-notes {
  grid-area: notes;
  min-width: 0;
}

.porter-fields .field-notes input {
  width: 100%;
}

.porters-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  margin: 0;
}

.porters-form-actions .btn-danger {
  margin-right: auto;
}

.users-table-user {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.users-form .porter-form-bar {
  width: 100%;
}

.users-table-avatar,
.users-table-avatar-fallback {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.users-table-avatar-fallback {
  display: inline-grid;
  place-items: center;
  background: rgba(212, 184, 122, 0.14);
  border: 1px solid rgba(212, 184, 122, 0.35);
  color: var(--champagne);
  font-size: 0.65rem;
  font-weight: 600;
}

.porters-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: 320px;
  background: rgba(0, 0, 0, 0.15);
}

.porters-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.porters-table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel-solid);
  font-weight: 500;
}

.porters-table th:nth-child(1),
.porters-table td:nth-child(1) { width: 12%; }
.porters-table th:nth-child(2),
.porters-table td:nth-child(2) { width: 18%; }
.porters-table th:nth-child(3),
.porters-table td:nth-child(3) { width: 20%; }
.porters-table th:nth-child(4),
.porters-table td:nth-child(4) { width: 18%; }
.porters-table th:nth-child(5),
.porters-table td:nth-child(5) { width: 32%; }

.porters-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
  color: var(--text);
  vertical-align: top;
  word-break: break-word;
}

.porters-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.porters-table tbody tr:hover,
.porters-table tbody tr.active {
  background: rgba(212, 184, 122, 0.08);
}

.porters-cred {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--champagne);
  white-space: nowrap;
}

.porters-firstname,
.porters-lastname {
  color: var(--text);
  font-weight: 500;
}

.porters-phone {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

.porters-notes {
  color: var(--text);
  line-height: 1.4;
  white-space: normal;
}

.porters-empty td {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem !important;
  cursor: default;
}

.legend-note strong {
  color: var(--champagne);
  font-weight: 600;
}

@media (max-width: 900px) {
  .porter-fields {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "initials phone"
      "first last"
      "notes notes";
  }
}

@media (max-width: 720px) {
  .porter-fields {
    grid-template-columns: 1fr;
    grid-template-areas:
      "initials"
      "first"
      "last"
      "phone"
      "notes";
  }

  .porters-table {
    table-layout: auto;
  }
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
}

.booker-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  max-height: 420px;
  overflow: auto;
}

.booker-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s;
}

.booker-list li:hover,
.booker-list li.active {
  background: rgba(212, 184, 122, 0.08);
}

.booker-list .code {
  font-weight: 600;
  letter-spacing: 0.06em;
}

.booker-list .meta {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.legend {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.legend p {
  margin: 0.35rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-note {
  margin-top: 0.85rem !important;
  font-size: 0.75rem;
  line-height: 1.4;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
}

.dot.tc { background: var(--tc); }
.dot.tl { background: var(--tl); }
.dot.i { background: var(--i); }

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
}

.modal::backdrop {
  background: rgba(5, 10, 16, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(560px, 100%);
  margin: auto;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  color: var(--text);
  overflow: hidden;
  animation: modalIn 0.28s ease;
}

.modal-card.compact {
  width: min(440px, 100%);
}

.modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--line);
}

.modal-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.35rem 1.25rem;
  border-top: 1px solid var(--line);
}

.spacer {
  flex: 1;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.import-target {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--champagne);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 1.25rem;
  border: 1px dashed rgba(212, 184, 122, 0.4);
  border-radius: 12px;
  background: rgba(212, 184, 122, 0.05);
  cursor: pointer;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--champagne);
  background: rgba(212, 184, 122, 0.1);
  color: var(--text);
}

.toast-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
  margin: auto;
}

.toast-dialog::backdrop {
  background: rgba(5, 10, 16, 0.58);
  backdrop-filter: blur(5px);
}

.toast-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.9rem;
  width: min(440px, 100%);
  margin: auto;
  background: var(--panel-solid);
  border: 1px solid rgba(212, 184, 122, 0.4);
  color: var(--text);
  padding: 1.15rem 1.2rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: modalIn 0.22s ease;
}

.toast-icon {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(212, 184, 122, 0.16);
  color: var(--champagne);
}

.toast-copy {
  min-width: 0;
  padding-top: 0.1rem;
}

.toast-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.toast-text {
  margin: 0;
  line-height: 1.45;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 400;
}

.toast-close {
  margin-top: -0.15rem;
}

.toast-success .toast-card {
  border-color: rgba(111, 191, 140, 0.45);
}

.toast-success .toast-icon {
  background: rgba(111, 191, 140, 0.16);
  color: var(--ok);
}

.toast-error .toast-card {
  border-color: rgba(214, 106, 106, 0.5);
}

.toast-error .toast-icon {
  background: rgba(214, 106, 106, 0.16);
  color: #e09090;
}

.toast-warning .toast-card {
  border-color: rgba(212, 184, 122, 0.55);
}

.toast-warning .toast-icon {
  background: rgba(212, 184, 122, 0.18);
  color: var(--champagne);
}

.import-error {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(214, 106, 106, 0.45);
  background: rgba(214, 106, 106, 0.12);
  color: #f0b0b0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.confirm-card {
  width: min(440px, 100%);
}

.confirm-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.confirm-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 0.85rem;
  background: rgba(212, 184, 122, 0.14);
  color: var(--champagne);
}

.confirm-icon-danger {
  background: rgba(214, 106, 106, 0.16);
  color: #e09090;
}

.confirm-icon-success {
  background: rgba(111, 191, 140, 0.16);
  color: var(--ok);
}

.confirm-icon-info {
  background: rgba(94, 176, 201, 0.16);
  color: var(--tl);
}

.confirm-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* —— Desktop / PC (mouse): layout classico —— */
@media (hover: hover) and (pointer: fine) {
  .label-short {
    display: none !important;
  }

  .label-full {
    display: inline !important;
  }
}

@media (hover: hover) and (pointer: fine) and (max-width: 1100px) {
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-panel.accordion {
    position: static;
  }
}

@media (hover: hover) and (pointer: fine) and (max-width: 720px) {
  .topbar,
  .layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    width: 100%;
  }

  .date-picker-wrap {
    flex: 1;
  }

  .date-trigger {
    min-width: 0;
    width: 100%;
  }

  .calendar-popover {
    left: 0;
    right: 0;
    width: auto;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat-value {
    font-size: 2.2rem;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .notes-text {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .status-stats {
    grid-template-columns: 1fr;
  }
}

/* —— Tablet / touch —— */
@media (hover: none) and (pointer: coarse) {
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.85rem 1rem;
    padding: 1rem 1.25rem;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand-tag {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
  }

  .top-actions {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
  }

  .top-actions .btn {
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    min-height: 2.6rem;
  }

  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .user-menu {
    margin-left: auto;
    padding-left: 0.5rem;
  }

  .user-chip {
    max-width: 140px;
  }

  .date-picker-wrap {
    flex: 1 1 220px;
    min-width: 180px;
  }

  .layout {
    padding: 1.25rem 1.25rem 2.5rem;
  }

  .filters {
    gap: 0.65rem;
  }

  .field.grow {
    min-width: 100%;
    flex: 1 1 100%;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .seg {
    text-align: center;
    padding: 0.65rem 0.4rem;
    min-height: 2.6rem;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-panel.accordion {
    position: static;
  }

  .side-panel .booker-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding: 0.65rem 1rem 0.85rem;
    max-height: none;
  }

  .side-panel .booker-list li {
    flex: 0 0 auto;
    min-width: 8.5rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .status-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .stat-tile,
  .status-tile {
    padding: 1rem 1.1rem;
  }

  .stat-value,
  .status-tile .stat-value {
    font-size: 1.85rem;
  }

  .notes-text {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem 0.65rem;
  }

  .data-table td:last-child {
    min-width: 11rem;
  }

  .pagination {
    gap: 0.65rem;
  }

  .porters-card {
    width: min(960px, 100%);
  }

  .modal {
    max-width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 1.5rem);
  }

  .modal-card,
  .modal-card.compact,
  .porters-card {
    max-height: min(90vh, 900px);
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
  }

  .btn,
  .tiny-btn,
  .seg,
  .page-btn,
  .date-trigger,
  .cal-nav,
  .export-type,
  .remove-option {
    min-height: 2.75rem;
  }

  .tiny-btn {
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
  }

  .field select,
  .field input,
  .field textarea,
  .page-size select,
  .login-card input {
    font-size: 16px;
    min-height: 2.85rem;
  }

  .data-table tbody tr:hover {
    background: transparent;
  }

  .data-table tbody tr:active {
    background: rgba(255, 255, 255, 0.05);
  }

  .stat-tile:hover,
  .status-tile:hover {
    transform: none;
  }

  .stat-tile:active,
  .status-tile:active,
  .stat-tile.active,
  .status-tile.active {
    transform: translateY(-1px);
  }

  .calendar-popover {
    width: min(340px, calc(100vw - 2rem));
  }

  .icon-action {
    width: 2.75rem;
    height: 2.75rem;
  }

  .icon-action svg {
    width: 1.2rem;
    height: 1.2rem;
  }

  .row-actions {
    gap: 0.45rem;
  }
}

@media (hover: none) and (pointer: coarse) and (min-width: 721px) and (orientation: landscape) {
  .hero-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (hover: none) and (pointer: coarse) and (max-width: 720px) {
  .topbar,
  .layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    width: 100%;
  }

  .date-trigger {
    width: 100%;
  }

  .calendar-popover {
    left: 0;
    right: 0;
    width: auto;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-stats {
    grid-template-columns: 1fr;
  }

  .user-menu {
    width: 100%;
    margin-left: 0;
    border-left: none;
    padding-left: 0;
    justify-content: space-between;
  }
}
