:root {
  /* Font Family */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Core Colors */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-light: #e0e7ff;
  
  /* Theme Colors (Light Mode Dashboard with Dark Sidebar) */
  --ink: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --panel: #ffffff;
  
  /* Status Colors (Soft background, crisp text) */
  --blue: #3b82f6;
  --blue-bg: #eff6ff;
  --blue-text: #1d4ed8;
  
  --teal: #0d9488;
  --teal-bg: #f0fdfa;
  --teal-text: #115e59;
  
  --green: #10b981;
  --green-bg: #ecfdf5;
  --green-text: #065f46;
  
  --red: #ef4444;
  --red-bg: #fef2f2;
  --red-text: #991b1b;
  
  --amber: #f59e0b;
  --amber-bg: #fffbeb;
  --amber-text: #92400e;
  
  --violet: #8b5cf6;
  --violet-bg: #f5f3ff;
  --violet-text: #5b21b6;
  
  /* Borders and Shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

/* Buttons */
button,
.button-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

button:hover,
.button-link:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--ink);
}

button:active,
.button-link:active {
  transform: translateY(1px);
}

.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.hidden {
  display: none !important;
}

/* Premium Login Screen */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: 
    radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(13, 148, 136, 0.06) 0%, transparent 40%),
    #0f172a;
  position: relative;
  overflow: hidden;
}

.login-panel {
  width: min(450px, 100%);
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  padding: 40px;
  display: grid;
  gap: 20px;
  position: relative;
  z-index: 5;
}

.login-brand {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  text-align: center;
}

.login-brand span {
  color: #818cf8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.login-brand h1 {
  color: #ffffff;
  font-size: 32px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
}

.login-brand p {
  color: #94a3b8;
  margin: 0;
  line-height: 1.5;
  font-size: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-panel label {
  color: #cbd5e1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
  background: #fff;
}

.login-panel input {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.login-panel input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
  background: rgba(15, 23, 42, 0.7);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.error-text {
  color: #f87171;
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}

/* App Shell Layout */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

/* Sidebar Nav (Modern Premium Dark Theme) */
.sidebar {
  background: #0f172a;
  border-right: 1px solid #1e293b;
  color: #fff;
  padding: 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-block {
  display: grid;
  gap: 6px;
  padding-bottom: 20px;
  border-bottom: 1px solid #1e293b;
}

.brand-block strong {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-block span {
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  justify-content: flex-start;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  width: 100%;
  font-weight: 600;
  box-shadow: none;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #f1f5f9;
}

.nav-item.active {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
}

.sidebar-foot {
  display: grid;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
}

.sidebar-foot span {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-foot span::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #10b981;
}

#logoutButton {
  width: 100%;
  background: transparent;
  border-color: #334155;
  color: #94a3b8;
  box-shadow: none;
}

#logoutButton:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Main Content Area */
.content {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 40px;
  background: var(--bg);
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-block;
  margin-bottom: 4px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#refreshButton {
  background: #ffffff;
  color: var(--ink);
}

.view {
  display: none;
  gap: 24px;
  animation: fadeIn 0.2s ease-out;
}

.view:not(.active) {
  display: none !important;
}

.view.active {
  display: grid;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Metrics Grid (Premium Cards) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  min-height: 120px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  transition: var(--transition);
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric:hover::after {
  background: var(--brand);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric strong {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.metric small {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.panel-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Two Column Layouts */
.two-column {
  display: flex;
  gap: 0;
  align-items: stretch;
  width: 100%;
}

.two-column > .panel:first-child {
  width: 60%;
  flex-shrink: 0;
  min-width: 320px;
  resize: vertical;
  overflow: auto;
  min-height: 520px;
}

.two-column > .panel:last-child {
  flex: 1;
  min-width: 320px;
  min-height: 0;
}

.two-column.narrow-right {
  display: flex;
  gap: 0;
  align-items: stretch;
  width: 100%;
}

.two-column.narrow-right > .panel:first-child {
  width: 65%;
  flex-shrink: 0;
  min-width: 320px;
  resize: vertical;
  overflow: auto;
  min-height: 520px;
}

.two-column.narrow-right > .panel:last-child {
  flex: 1;
  min-width: 320px;
  min-height: 0;
}

/* Draggable Splitter */
.splitter {
  width: 16px;
  cursor: col-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  margin: 0 -4px;
  transition: background-color 0.2s;
}

.splitter:hover, .splitter.dragging {
  background-color: var(--line);
}

.splitter::before {
  content: "";
  width: 4px;
  height: 40px;
  background: var(--muted-light);
  border-radius: 2px;
}

/* Tags and Badges */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Forms styling */
.form-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stack-form {
  padding: 24px;
  display: grid;
  gap: 16px;
}

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

.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Tables styling */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.compact-table table {
  min-width: 600px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 !important;
}

td {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
  white-space: normal;
}

/* Resizable Columns */
.th-content {
  padding: 14px 18px;
  resize: horizontal;
  overflow: hidden;
  display: block;
  min-width: 60px;
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-content:hover {
  overflow: auto;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

tr {
  transition: var(--transition);
}

tr:hover td {
  background: #f8fafc;
}

.num {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}

/* Chips / Badges for Status */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 100px;
  padding: 3px 12px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: var(--transition);
}

.chip.green {
  background: var(--green-bg);
  color: var(--green-text);
}

.chip.amber {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.chip.red {
  background: var(--red-bg);
  color: var(--red-text);
}

.chip.blue {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.positive {
  color: var(--green-text);
  font-weight: 600;
}

.negative {
  color: var(--red-text);
  font-weight: 600;
}

/* Platform Margin bars */
.bar-list {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px minmax(80px, 1fr) 90px;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
}

.bar-row span:first-child {
  font-weight: 600;
  color: var(--ink);
}

.bar-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 100px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--teal) 100%);
  min-width: 4px;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Platform Cards */
.platform-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.platform-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: grid;
  gap: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.platform-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.platform-card strong {
  font-size: 17px;
  font-weight: 700;
}

.platform-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.cap-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Report Cards */
.report-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: grid;
  gap: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.report-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.report-card strong {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.small-action {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Toasts (Subtle dynamic alert) */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  max-width: min(380px, calc(100vw - 48px));
  z-index: 50;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Receipts Layout for Print */
.receipt-print {
  display: none;
}

.receipt-copy-label {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 3px;
  margin-bottom: 6px;
  font-weight: 900;
  font-size: 11pt;
  text-transform: uppercase;
  color: #000;
}

.receipt-sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px;
  background: #fff;
  color: #0f172a;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

.receipt-title {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.receipt-title h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.receipt-title span,
.receipt-row span,
.receipt-row small,
.receipt-note {
  color: var(--muted);
}

.receipt-code {
  text-align: right;
  min-width: 200px;
  display: grid;
  gap: 6px;
}

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

.receipt-row {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
  min-width: 0;
}

.receipt-row.wide {
  grid-column: 1 / -1;
}

.receipt-row span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.receipt-row strong {
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  color: #0f172a;
}

.receipt-total {
  border: 2px solid #0f172a;
  padding: 16px;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 20px;
  font-weight: 800;
  border-radius: var(--radius-sm);
}

.receipt-note {
  font-size: 12px;
  line-height: 1.5;
  margin: 20px 0 0;
}

.receipt-privacy {
  font-size: 10px;
  line-height: 1.4;
  margin-top: 16px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  color: var(--muted);
  text-align: justify;
}

.receipt-issuer {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #cbd5e1;
  color: #1e293b;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Responsiveness Media Queries */
@media (max-width: 1150px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid #1e293b;
    grid-template-rows: auto auto;
    padding: 20px;
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .nav-item {
    white-space: nowrap;
  }

  .sidebar-foot {
    grid-auto-flow: column;
    align-items: center;
    border-top: none;
    padding-top: 0;
  }

  #logoutButton {
    width: auto;
    min-height: 38px;
  }

  .metrics-grid,
  .two-column,
  .two-column.narrow-right,
  .platform-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .content {
    padding: 20px;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  button,
  .button-link {
    width: 100%;
  }

  .actions {
    flex-direction: column-reverse;
  }
}

/* Printing styling */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  @page receipt {
    size: 72.1mm 210mm;
    margin: 2mm;
  }

  @page {
    size: 72.1mm 210mm;
    margin: 2mm;
  }

  body.receipt-mode .app-shell,
  body.receipt-mode .login-view,
  body.receipt-mode .toast {
    display: none !important;
  }

  body.receipt-mode {
    page: receipt;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif !important;
    color: #000000 !important;
  }

  /* Forza colore nero puro e spessore per tutti i testi stampabili */
  body.receipt-mode * {
    color: #000000 !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.receipt-mode .receipt-print {
    display: block !important;
  }

  body.receipt-mode .receipt-sheet {
    width: 72.1mm;
    max-width: 72.1mm;
    box-sizing: border-box;
    padding: 0;
    margin: 0 auto;
    box-shadow: none;
    border: none;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.receipt-mode .receipt-copy-label {
    border-bottom-width: 1.5px;
    padding-bottom: 2px;
    margin-bottom: 3px;
    font-size: 8.5pt;
    line-height: 1.1;
  }

  body.receipt-mode .receipt-sheet:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  body.receipt-mode .receipt-title {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1.5px solid #000000 !important;
  }

  body.receipt-mode .receipt-title h1 {
    font-size: 12.5pt;
    font-weight: 900 !important;
    margin: 0 0 2px;
  }

  body.receipt-mode .receipt-title span {
    font-size: 8pt;
    font-weight: 800 !important;
  }

  body.receipt-mode .receipt-code {
    text-align: center;
    min-width: 100%;
    gap: 2px;
  }

  body.receipt-mode .receipt-code strong {
    font-size: 10.5pt;
    font-weight: 900 !important;
  }

  body.receipt-mode .receipt-code span {
    font-size: 7pt;
    font-weight: 700 !important;
  }

  body.receipt-mode .receipt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 5px;
  }

  body.receipt-mode .receipt-row {
    padding-bottom: 3px;
    gap: 1px;
    border-bottom: 1px solid #000000 !important;
  }

  body.receipt-mode .receipt-row.wide {
    grid-column: 1 / -1;
  }

  body.receipt-mode .receipt-row span {
    font-size: 7.2pt;
    font-weight: 800 !important;
  }

  body.receipt-mode .receipt-row strong {
    font-size: 9pt;
    font-weight: 900 !important;
    line-height: 1.2;
  }

  body.receipt-mode .receipt-row small {
    font-size: 8pt;
    font-weight: 800 !important;
    line-height: 1.15;
  }

  body.receipt-mode .receipt-total {
    padding: 6px 8px;
    margin-top: 7px;
    font-size: 10.5pt;
    font-weight: 900 !important;
    border: 1.5px solid #000000 !important;
    border-radius: var(--radius-sm);
  }

  body.receipt-mode .receipt-note {
    font-size: 7.2pt;
    font-weight: 700 !important;
    text-align: center;
    margin: 6px 0 0;
    line-height: 1.2;
  }

  body.receipt-mode .receipt-privacy {
    font-size: 6.5pt;
    font-weight: normal !important;
    text-align: justify;
    margin-top: 6px;
    line-height: 1.15;
    border-top: 1px dashed #000000 !important;
    padding-top: 4px;
  }

  body.receipt-mode .receipt-issuer {
    margin-top: 4px;
    padding-top: 3px;
    border-top: 1px solid #000000 !important;
    font-size: 6.5pt;
    line-height: 1.15;
  }
}

/* F24 Upload Area */
.f24-upload-zone {
  grid-column: 1 / -1;
  border: 2px dashed var(--brand);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  background: rgba(79, 70, 229, 0.02);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 12px;
}

.f24-upload-zone:hover, .f24-upload-zone.dragover {
  background: rgba(79, 70, 229, 0.06);
  border-color: var(--brand-hover);
}

.f24-upload-zone p {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.f24-upload-zone small {
  font-size: 12px;
  color: var(--muted);
}

.f24-spinner {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
}

.f24-spinner::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand);
  border-top-color: transparent;
  border-radius: 50%;
  animation: f24-spin 0.8s linear infinite;
}

@keyframes f24-spin {
  to { transform: rotate(360deg); }
}

/* App Grid Dashboard styling (Clean Launcher Grid) */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 32px;
  justify-content: center;
  max-width: 1100px;
  margin: 40px auto;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 24px;
  border-radius: 32px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  background: transparent;
  border: none;
}

.app-card::before {
  display: none;
}

.app-card:hover {
  transform: scale(1.08);
}

.app-icon {
  font-size: 80px;
  margin-bottom: 20px;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 44px;
  color: #fff;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.16), 0 4px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover .app-icon {
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.24), 0 8px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

.app-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* Modal Dialog and Overlay Styles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal-container {
  background: #ffffff;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes modalScaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.modal-head h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 28px;
  font-weight: 300;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  margin-top: -8px;
  transition: color 0.2s ease;
}

.close-modal-btn:hover {
  color: var(--ink);
}

/* Stili specifici per il modulo Nuova Spedizione (Stile GLS WebLabeling) */
.address-block {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.small-action-yellow {
  background: #f59e0b;
  color: #fff;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.small-action-yellow:hover {
  background: #d97706;
  border-color: #d97706;
}

.small-action-yellow:active {
  transform: scale(0.98);
}

.action-btn-yellow {
  background: #f59e0b;
  color: #fff;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.action-btn-yellow:hover {
  background: #d97706;
  border-color: #d97706;
  box-shadow: 0 4px 6px rgba(217, 119, 6, 0.3);
}

.action-btn-yellow:active {
  transform: translateY(1px);
}

/* Rubrica list item hover styling */
.lookup-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  text-align: left;
}

.lookup-item:hover {
  background-color: #f1f5f9;
}

.lookup-item:last-child {
  border-bottom: none;
}

.lookup-item strong {
  display: block;
  color: var(--brand);
  font-size: 14px;
}

.lookup-item span {
  font-size: 12px;
  color: var(--muted);
}

/* Compact Forms inside Panels to Prevent Clipping */
.panel form.form-grid,
.panel form.stack-form {
  gap: 10px !important;
  padding: 16px !important;
}

.panel form.form-grid label,
.panel form.stack-form label {
  gap: 4px !important;
}

.panel form.form-grid input,
.panel form.form-grid select,
.panel form.form-grid textarea,
.panel form.stack-form input,
.panel form.stack-form select,
.panel form.stack-form textarea {
  min-height: 32px !important;
  padding: 6px 10px !important;
}

.panel form.form-grid textarea,
.panel form.stack-form textarea {
  min-height: 60px !important;
}

.panel form.form-grid .actions,
.panel form.stack-form .actions {
  margin-top: 4px !important;
}

/* Adjust lookup buttons in compact forms */
.panel form.form-grid .lookup-btn {
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 10px !important;
  margin: 0 !important;
}

/* Editable Header Inputs in Distinta Preview */
.distinta-editable-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 0 4px;
  margin: 0;
  width: 170px;
  outline: none;
  transition: all 0.2s ease;
}
.distinta-editable-input:focus {
  border-bottom: 1px solid var(--brand);
  background: rgba(9, 79, 243, 0.05);
}
.distinta-editable-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  font-style: italic;
}

/* Custom Sidebar-less Layout for Launcher Dashboard */
.sidebar {
  display: none !important;
}
.app-shell {
  grid-template-columns: 1fr !important;
}
.topbar {
  padding: 16px 24px;
}
.content {
  padding: 24px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}
.back-btn:hover {
  background: var(--primary);
  transform: translateX(-2px);
}

/* DYMO Label Print Styling & Overrides */
.dymo-print-area {
  display: none;
}

@media print {
  body.dymo-print-mode .app-shell,
  body.dymo-print-mode .modal-backdrop,
  body.dymo-print-mode .toast,
  body.dymo-print-mode .login-view,
  body.dymo-print-mode .receipt-print {
    display: none !important;
  }
  body.dymo-print-mode .dymo-print-area {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 89mm;
    margin: 0;
    padding: 0;
    background: #fff;
    color: #000;
  }
  body.dymo-print-mode .dymo-page {
    width: 89mm;
    height: 36mm;
    page-break-after: always;
    box-sizing: border-box;
    padding: 4mm 6mm;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
    color: #000;
  }
  body.dymo-print-mode .dymo-page:last-child {
    page-break-after: avoid;
  }
  body.dymo-print-mode {
    page: dymo;
  }
  @page dymo {
    size: 89mm 36mm;
    margin: 0;
  }
}
