:root {
  --black: #1071c8;
  --blue: #1071c8;
  --blue-bright: #168bf2;
  --blue-dark: #0b5ca6;
  --blue-soft: #eaf5ff;
  --ink: #1e2a36;
  --ink-soft: #43566a;
  --gold: #1071c8;
  --gold-soft: #eaf5ff;
  --gold-line: #b9dcff;
  --white: #ffffff;
  --paper: #f5f9ff;
  --panel: #ffffff;
  --panel-2: #eef6ff;
  --line: #d8e6f5;
  --line-strong: #adcce9;
  --muted: #5a6b7d;
  --danger: #c0392b;
  --warning: #9b6a17;
  --success: #1e8655;
  --focus: rgba(16, 113, 200, 0.55);
  --shadow: 0 18px 44px rgba(30, 82, 130, 0.08);
  --shadow-strong: 0 30px 80px rgba(30, 82, 130, 0.16);
  --radius: 8px;
  --radius-sm: 6px;
  color-scheme: light;
  font-family: "Montserrat", "Avenir Next", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(22, 139, 242, 0.14), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 50%, #eef5fc 100%);
  color: var(--ink);
  font-family: "Montserrat", "Avenir Next", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none !important;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus);
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px var(--focus);
  outline: 0;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: "Montserrat", "Avenir Next", system-ui, sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 800;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 800;
  line-height: 1.12;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.22;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  padding: 11px 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
}

input::placeholder,
textarea::placeholder {
  color: #9aaabc;
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: var(--warning);
  background: #fffaf1;
}

input.is-invalid:focus,
select.is-invalid:focus,
textarea.is-invalid:focus {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(155, 106, 23, 0.16);
}

.field-warning {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 4px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.field-warning::before {
  content: "⚠";
  font-size: 12px;
  line-height: 1.35;
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  box-shadow: 0 12px 24px rgba(22, 139, 242, 0.2);
  color: var(--white);
}

.primary:hover {
  background: linear-gradient(135deg, #299cff, var(--blue-dark));
  box-shadow: 0 16px 30px rgba(22, 139, 242, 0.26);
  transform: translateY(-1px);
}

.secondary {
  border: 1px solid #cfe0f1;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(30, 82, 130, 0.06);
}

.secondary:hover {
  border-color: var(--gold-line);
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(30, 82, 130, 0.1);
  transform: translateY(-1px);
}

.secondary.danger-text {
  border-color: rgba(196, 73, 73, 0.24);
  background: #fff7f7;
  color: var(--danger);
}

.secondary.danger-text:hover {
  border-color: rgba(196, 73, 73, 0.4);
  background: #fff0f0;
}

.ghost {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.ghost:hover {
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.danger {
  color: var(--danger);
}

.full {
  width: 100%;
}

.error {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 75% 14%, rgba(22, 139, 242, 0.22), transparent 28%),
    radial-gradient(circle at 18% 82%, rgba(107, 188, 255, 0.18), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f3f9ff 48%, #eaf4ff 100%);
}

.login-panel {
  position: relative;
  overflow: hidden;
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-strong);
  padding: 34px;
}

.login-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), #65bcff);
  content: "";
}

.app {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(22, 139, 242, 0.11), transparent 30%),
    var(--white);
  color: var(--ink);
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 10px;
}

.brand-mark {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  object-fit: contain;
}

.brand strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.brand span:last-child,
.sidebar-foot {
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #586d82;
  padding: 11px 12px 11px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.nav button::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--blue);
  content: "";
  opacity: 0;
}

.nav button.active,
.nav button:hover {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.nav button.active::before {
  opacity: 1;
}

.sidebar-foot {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fbff;
}

.sidebar-foot strong {
  color: var(--ink);
}

.sidebar-foot .ghost {
  border-color: var(--line);
  background: var(--white);
  color: var(--blue-dark);
}

.content {
  min-width: 0;
  max-width: 1680px;
  padding: 28px 32px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 40px;
  border: 1px solid #cfe0f1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(30, 82, 130, 0.08);
  padding: 4px;
}

.language-switcher button {
  display: grid;
  min-width: 40px;
  height: 36px;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.language-switcher button:hover {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.language-switcher button.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  box-shadow: 0 8px 18px rgba(22, 139, 242, 0.24);
  color: var(--white);
  transform: translateY(-1px);
}

.view {
  display: grid;
  gap: 16px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h3 {
  margin-bottom: 12px;
}

.kpi {
  min-height: 106px;
}

.kpi span,
.table-caption,
.small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.kpi .small {
  margin: 8px 0 0;
}

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

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.bar-row header span:last-child {
  color: var(--muted);
  text-align: right;
  font-weight: 600;
}

.bar-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e4eef8;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-dark), #58b6ff);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.table-wrap:has(.actions-menu[open]) {
  position: relative;
  z-index: 80;
  overflow: visible;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.compact-table {
  min-width: 0;
}

.mini-table-scroll {
  max-height: 560px;
  overflow: auto;
}

.mini-table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f3f8fd;
  color: #526a80;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td strong {
  font-weight: 700;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: #f3f9ff;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  padding: 14px;
}

.toolbar-left {
  display: flex;
  flex: 1 1 520px;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.toolbar-left label {
  min-width: 190px;
}

.toolbar input {
  max-width: 360px;
}

.dashboard-filters select,
.dashboard-filters input {
  max-width: 220px;
}

.control-board {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.control-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(22, 139, 242, 0.12), transparent 42%),
    #f8fbff;
  padding: 14px 16px;
}

.control-board-head h3 {
  font-size: 18px;
}

.control-board-head .eyebrow {
  margin-bottom: 4px;
}

.compact-controls .control-board-head {
  border-bottom: 0;
}

.compact-controls {
  overflow: visible;
}

.control-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, max-content));
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
}

.dashboard-filters .control-filters {
  grid-template-columns: 260px minmax(240px, 1fr) 180px;
}

.payment-controls {
  grid-template-columns: 260px minmax(260px, 420px) 180px 190px;
  justify-content: start;
}

.customer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: end;
}
.customer-controls > .segmented {
  flex: 0 0 auto;
  align-self: end;
}
.customer-controls > label {
  flex: 1 1 148px;
  min-width: 132px;
}
.customer-controls > .search-field {
  flex: 2 1 220px;
}
.customer-controls > .column-chooser {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: end;
}

.column-chooser {
  position: relative;
}

.column-chooser summary {
  display: grid;
  min-height: 44px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #cfe0f1;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.column-chooser summary::-webkit-details-marker {
  display: none;
}

.column-chooser summary span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.column-chooser summary strong {
  color: var(--blue-dark);
  font-size: 12px;
}

.column-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  width: 220px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-strong);
  padding: 10px;
}

.column-check {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.column-check:hover {
  background: var(--blue-soft);
}

.column-check input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.period-field,
.control-filters label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-filters input,
.control-filters select {
  min-height: 44px;
  border-color: #cfe0f1;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
}

.search-field {
  min-width: 0;
}

.month-stepper,
.year-stepper {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  overflow: hidden;
  border: 1px solid #cfe0f1;
  border-radius: var(--radius);
  background: var(--white);
}

.month-stepper button,
.year-stepper button {
  display: grid;
  min-height: 44px;
  place-items: center;
  background: var(--blue);
  color: var(--white);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.month-stepper button:hover,
.year-stepper button:hover {
  background: var(--blue-dark);
  color: var(--white);
}

.month-stepper input,
.year-stepper input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.year-stepper input {
  font-size: 16px;
}

.month-stepper input:focus,
.year-stepper input:focus {
  box-shadow: inset 0 0 0 2px var(--gold);
}

.control-segment {
  background: var(--white);
}

.pill-list,
.checks,
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customer-data-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
  padding: 12px 16px;
}

.customer-data-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-status {
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background: var(--gold-soft);
  color: var(--ink-soft);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.segmented button {
  min-height: 40px;
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
  font-weight: 600;
}

.segmented button.active {
  background: var(--blue);
  color: var(--white);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink-soft);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.success {
  border-color: rgba(31, 122, 77, 0.2);
  background: rgba(31, 122, 77, 0.1);
  color: var(--success);
}

.pill.warning {
  border-color: rgba(155, 106, 23, 0.22);
  background: rgba(255, 193, 91, 0.2);
  color: var(--warning);
}

.pill.waiting {
  border-color: rgba(15, 23, 42, 0.16);
  background: #334155;
  color: #ffffff;
}

.pill.danger {
  border-color: rgba(185, 65, 65, 0.2);
  background: rgba(185, 65, 65, 0.1);
  color: var(--danger);
}

.luxury-pill {
  margin-top: 7px;
  border-color: rgba(22, 139, 242, 0.24);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.neutral-pill {
  border-color: rgba(102, 119, 137, 0.18);
  background: #f3f7fb;
  color: var(--muted);
}

.customer-table {
  min-width: 980px;
}

.customer-table .luxury-pill {
  margin-top: 0;
}

.customer-table th:first-child,
.customer-table td:first-child {
  min-width: 240px;
}

.customer-table th:last-child,
.customer-table td:last-child {
  width: 120px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.payment-method-pill {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6faff;
  padding: 5px 9px;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
}

.payment-method-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--blue);
}

.payment-method-pill.is-bank {
  border-color: #cce8d9;
  background: #effaf4;
  color: #287547;
}

.payment-method-pill.is-bank::before {
  background: #3aa568;
}

.payment-method-pill.is-crypto {
  border-color: #f5ddb4;
  background: #fff8eb;
  color: #9a6200;
}

.payment-method-pill.is-crypto::before {
  background: #e69b1f;
}

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

.action-stack {
  align-items: center;
  flex-wrap: nowrap;
}

.actions-menu {
  position: relative;
}

.actions-menu[open] {
  z-index: 3000;
}

.actions-menu summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: transparent;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
  list-style: none;
}

.actions-menu summary::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-soft);
  box-shadow: 0 -6px 0 var(--ink-soft), 0 6px 0 var(--ink-soft);
}

.actions-menu summary::-webkit-details-marker {
  display: none;
}

.actions-menu[open] summary,
.actions-menu summary:hover {
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.actions-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 168px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 6px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.actions-menu[open] .actions-panel {
  position: fixed;
  z-index: 2000;
  top: var(--actions-panel-top, 0);
  right: auto;
  left: var(--actions-panel-left, 0);
  min-width: 168px;
  max-height: min(260px, calc(100vh - 24px));
  overflow-y: auto;
  animation: actionMenuIn 0.14s ease;
}

@keyframes actionMenuIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.actions-panel button {
  min-height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.actions-panel button:hover {
  background: var(--blue-soft);
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.text-button:hover {
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.text-button.primary-lite {
  border-color: rgba(22, 139, 242, 0.28);
  background: linear-gradient(180deg, #eff7ff 0%, #e3f1ff 100%);
  color: var(--blue-dark);
}

.text-button.primary-lite:hover {
  border-color: rgba(22, 139, 242, 0.5);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(22, 139, 242, 0.12);
}

.table-link,
.status-jump {
  width: auto;
  min-height: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.table-link:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.status-jump {
  display: inline-flex;
}

.status-jump:hover .pill {
  box-shadow: 0 0 0 2px rgba(22, 139, 242, 0.14);
}

.danger-text {
  color: var(--danger);
}

.inline-money,
.inline-select {
  min-width: 126px;
  padding: 8px 9px;
}

.inline-money {
  max-width: 150px;
}

.money-edit {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 128px;
}

.money-edit::after {
  position: absolute;
  right: 13px;
  color: #6a7d90;
  content: "€";
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  transition: color 0.16s ease;
}

.money-edit .inline-money {
  min-width: 124px;
  width: 124px;
  max-width: 124px;
  min-height: 40px;
  padding: 9px 32px 9px 12px;
  color: #223143;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0;
  text-align: right;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.money-edit .inline-money[readonly] {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: var(--ink);
  cursor: pointer;
  border-color: #cfe0f1;
  box-shadow: inset 0 0 0 1px rgba(22, 139, 242, 0.03);
}

.money-edit .inline-money[readonly]:hover {
  background: #ffffff;
  border-color: rgba(22, 139, 242, 0.42);
  box-shadow: 0 6px 14px rgba(22, 139, 242, 0.1);
}

.money-edit .inline-money.is-editing {
  background: #ffffff;
  cursor: text;
  box-shadow: 0 0 0 3px rgba(22, 139, 242, 0.16);
}

.money-edit:focus-within::after,
.money-edit:hover::after {
  color: var(--blue-dark);
}

.inline-money::-webkit-inner-spin-button,
.inline-money::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.inline-money[type="number"] {
  -moz-appearance: textfield;
}

.money-edit .inline-money.is-saving {
  opacity: 0.62;
}

.money-edit-button {
  display: none !important;
}

.calendar-due .money-edit {
  min-width: 128px;
}

.calendar-cell .money-edit {
  min-width: 0;
}

.calendar-cell .inline-money {
  padding: 6px 26px 6px 8px;
  text-align: right;
  font-weight: 700;
}

.charge-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.charge-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  min-width: 158px;
  border: 1px solid rgba(22, 139, 242, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, #f5faff 0%, #edf6ff 100%);
  padding: 6px;
}

.charge-main {
  display: grid;
  gap: 2px;
  min-height: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  color: var(--ink);
  text-align: left;
}

.charge-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.charge-main strong {
  color: var(--blue-dark);
  font-size: 13px;
  line-height: 1.1;
}

.charge-delete {
  min-height: 24px;
  border: 1px solid rgba(185, 65, 65, 0.2);
  border-radius: 999px;
  background: #fff5f5;
  color: var(--danger);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
}

.charge-delete:hover {
  border-color: rgba(185, 65, 65, 0.38);
  background: #ffe9e9;
}

.calendar-extra-button {
  justify-content: center;
  min-height: 34px;
  border-style: dashed;
  border-color: #b7d9fa;
  background: #f8fbff;
  color: var(--blue-dark);
  white-space: nowrap;
}

.calendar-due .calendar-extra-button {
  margin-top: 8px;
}

.calendar-empty .calendar-extra-button {
  margin: 0 auto;
}

.calendar-extra-slot {
  min-width: 124px;
}

.installment-select {
  min-width: 112px;
  margin-bottom: 4px;
  background: #eef6ff;
  border-color: #b8d7ff;
  color: #155ca6;
  font-weight: 700;
}

.empty {
  padding: 30px;
  text-align: center;
}

.dialog {
  width: min(900px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-strong);
  padding: 0;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
}

.confirm-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 0;
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
}

.confirm-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-strong);
  padding: 24px;
}

.confirm-card h3 {
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.confirm-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.confirm-card strong {
  color: var(--ink);
}

.date-confirm-field {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.date-confirm-field input {
  width: 100%;
  text-transform: none;
}

.subscription-change-dialog {
  width: min(620px, calc(100vw - 28px));
}

.subscription-change-card {
  gap: 18px;
}

.subscription-change-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.subscription-change-summary span {
  display: grid;
  gap: 6px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subscription-change-summary strong {
  align-self: end;
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
}

.subscription-effective-date {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 14px;
}

.subscription-effective-date .small {
  margin: -2px 0 0;
}

.date-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-preset {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  padding: 6px 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.date-preset:hover,
.date-preset.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

@media (max-width: 620px) {
  .subscription-change-summary {
    grid-template-columns: 1fr;
  }
}

.confirm-card .dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 0;
  border-top: 0;
  background: transparent;
  padding: 0;
}

.confirm-card .dialog-actions button {
  min-height: 44px;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
}

.confirm-card .dialog-actions .primary {
  min-width: 138px;
}

.confirm-card .dialog-actions .secondary {
  min-width: 112px;
}

.confirm-card .dialog-actions .danger-text {
  margin-right: auto;
}

.dialog form,
.dialog-body {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.dialog-head,
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.dialog-actions {
  grid-template-columns: auto auto 1fr auto auto;
  margin: 0 -24px -24px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
  padding: 14px 24px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.icon-button:hover {
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.duplicate-hint {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(22, 139, 242, 0.2);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
  padding: 10px;
}

.duplicate-hint p {
  margin: 0;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.duplicate-list {
  display: grid;
  gap: 6px;
}

.duplicate-list button {
  display: grid;
  width: 100%;
  gap: 2px;
  border: 1px solid rgba(22, 139, 242, 0.16);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.duplicate-list button:hover {
  border-color: rgba(22, 139, 242, 0.45);
  box-shadow: 0 8px 20px rgba(22, 139, 242, 0.12);
}

.duplicate-list strong {
  font-size: 13px;
}

.duplicate-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0;
  padding: 16px;
  background: var(--white);
}

legend {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}

.check-pill:has(input:checked) {
  border-color: var(--gold-line);
  background: var(--gold-soft);
  color: var(--blue-dark);
}

.check-pill input {
  width: auto;
  accent-color: var(--gold);
}

.option-checks {
  margin-top: 14px;
}

.price-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.price-preview span {
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  padding: 9px 11px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.price-preview strong {
  color: var(--blue-dark);
  font-weight: 700;
}

.metric-list {
  display: grid;
  gap: 2px;
}

.metric-row {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span,
.metric-row small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.metric-row strong {
  font-size: 18px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.kpi strong {
  font-variant-numeric: tabular-nums;
}

.calendar-board,
.calendar-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.calendar-board {
  display: grid;
  gap: 0;
}

.calendar-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 86% 10%, rgba(22, 139, 242, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f1f8ff);
  color: var(--ink);
  padding: 20px;
}

.calendar-board-head h3,
.calendar-board-head .eyebrow {
  color: var(--ink);
}

.calendar-board-head .eyebrow {
  color: var(--blue);
}

.calendar-board-head .muted {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
}

.calendar-board-stats {
  display: grid;
  min-width: 260px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.calendar-board-stats span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.calendar-board-stats strong {
  color: var(--blue);
  font-size: 20px;
  font-weight: 700;
}

.calendar-filters {
  display: grid;
  grid-template-columns: 210px 150px 140px 118px minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  padding: 16px;
}

.calendar-filters label,
.calendar-year-field {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-filters input,
.calendar-filters select {
  min-height: 44px;
  border-color: #cfe0f1;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
}

.calendar-year-picker {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  overflow: hidden;
  border: 1px solid #cfe0f1;
  border-radius: var(--radius);
  background: var(--white);
}

.calendar-year-picker button {
  display: grid;
  min-height: 44px;
  place-items: center;
  background: var(--blue);
  color: var(--white);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.calendar-year-picker button:hover {
  background: var(--blue-dark);
  color: var(--white);
}

.calendar-year-picker input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.calendar-year-picker input:focus {
  box-shadow: inset 0 0 0 2px var(--gold);
}

.calendar-search {
  min-width: 0;
}

.calendar-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.calendar-kpis .kpi {
  min-height: 96px;
}

.calendar-kpis .kpi strong {
  font-size: clamp(20px, 1.75vw, 26px);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  padding: 7px 11px 7px 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.legend-pill:hover {
  border-color: #b7d9fa;
  box-shadow: 0 8px 18px rgba(22, 139, 242, 0.1);
  transform: translateY(-1px);
}

.legend-pill.active {
  border-color: #9dccfa;
  background: #f6fbff;
  color: var(--ink);
}

.legend-pill.muted {
  opacity: 0.45;
  box-shadow: none;
}

.legend-check {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid #aac7e7;
  border-radius: 4px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.legend-pill.active .legend-check {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.legend-dot.paid {
  background: #1f9a5d;
}

.legend-dot.progress {
  background: #f7b955;
}

.legend-dot.problem {
  background: #c84f4f;
}

.legend-dot.waiting {
  background: #334155;
}

.calendar-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
  padding: 14px 16px;
}

.calendar-shell-head h3 {
  font-size: 18px;
}

.calendar-shell-head .eyebrow {
  margin-bottom: 4px;
}

.calendar-matrix-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
  background:
    linear-gradient(90deg, rgba(22, 139, 242, 0.08), transparent 18%),
    var(--white);
}

.calendar-matrix {
  min-width: 1720px;
  border-collapse: separate;
  border-spacing: 0;
}

.calendar-matrix th,
.calendar-matrix td {
  border-right: 1px solid #e1ebf6;
  border-bottom: 1px solid #e1ebf6;
  padding: 9px;
  background: var(--white);
  vertical-align: middle;
}

.calendar-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--blue);
  color: var(--white);
  text-align: center;
}

.calendar-matrix thead tr:nth-child(2) th {
  top: 39px;
  background: var(--blue-dark);
  color: #eaf5ff;
  font-size: 10px;
  font-weight: 700;
}

.calendar-matrix .month-head {
  border-left: 2px solid #9bd2ff;
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.calendar-matrix .sticky-col {
  position: sticky;
  z-index: 4;
  background: #fbfdff;
}

.calendar-matrix thead .sticky-col {
  z-index: 7;
  background: #0f6fd0;
  color: var(--white);
}

.calendar-matrix tbody tr:nth-child(even) td {
  background-color: #fbfdff;
}

.calendar-matrix tbody tr:hover td {
  background-color: #f0f8ff;
}

.calendar-matrix .main-col {
  left: 0;
  min-width: 240px;
  max-width: 240px;
  box-shadow: 8px 0 16px rgba(0, 0, 0, 0.04);
}

.calendar-matrix .plan-col {
  left: 240px;
  min-width: 86px;
  max-width: 86px;
  text-align: center;
}

.calendar-matrix .nation-col {
  left: 326px;
  min-width: 92px;
  max-width: 92px;
  text-align: center;
}

.calendar-cell {
  min-width: 118px;
  width: 118px;
  text-align: center;
  padding: 6px !important;
}

.calendar-cell .money-edit {
  display: flex;
  width: 100%;
  min-width: 0;
  margin-bottom: 5px;
}

.calendar-cell .money-edit .inline-money {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 22px 6px 8px;
}

.calendar-cell .status-control.mini {
  width: 100%;
  min-height: 0;
  padding: 5px 6px;
  font-size: 11px;
}

.calendar-due {
  min-width: 118px;
}

.calendar-empty {
  min-width: 118px;
  width: 118px;
  background: #fafcfe !important;
}

.calendar-empty:not(.calendar-extra-slot)::before {
  content: "\2013";
  color: #c2d0df;
  font-weight: 700;
}

/* Stato: accento colorato a sinistra (niente doppia tinta sulla cella) */
.calendar-cell.is-paid { box-shadow: inset 4px 0 0 #2f9e6b; }
.calendar-cell.is-progress { box-shadow: inset 4px 0 0 #e0a52e; }
.calendar-cell.has-problem { box-shadow: inset 4px 0 0 #d0463a; }
.calendar-cell.is-waiting { box-shadow: inset 4px 0 0 #8aa0b6; }

.status-control {
  border-color: rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

.status-control.is-paid {
  background: #e6f6ed !important;
  border-color: #98d9b7;
  color: #137a43;
}

.status-control.is-progress {
  background: #fff4d6 !important;
  border-color: #f0be5a;
  color: #9a5a00;
}

.status-control.has-problem {
  background: #ffe8e8 !important;
  border-color: #f0a2a2;
  color: #b42318;
}

.status-control.is-waiting {
  background: #334155 !important;
  border-color: #263241;
  color: #ffffff;
}

.status-control option {
  background: #ffffff;
  color: #1f2937;
}

.team-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 150px auto;
  gap: 10px;
  align-items: end;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.extra-grid {
  margin-top: 14px;
}

@media (max-width: 1180px) {
  .kpis,
  .calendar-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-board-head {
    flex-direction: column;
  }

  .calendar-board-stats {
    width: 100%;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-2,
  .calendar-grid,
  .calendar-filters,
  .control-filters,
  .dashboard-filters .control-filters,
  .payment-controls,
  .customer-controls,
  .form-grid,
  .team-form {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions {
    justify-content: flex-start;
    padding-top: 0;
  }
}

@media (max-width: 620px) {
  .content,
  .sidebar,
  .login-panel {
    padding: 18px;
  }

  .kpis,
  .calendar-kpis {
    grid-template-columns: 1fr;
  }

  .calendar-board-head,
  .calendar-filters,
  .calendar-shell-head {
    padding: 14px;
  }

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

  .toolbar,
  .toolbar-left,
  .toolbar-left label,
  .toolbar input,
  .customer-data-bar,
  .control-filters,
  .control-filters label,
  .period-field,
  .dashboard-filters select,
  .dashboard-filters input {
    width: 100%;
    max-width: none;
  }

  .customer-data-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-data-actions .text-button {
    justify-content: center;
    flex: 1 1 160px;
  }

  .control-board-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .dialog {
    width: calc(100vw - 16px);
  }

  .dialog form,
  .dialog-body {
    padding: 18px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
    margin: 0 -18px -18px;
    padding: 14px 18px;
  }

  .dialog-actions span {
    display: none;
  }
}

/* --- Integrazione Stripe --- */
.field-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.stripe-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
}
.stripe-stats {
  display: flex;
  gap: 26px;
}
.stripe-stats > div {
  display: flex;
  flex-direction: column;
}
.stripe-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.stripe-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.stripe-month-field {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--muted);
  gap: 4px;
}
.stripe-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}
.stripe-actions .primary {
  min-height: 34px;
  padding: 7px 16px;
  font-size: 13px;
  box-shadow: none;
  color: var(--white);
}
.stripe-actions .text-button {
  padding: 7px 10px;
}
.stripe-problem-row {
  background: rgba(196, 73, 73, 0.07);
}
#stripeActionStatus {
  flex-basis: 100%;
  margin: 0;
}

/* --- Lotto 1: accessibilita e leggibilita numeri --- */
table,
input[type="number"],
.stripe-stat-num,
.kpi-value,
.metric-value {
  font-variant-numeric: tabular-nums;
}

/* Importi e colonne numeriche allineate a destra */
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Colonna prezzo della tabella clienti: importo e MRR incolonnati a destra, niente a-capo brutto */
.customer-table td.cell-price strong {
  display: block;
  white-space: nowrap;
}
.customer-table td.cell-price .small {
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  color: var(--muted);
}

/* Input data/mese: icona del picker pulita, coerente e con area di click ampia */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
  padding: 5px;
  margin-left: 4px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease, background 0.15s ease;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="month"]:hover::-webkit-calendar-picker-indicator,
input[type="date"]:focus::-webkit-calendar-picker-indicator,
input[type="month"]:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
  background: var(--blue-soft);
}
/* Niente cifre incrementali sui campi numero usati come stepper/anno */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  height: 1.4em;
}

/* Rispetta la preferenza di sistema "riduci movimento" */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Lotto 1: toast / avvisi interni --- */
.toast-host {
  position: fixed;
  z-index: 1000;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius);
  background: #1e2a36;
  color: #fff;
  padding: 12px 16px;
  box-shadow: var(--shadow-strong);
  font-size: 14px;
  font-weight: 600;
  animation: toast-in 0.18s ease-out;
}
.toast-text { flex: 1; }
.toast-success { background: #14794c; }
.toast-error { background: #b1342b; }
.toast-undo {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  padding: 6px 12px;
  font-weight: 700;
}
.toast-undo:hover { background: rgba(255, 255, 255, 0.16); }
.toast-out { opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Lotto 1: Stripe badge/bottoni stato problema --- */
.stripe-actions .danger {
  min-height: 34px;
  padding: 7px 16px;
  border: 1px solid rgba(192, 57, 43, 0.4);
  border-radius: var(--radius-sm);
  background: #fff4f3;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}
.stripe-actions .danger:hover { background: #ffe9e7; border-color: var(--danger); }
.stripe-badge-problem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #fdeceb;
  color: var(--danger);
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.stripe-problem-row td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.stripe-amount-cell {
  white-space: nowrap;
}

.stripe-amount-value {
  display: block;
  font-size: 15px;
}

.stripe-amount-diff {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  border: 1px solid #ecdcb0;
  border-radius: 999px;
  background: #fdf6e3;
  padding: 2px 9px;
  color: #7a5c10;
  font-size: 11.5px;
  font-weight: 600;
}

.stripe-amount-diff b {
  font-weight: 800;
}

.stripe-amount-diff b.is-over { color: var(--success); }
.stripe-amount-diff b.is-under { color: var(--danger); }

.stripe-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

/* "Conferma tutti": spinto a destra nella section head; lo spinner di caricamento
   riusa la classe .is-busy (button.is-busy::after). */
.stripe-confirm-all {
  margin-left: auto;
}
.stripe-confirm-all:disabled {
  opacity: 0.85;
  cursor: progress;
}

.stripe-section-head h3 {
  font-size: 17px;
}

.stripe-section-head .pill {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 800;
}

.stripe-section-head .small {
  flex-basis: 100%;
  margin: 0;
}

.stripe-section-empty {
  margin: 0;
  padding: 26px 18px;
}

.stripe-table th.num {
  text-align: right;
}

.stripe-actions-head {
  text-align: right;
}

.stripe-table .stripe-actions {
  justify-content: flex-end;
}

/* --- Lotto 1: spinner sui bottoni occupati --- */
button.is-busy::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  button.is-busy::after { animation: none; }
}

/* --- Barra di caricamento del calendario --- */
.calendar-loading { display: grid; gap: 12px; }
.calendar-loading h3 { margin: 0; }
.loading-bar {
  position: relative;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.loading-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.loading-bar.is-indeterminate .loading-bar-fill {
  width: 35%;
  animation: loading-indeterminate 1.1s ease-in-out infinite;
}
.loading-pct { margin: 0; font-variant-numeric: tabular-nums; }
@keyframes loading-indeterminate {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-bar.is-indeterminate .loading-bar-fill { animation: none; width: 100%; margin-left: 0; }
  .loading-bar-fill { transition: none; }
}

/* --- Lotto 1: stati vuoti --- */
.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
}
.table-empty p { margin: 0; font-weight: 600; }
.table-empty p.muted { font-weight: 500; }
.confirm-card h3 { margin-bottom: 6px; }

/* --- Lotto 3: chip nazione (no emoji), tipografia, responsivita --- */
.flag-chip {
  display: inline-block;
  min-width: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
}

/* Base testo leggermente piu grande per un gestionale denso */
body { font-size: 15px; }
label { font-size: 12.5px; }

/* Sidebar comprimibile a icone su schermi stretti */
/* Laptop (980-1280px): barre filtri fluide invece di colonne fisse che si schiacciano */
@media (min-width: 981px) and (max-width: 1280px) {
  .customer-controls,
  .payment-controls,
  .calendar-filters,
  .dashboard-filters .control-filters,
  .control-filters {
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  }
  .customer-controls .search-field,
  .calendar-filters .calendar-search,
  .payment-controls .search-field { grid-column: 1 / -1; }
  .content { padding: 24px 22px; }
}

/* --- Scheda cliente: obbligatori + sezione richiudibile --- */
.req { color: var(--danger); font-weight: 800; }

.form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  margin-top: 4px;
}
.form-section > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}
.form-section > summary::-webkit-details-marker { display: none; }
.form-section > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}
.form-section[open] > summary::before { transform: rotate(45deg); }
.form-section > div,
.form-section > .price-preview { padding: 0 16px; }
.form-section > *:last-child { padding-bottom: 16px; }

/* --- Affordance 'modificabile' sugli importi nelle viste pagamenti --- */
.table-wrap td.num .money-edit { padding-left: 0; }
.table-wrap td.num .money-edit::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%236a7d90%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M12%2020h9%27%2F%3E%3Cpath%20d%3D%27M16.5%203.5a2.121%202.121%200%200%201%203%203L7%2019l-4%201%201-4Z%27%2F%3E%3C%2Fsvg%3E") no-repeat center / contain;
  opacity: 0.55;
  pointer-events: none;
}
.table-wrap td.num .money-edit:hover::before { opacity: 0.9; }
.table-wrap td.num .money-edit .inline-money[readonly] { padding-left: 30px; }
.table-wrap td.num .money-edit .inline-money.is-editing { padding-left: 30px; }

/* --- Responsive: ritocchi per telefoni --- */
@media (max-width: 600px) {
  .topbar-actions { flex-wrap: wrap; }
  .customer-data-bar { flex-wrap: wrap; gap: 10px; }
  .dialog-actions { flex-wrap: wrap; }
  .toast-host { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  h1 { font-size: clamp(26px, 7vw, 34px); }
  h2 { font-size: clamp(22px, 6vw, 30px); }
}

/* KPI fluide: si adattano da sole al numero di colonne che entrano */
.kpis,
.calendar-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* --- Menu hamburger (mobile/tablet) --- */
.topbar-lead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 0 11px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.app.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.app.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.app.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}
.app.nav-open .nav-backdrop { display: block !important; opacity: 1; visibility: visible; }

@media (max-width: 980px) {
  .nav-toggle { display: flex; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: 264px;
    max-width: 84vw;
    flex-direction: column;
    gap: 18px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 200;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .nav { grid-template-columns: 1fr; }
  .nav button { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-backdrop, .nav-toggle span { transition: none; }
}

/* --- Calendario su telefono: solo AZIENDA resta fissa, cosi si vedono i valori --- */
@media (max-width: 760px) {
  .calendar-matrix .main-col {
    min-width: 140px;
    max-width: 140px;
  }
  .calendar-matrix .plan-col {
    position: sticky;
    left: 140px;
    min-width: 64px;
    max-width: 64px;
  }
  .calendar-matrix .nation-col {
    position: sticky;
    left: 204px;
    min-width: 64px;
    max-width: 64px;
  }
  .calendar-cell {
    min-width: 92px;
    width: 92px;
  }
  .calendar-matrix .main-col td,
  .calendar-matrix .main-col {
    font-size: 13px;
  }
}

/* ============================================================
   MOBILE & TOUCH UX — pacchetto migliorie (giugno 2026)
   Blocco additivo in coda: override per non toccare le regole esistenti.
   ============================================================ */

/* Altezza calendario robusta sui browser mobile (dvh invece di vh) */
.calendar-matrix-wrap { max-height: calc(100dvh - 330px); }

/* Riduce il ritardo di ~300ms e il doppio-tap-zoom sui controlli touch */
button, a, summary, select, input, .nav button, .month-stepper button,
.icon-button, .text-button, .table-link, .status-jump, .actions-menu summary,
.date-preset, .legend-pill, .check-pill { touch-action: manipulation; }

/* Feedback di pressione immediato (su touch :hover non esiste) */
.primary:active, .secondary:active, .ghost:active, .danger:active,
.nav button:active, .icon-button:active, .text-button:active,
.month-stepper button:active, .actions-menu summary:active,
.date-preset:active, .nav-toggle:active {
  transform: translateY(0) scale(0.97);
}

/* Safe-area iPhone: toast e footer della sidebar non finiscono sotto la home indicator */
.toast-host { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.sidebar { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

/* Affordance di modifica visibili anche su touch (dove :hover non scatta) */
@media (hover: none) {
  .money-edit .inline-money[readonly] {
    border-style: dashed;
    border-color: var(--line-strong);
  }
  .money-edit::after { opacity: 1; }
  .status-jump .pill { box-shadow: 0 0 0 1px var(--line-strong); }
}

/* ---- Tablet e telefoni: target tocco >=44px e niente auto-zoom iOS ---- */
@media (max-width: 980px) {
  /* Rete di sicurezza: niente scroll orizzontale accidentale della pagina su schermi stretti */
  body { overflow-x: clip; }

  /* font >=16px sui campi: evita lo zoom forzato di Safari iOS al focus */
  input, select, textarea,
  .control-filters input, .control-filters select,
  .inline-money, .inline-select { font-size: 16px; }

  /* Aree di tocco comode (>=44px) sui controlli principali */
  .primary, .secondary, .ghost, .danger { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .nav-toggle { min-width: 44px; min-height: 44px; }
  .nav button { min-height: 44px; }
  .actions-menu summary { width: 44px; height: 44px; }
  .actions-panel button { min-height: 44px; }
  .text-button { min-height: 44px; display: inline-flex; align-items: center; }
  .inline-select, .inline-money { min-height: 44px; }
  .month-stepper button { min-width: 44px; min-height: 44px; }
  .table-link, .status-jump {
    min-height: 44px; display: inline-flex; align-items: center; padding: 6px 2px;
  }
  .date-preset { min-height: 40px; }

  /* Topbar sticky: l'hamburger resta raggiungibile scorrendo elenchi lunghi */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--paper);
    box-shadow: 0 6px 16px rgba(30, 82, 130, 0.08);
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  /* Drawer di navigazione: quando è chiuso esce dal tab order (niente focus fantasma) */
  .sidebar {
    height: 100dvh;
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
  }
  .app.nav-open .sidebar {
    visibility: visible;
    transition: transform 0.22s ease, visibility 0s linear 0s;
  }
}

/* ---- Telefoni: tabelle a card, dialog fullscreen, KPI a 2 colonne ---- */
@media (max-width: 620px) {
  /* KPI dashboard: 2 colonne invece di 1 (meno scroll, numeri confrontabili) */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Tabelle dense -> una card per riga (basta scroll orizzontale) */
  .table-wrap { overflow-x: visible; }
  .table-wrap table, .customer-table { min-width: 0; width: 100%; }
  .table-wrap thead {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .table-wrap tbody { display: block; }
  .table-wrap tbody tr {
    display: block; margin-bottom: 12px; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--white); box-shadow: var(--shadow);
  }
  .table-wrap tbody td {
    display: block; padding: 5px 0; border: none;
    text-align: left; min-width: 0; max-width: none; white-space: normal;
  }
  .table-wrap tbody td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--muted);
  }
  .table-wrap tbody td:first-child {
    font-size: 15px; padding-bottom: 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap tbody td.num { text-align: left; }
  .table-wrap tbody td.cell-actions { padding-top: 10px; }
  .table-wrap tbody td .inline-money,
  .table-wrap tbody td .inline-select,
  .table-wrap tbody td .money-edit { width: 100%; }

  /* Dialog grandi (scheda cliente, analisi) a tutto schermo su telefono */
  .dialog {
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100dvh;
    margin: 0; inset: 0; border-radius: 0;
    overflow-y: auto;
  }
}

/* ============================================================
   RIVISITAZIONE UI (giugno 2026) — solo aspetto, logica intatta
   ============================================================ */

/* --- Tipografia piu leggera: meno nero, numeri piu ariosi --- */
body { font-weight: 400; }
h1, h2 { font-weight: 700; }
h3 { font-weight: 600; }
.eyebrow { font-weight: 700; }
.brand strong { font-weight: 700; }
.duplicate-hint p { font-weight: 700; }
.kpi strong,
.calendar-board-stats strong,
.metric-row strong { font-weight: 600; }
table td strong,
.customer-table td strong,
.customer-table td.cell-price strong { font-weight: 600; }

/* --- Asterisco "obbligatorio" inline accanto alla label (non piu su una riga a se) --- */
.field-cap {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.req {
  color: var(--danger);
  font-weight: 700;
}

/* --- Campi valuta: simbolo € chiaro a sinistra dell'importo --- */
.money-input {
  position: relative;
  display: block;
}
.money-input::before {
  content: "€";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}
.money-input > input { padding-left: 28px; }

/* --- Filtro "Ordina per": largo quanto basta al testo, senza dilatarsi --- */
.customer-controls label:has(#customerSort) {
  flex: 0 1 230px;
}
#customerSort { text-overflow: ellipsis; }

/* --- Puntini azioni: gruppo centrato nel quadrato e nella cella --- */
td.cell-actions { text-align: center; }
.actions-menu { display: inline-flex; vertical-align: middle; }
.actions-menu summary::before {
  box-shadow: 0 -5px 0 var(--ink-soft), 0 5px 0 var(--ink-soft);
}

/* --- Calendario: scrollbar orizzontale sempre visibile e on-brand --- */
.calendar-matrix-wrap {
  overflow-x: scroll;
  scrollbar-width: thin;
  scrollbar-color: var(--blue) var(--blue-soft);
}
.calendar-matrix-wrap::-webkit-scrollbar { height: 14px; }
.calendar-matrix-wrap::-webkit-scrollbar-track {
  background: var(--blue-soft);
  border-radius: 8px;
}
.calendar-matrix-wrap::-webkit-scrollbar-thumb {
  background: var(--blue);
  border-radius: 8px;
  border: 3px solid var(--blue-soft);
}
.calendar-matrix-wrap::-webkit-scrollbar-thumb:hover { background: var(--blue-dark); }

/* --- Sidebar comprimibile su desktop (hamburger sempre disponibile) --- */
.nav-toggle { display: flex; }
@media (min-width: 981px) {
  .app { transition: grid-template-columns 0.22s ease; }
  .app.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .app.nav-collapsed > .sidebar {
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    border-right: none;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
  }
}

/* --- Campi mese con picker custom: niente icona/popup nativi --- */
#monthInput::-webkit-calendar-picker-indicator,
#dashboardMonth::-webkit-calendar-picker-indicator,
#startMonthFilter::-webkit-calendar-picker-indicator,
#stripeSyncMonth::-webkit-calendar-picker-indicator { display: none; }
#monthInput, #dashboardMonth, #startMonthFilter, #stripeSyncMonth { cursor: pointer; }

/* --- Month picker custom on-brand --- */
.month-picker {
  z-index: 3000;
  width: 268px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-strong);
  padding: 12px;
}
.month-picker .mp-head {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  margin-bottom: 10px;
}
.month-picker .mp-head strong {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.month-picker .mp-nav {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--blue-dark);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.month-picker .mp-nav:hover { background: var(--blue-soft); }
.month-picker .mp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.month-picker .mp-month {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.month-picker .mp-month:hover { background: var(--blue-soft); }
.month-picker .mp-month.is-selected {
  background: var(--blue);
  color: #ffffff;
}
.month-picker .mp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.month-picker .mp-link {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}
.month-picker .mp-link:hover { text-decoration: underline; }

/* --- Nome cliente cliccabile: apre il dashboard del cliente --- */
.cell-name-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.cell-name-link:hover { color: var(--blue); text-decoration: underline; }

/* --- Celle tabella clienti centrate verticalmente (puntini azioni non piu in alto) --- */
.customer-table td,
.customer-table th { vertical-align: middle; }

/* --- Sezione Pagamento/Stripe: badge accanto al titolo --- */
.payment-fieldset legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- Hamburger spostato sul lato sinistro (desktop) --- */
@media (min-width: 981px) {
  .nav-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 210;
    background: var(--white);
    box-shadow: var(--shadow);
  }
  .sidebar { padding-top: 74px; }
  .app.nav-collapsed .topbar-lead { padding-left: 56px; }
}

/* --- Slider/cursore per scorrere il calendario orizzontalmente --- */
.calendar-scroll-bar { padding: 6px 2px 12px; }
.calendar-scroll-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 0;
  height: 12px;
  border: none;
  padding: 0;
  border-radius: 999px;
  background: var(--blue-soft);
  cursor: pointer;
}
.calendar-scroll-range:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.calendar-scroll-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 20px;
  border-radius: 999px;
  background: var(--blue);
  border: 3px solid var(--blue-soft);
  box-shadow: var(--shadow);
  cursor: grab;
}
.calendar-scroll-range::-webkit-slider-thumb:active { cursor: grabbing; background: var(--blue-dark); }
.calendar-scroll-range::-moz-range-thumb {
  width: 72px;
  height: 20px;
  border: 3px solid var(--blue-soft);
  border-radius: 999px;
  background: var(--blue);
  cursor: grab;
}
.calendar-scroll-range::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: var(--blue-soft);
}
