:root {
  --ch-blue: #059ad8;
  --ch-blue-dark: #04769f;
  --ch-magenta: #b22486;
  --ch-magenta-dark: #8e1c6c;
  --ch-ink: #1c2530;
  --ch-muted: #6b7684;
  --ch-bg: #f4f6f9;
  --ch-surface: #ffffff;
  --ch-border: #e4e8ee;
  --ch-radius: 16px;
  --ch-shadow: 0 8px 24px rgba(28, 37, 48, 0.08);
  --ch-nav-height: 64px;
  --ch-header-height: 60px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--ch-bg);
  color: var(--ch-ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--ch-nav-height) + env(safe-area-inset-bottom, 0px));
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- App header ---------- */

.ch-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--ch-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--ch-surface);
  border-bottom: 1px solid var(--ch-border);
}

.ch-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.ch-header__brand img {
  height: 30px;
  width: auto;
  display: block;
}

.ch-header__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: var(--ch-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* L'attributo HTML [hidden] va reso esplicito: una regola d'autore come
   quella sopra (display: inline-flex) altrimenti vince sempre sullo stile
   di default dello user agent che gestisce [hidden], rendendolo inerte. */
.ch-header__action[hidden] {
  display: none;
}

.ch-header__action:active {
  background: var(--ch-blue-dark);
}

.ch-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ch-header__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--ch-blue-dark);
}

/* ---------- Main content ---------- */

.ch-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.ch-hero {
  background: linear-gradient(135deg, var(--ch-blue) 0%, var(--ch-magenta) 100%);
  border-radius: var(--ch-radius);
  padding: 28px 22px;
  color: #fff;
  box-shadow: var(--ch-shadow);
  margin-bottom: 24px;
}

.ch-hero h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ch-hero p {
  margin: 0;
  font-size: 14px;
  opacity: 0.92;
  line-height: 1.5;
}

.ch-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ch-muted);
  margin: 0 0 12px;
  padding: 0 2px;
}

.ch-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

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

.ch-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  background: var(--ch-blue);
  margin-bottom: 12px;
}

.ch-card:nth-child(2) .ch-card__icon {
  background: var(--ch-magenta);
}

.ch-card:nth-child(3) .ch-card__icon {
  background: var(--ch-blue-dark);
}

.ch-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.ch-card p {
  margin: 0;
  font-size: 13px;
  color: var(--ch-muted);
  line-height: 1.45;
}

.ch-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ch-blue-dark);
  background: rgba(5, 154, 216, 0.1);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- Forms ---------- */

.ch-form-card {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 24px 20px;
  box-shadow: var(--ch-shadow);
  max-width: 420px;
  margin: 0 auto;
}

.ch-form-card h1 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
}

.ch-form-card__subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--ch-muted);
}

.ch-field {
  margin-bottom: 16px;
}

.ch-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ch-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.ch-field input,
.ch-field select,
.ch-field textarea {
  width: 100%;
  font-size: 15px;
  padding: 11px 13px;
  border: 1px solid var(--ch-border);
  border-radius: 10px;
  background: var(--ch-bg);
  color: var(--ch-ink);
  font-family: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

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

.ch-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7684' d='M1 1l5 5 5-5' stroke='%236b7684' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

.ch-field input:focus,
.ch-field select:focus,
.ch-field textarea:focus {
  outline: none;
  border-color: var(--ch-blue);
  background-color: var(--ch-surface);
}

.ch-field.has-error input,
.ch-field.has-error select,
.ch-field.has-error textarea {
  border-color: #d64545;
}

.ch-field__error {
  color: #d64545;
  font-size: 12px;
  margin-top: 5px;
}

.ch-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ch-muted);
  margin-bottom: 18px;
}

.ch-checkbox input {
  width: auto;
}

.ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: var(--ch-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 13px;
  border-radius: 12px;
  cursor: pointer;
}

.ch-btn:active {
  background: var(--ch-blue-dark);
}

.ch-form-links {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ch-muted);
}

.ch-form-links a {
  color: var(--ch-blue-dark);
  font-weight: 600;
}

.ch-alert {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}

.ch-alert--success {
  background: rgba(38, 166, 91, 0.1);
  color: #1c8a4a;
}

.ch-alert--error {
  background: rgba(214, 69, 69, 0.1);
  color: #b5322f;
}

/* ---------- Bottom nav ---------- */

.ch-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(var(--ch-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: var(--ch-surface);
  border-top: 1px solid var(--ch-border);
  box-shadow: 0 -4px 16px rgba(28, 37, 48, 0.06);
}

.ch-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ch-muted);
}

.ch-nav__item i {
  font-size: 18px;
}

.ch-nav__item.is-active {
  color: var(--ch-blue);
}

/* ---------- Doc header (tracking / preventivo) ---------- */

.ch-doc-header {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 18px 20px;
  box-shadow: var(--ch-shadow);
  margin-bottom: 20px;
}

.ch-doc-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.ch-doc-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.ch-doc-header__meta {
  font-size: 13px;
  color: var(--ch-muted);
  margin: 4px 0 0;
}

.ch-status-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 11px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}

.ch-status-pill--secondary { background: #8a94a3; }
.ch-status-pill--warning   { background: #d9932c; }
.ch-status-pill--primary   { background: var(--ch-blue); }
.ch-status-pill--info      { background: #2f9bb0; }
.ch-status-pill--success   { background: #1c8a4a; }
.ch-status-pill--danger    { background: #c0392f; }
.ch-status-pill--dark      { background: #2c3542; }

/* ---------- Status tracker (vertical steps) ---------- */

.ch-tracker {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.ch-tracker__step {
  position: relative;
  display: flex;
  gap: 14px;
  padding-bottom: 22px;
}

.ch-tracker__step:last-child {
  padding-bottom: 0;
}

.ch-tracker__step::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--ch-border);
}

.ch-tracker__step:last-child::before {
  display: none;
}

.ch-tracker__dot {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--ch-surface);
  border: 2px solid var(--ch-border);
  color: var(--ch-muted);
  z-index: 1;
}

.ch-tracker__label {
  padding-top: 3px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ch-muted);
}

.ch-tracker__step.is-done .ch-tracker__dot {
  background: var(--ch-blue);
  border-color: var(--ch-blue);
  color: #fff;
}

.ch-tracker__step.is-done::before {
  background: var(--ch-blue);
}

.ch-tracker__step.is-done .ch-tracker__label {
  color: var(--ch-ink);
}

.ch-tracker__step.is-current .ch-tracker__dot {
  background: var(--ch-magenta);
  border-color: var(--ch-magenta);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(178, 36, 134, 0.15);
}

.ch-tracker__step.is-current .ch-tracker__label {
  color: var(--ch-ink);
  font-weight: 700;
}

/* ---------- Preventivo righe ---------- */

.ch-riga {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.ch-riga.is-esclusa {
  opacity: 0.55;
}

.ch-riga__toggle {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.ch-riga__body {
  flex: 1;
  min-width: 0;
}

.ch-riga__desc {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
}

.ch-riga__meta {
  font-size: 12px;
  color: var(--ch-muted);
}

.ch-riga__prezzo {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.ch-summary {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 18px 20px;
  box-shadow: var(--ch-shadow);
  margin: 20px 0;
}

.ch-summary__row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 5px 0;
}

.ch-summary__row--total {
  font-size: 18px;
  font-weight: 700;
  border-top: 1px solid var(--ch-border);
  margin-top: 8px;
  padding-top: 12px;
}

.ch-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.ch-btn--outline {
  background: transparent;
  color: var(--ch-ink);
  border: 1px solid var(--ch-border);
}

.ch-btn--outline:active {
  background: var(--ch-bg);
}

.ch-btn--sm {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

.ch-btn--block {
  width: 100%;
}

.ch-page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

/* ---------- Tab pills (filtri Preventivi/Prenotazioni) ---------- */

.ch-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 18px;
}

.ch-tabs::-webkit-scrollbar {
  display: none;
}

.ch-tab {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ch-muted);
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.ch-tab.is-active {
  background: var(--ch-ink);
  border-color: var(--ch-ink);
  color: #fff;
}

/* ---------- Home: stato attuale + progress ---------- */

.ch-status-card {
  background: linear-gradient(135deg, var(--ch-blue) 0%, var(--ch-blue-dark) 100%);
  border-radius: var(--ch-radius);
  padding: 18px 20px;
  color: #fff;
  box-shadow: var(--ch-shadow);
  margin-bottom: 18px;
}

.ch-status-card__eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
  margin: 0 0 4px;
}

.ch-status-card__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 4px;
}

.ch-status-card__desc {
  font-size: 13px;
  opacity: 0.9;
  margin: 0 0 16px;
}

.ch-progress {
  display: flex;
  align-items: center;
}

.ch-progress__step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.ch-progress__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  z-index: 1;
}

.ch-progress__step::before {
  content: '';
  position: absolute;
  top: 4px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.ch-progress__step:first-child::before {
  display: none;
}

.ch-progress__label {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  opacity: 0.75;
}

.ch-progress__step.is-done .ch-progress__dot,
.ch-progress__step.is-done::before {
  background: #fff;
}

.ch-progress__step.is-done .ch-progress__label {
  opacity: 1;
}

.ch-progress__step.is-current .ch-progress__dot {
  background: #fff;
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25);
}

.ch-progress__step.is-current .ch-progress__label {
  opacity: 1;
}

/* ---------- Appuntamento box ---------- */

.ch-appointment {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.ch-appointment__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(178, 36, 134, 0.1);
  color: var(--ch-magenta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.ch-appointment__body {
  flex: 1;
  min-width: 0;
}

.ch-appointment__title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.ch-appointment__meta {
  font-size: 12px;
  color: var(--ch-muted);
  margin: 2px 0 0;
}

/* ---------- Azioni rapide (grid icone) ---------- */

.ch-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.ch-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ch-ink);
  text-align: center;
}

.ch-quick-action__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--ch-blue);
}

/* ---------- Tip card ---------- */

.ch-tip-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, var(--ch-magenta) 0%, var(--ch-blue) 100%);
  border-radius: var(--ch-radius);
  padding: 14px 16px;
  color: #fff;
  margin-bottom: 8px;
}

.ch-tip-card__text {
  font-size: 12px;
  line-height: 1.4;
}

.ch-tip-card__text strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.8;
  margin-bottom: 2px;
}

/* ---------- Avatar / Profilo ---------- */

.ch-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.ch-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ch-blue) 0%, var(--ch-magenta) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.ch-profile-header__name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.ch-profile-header__email {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ch-muted);
}

.ch-menu-list {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.ch-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--ch-border);
}

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

.ch-menu-item i:first-child {
  color: var(--ch-blue);
  width: 18px;
  text-align: center;
}

.ch-menu-item__chevron {
  margin-left: auto;
  color: var(--ch-muted);
  font-size: 12px;
}

/* ---------- Bici card ---------- */

.ch-bici-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.ch-bici-card__icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(5, 154, 216, 0.1);
  color: var(--ch-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ch-bici-card__body {
  flex: 1;
  min-width: 0;
}

.ch-bici-card__title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.ch-bici-card__meta {
  font-size: 12px;
  color: var(--ch-muted);
  margin: 2px 0 0;
}

.ch-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--ch-muted);
  font-size: 13px;
}

.ch-empty i {
  font-size: 26px;
  margin-bottom: 10px;
  display: block;
  color: var(--ch-border);
}

/* ---------- Modal proattivi (installa / attiva notifiche) ---------- */

.ch-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(20, 26, 34, 0.55);
  padding: 20px;
}

/* Come per .ch-header__action[hidden]: una regola d'autore con un display
   proprio (qui display:flex) vince sempre sullo stile di default dello
   user agent per [hidden], quindi va reso esplicito — qui ancora più
   importante, altrimenti l'overlay resterebbe visibile sempre. */
.ch-modal-overlay[hidden] {
  display: none;
}

@keyframes ch-modal-slide-down {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ch-modal-card {
  background: var(--ch-surface);
  border-radius: var(--ch-radius);
  box-shadow: 0 20px 50px rgba(20, 26, 34, 0.3);
  padding: 22px 20px;
  max-width: 440px;
  width: 100%;
  margin-top: 60px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: ch-modal-slide-down 0.35s ease-out;
}

.ch-modal-card__icon {
  flex-shrink: 0;
  width: 48px;
}

.ch-modal-card__icon img {
  display: block;
  width: 100%;
  height: auto;
}

.ch-modal-card__body {
  flex: 1;
  min-width: 0;
}

.ch-modal-card__text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ch-ink);
}

.ch-modal-card__actions {
  display: flex;
  gap: 10px;
}

.ch-modal-card__actions .ch-btn {
  width: auto;
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
}
