/* Service DI — variante iOS time tracker. La logica resta nel file originale. */
html, body { background: #f2f2f7; }

.app-shell,
.app-shell.theme-light {
  --ios-bg: #f2f2f7;
  --ios-group: #fff;
  --ios-label: #111114;
  --ios-secondary: #7c7c82;
  --ios-separator: rgba(60,60,67,.18);
  --ios-accent: #e97824;
  --ios-accent-soft: #fff0e4;
  --text: var(--ios-label);
  --text-muted: var(--ios-secondary);
  --amber: var(--ios-accent);
  --amber-dim: #f6c59f;
  --teal: #c45f17;
  --teal-dim: #f6c59f;
  --violet: #7755cc;
  --violet-dim: #ddd3f4;
  --red: #e34858;
  --glass-border: var(--ios-separator);
  width: 100%;
  max-width: 430px;
  background: var(--ios-bg);
  color: var(--ios-label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, sans-serif;
}

.aurora-bg { display: none !important; }
.topbar,
.theme-light .topbar {
  margin: 0;
  padding: max(24px, calc(env(safe-area-inset-top, 0px) + 12px)) 18px 12px;
  border: 0;
  border-radius: 0;
  background: rgba(242,242,247,.88);
  color: var(--ios-label);
  box-shadow: none;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.topbar-title { color: var(--ios-label); font-size: 29px; font-weight: 750; letter-spacing: -.055em; }
.topbar-title > span:first-child { display: none !important; }
.topbar-sub { margin: 5px 0 0; }
.sync-status { padding: 0; color: var(--ios-secondary); border: 0; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.sync-status::before { width: 7px; height: 7px; background: var(--ios-accent); box-shadow: none; }
.sync-error-note { margin-left: 0; }

.content { padding: 8px 12px 104px; background: var(--ios-bg); }
.tab-pane { display: flex; gap: 22px; }
.card,
.theme-light .card {
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@media (hover: hover) { .card:hover { transform: none; box-shadow: none; } }
.card-head { position: relative; min-height: 38px; margin: 0; padding: 0 5px 7px; }
.card-head h2 { color: var(--ios-label); font-size: 18px; font-weight: 700; letter-spacing: -.025em; }
.card-head h2 > span { display: none !important; }
.card-head .icon-btn { background: transparent; color: var(--ios-accent); }
.day-form-actions { display: flex; flex-shrink: 0; align-items: center; gap: 7px; margin-left: auto; }
.day-save-check {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 50%;
  background: var(--ios-accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(233,120,36,.3), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .15s ease, filter .15s ease;
}
.day-save-check:active { transform: scale(.92); filter: brightness(.96); }
.day-save-check:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.day-save-check > span { transform: translateY(-1px); }
.day-cancel-btn { position: static; width: 38px; height: 38px; background: #e8e8ed !important; color: var(--ios-label) !important; }
.history-menu-btn { width: 38px; height: 38px; background: #e8e8ed !important; color: var(--ios-label) !important; font-weight: 800; letter-spacing: 1px; }
.history-menu-btn > span { transform: translateY(3px); }
.app-shell:not(.theme-light) .day-cancel-btn { background: #2c2c2e !important; }
.app-shell:not(.theme-light) .history-menu-btn { background: #2c2c2e !important; }

/* Lo storico ora si apre dai tre puntini nell'intestazione. */
.history-actions > .icon-btn:first-child { display: none; }
.inline-history > .card-head:has(> .icon-btn:only-child) { display: none; }
.inline-history > .card-head:has(.history-actions > .icon-btn:only-child) { display: none; }

/* Campi come righe native: etichetta a sinistra e valore evidente a destra. */
.field-row { display: contents; }
.field,
.theme-light .field {
  display: grid;
  grid-template-columns: minmax(90px, .8fr) minmax(0, 1.4fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin: 0;
  padding: 7px 13px;
  border: 0;
  border-bottom: 1px solid var(--ios-separator);
  border-radius: 0;
  background: var(--ios-group);
  box-shadow: none;
}
.card-head + .field { border-radius: 14px 14px 0 0; }
.field:focus-within { border-color: var(--ios-separator); background: #fff; box-shadow: none; }
.field > span,
.theme-light .field > span {
  min-height: 0;
  color: var(--ios-label);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
}
.field > span em { color: var(--ios-secondary); font-size: 11px; }
.field input,
.field select,
.theme-light .field input,
.theme-light .field select,
.value-picker {
  min-height: 36px;
  width: 100%;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--ios-label) !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: calc(18px + var(--value-text-adjust));
  font-weight: 600;
  letter-spacing: -.025em;
  text-align: right;
  outline: 0 !important;
  box-shadow: none;
}
.field select { direction: rtl; }
.field textarea,
.theme-light .field textarea {
  grid-column: 1 / -1;
  min-height: 86px;
  padding: 5px 0;
  border: 0 !important;
  background: transparent !important;
  color: var(--ios-label);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  text-align: left;
}
.native-picker,
.theme-light .native-picker,
.app-shell:not(.theme-light) .native-picker {
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.native-picker-value,
.theme-light .native-picker-value,
.app-shell:not(.theme-light) .native-picker-value {
  color: var(--ios-label);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: calc(18px + var(--value-text-adjust));
  font-weight: 600;
  letter-spacing: -.025em;
  text-align: right;
  text-shadow: none;
}
.native-picker-caret { color: var(--ios-secondary) !important; }

.btn-primary {
  min-height: 50px;
  margin-top: 11px;
  border-radius: 14px;
  background: var(--ios-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  box-shadow: none;
}
.btn-primary > span { color: #fff; }
.btn-secondary {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--ios-group);
  color: var(--ios-accent);
  font-size: 15px;
  box-shadow: none;
  backdrop-filter: none;
}
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(25,169,140,.1); color: var(--ios-accent); }

/* Pannelli numerici simili alla schermata timer. */
.readout-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 11px 0; }
.readout,
.theme-light .readout,
.statistics-card .readout {
  min-height: 104px;
  padding: 14px 10px;
  border: 0;
  border-radius: 16px;
  background: var(--ios-group);
  box-shadow: none;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.readout:nth-child(even), .readout.tone-violet, .readout.tone-red, .readout.tone-neutral { background: var(--ios-group); }
.readout-value,
.readout.size-lg .readout-value,
.statistics-card .readout-value {
  order: 1;
  color: var(--ios-label) !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", sans-serif;
  font-size: calc(30px + var(--value-text-adjust));
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.055em;
  text-shadow: none !important;
}
.readout-unit,
.statistics-card .readout-unit {
  order: 2;
  margin: 8px 0 0;
  color: var(--ios-secondary);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.readout.tone-teal .readout-value { color: var(--ios-accent) !important; }

/* Statistiche: sfondo uniforme, cambia soltanto il colore del testo. */
.statistics-card .readout.payment-company .readout-value { color: var(--ios-label) !important; }
.statistics-card .readout.payment-company .readout-unit { color: var(--ios-secondary) !important; }
.statistics-card .readout.payment-personal .readout-value { color: var(--ios-accent) !important; }
.statistics-card .readout.payment-personal .readout-unit { color: var(--ios-accent) !important; }

.tagpicker { margin: 11px 0; padding: 13px; border-radius: 14px; background: var(--ios-group); }
.tagpicker-head span { color: var(--ios-secondary); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.tag-row { gap: 7px; }
.tag-chip,
.theme-light .tag-chip { min-height: 34px; padding: 6px 11px; border: 0; border-radius: 17px; background: #ececf1; color: var(--ios-label); font-size: 12px; backdrop-filter: none; }
.tag-chip.selected { background: var(--ios-accent); color: #fff; }
.filter-bar { gap: 2px; margin: 8px 0 11px; padding: 2px; border-radius: 9px; background: #e3e3e8; }
.filter-btn { min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--ios-secondary); font-size: 12px; backdrop-filter: none; }
.filter-btn.active { background: #fff; color: var(--ios-label); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.inline-history { margin-top: 15px; padding-top: 12px; border-top: 0; }
.history-actions { min-height: 48px; padding: 4px; border: 0; border-radius: 14px; background: var(--ios-group); box-shadow: none; }
.inline-history > .card-head .icon-btn,
.inline-history > .card-head .icon-btn.resume-today-btn { width: 44px; height: 40px; border: 0; border-radius: 11px; background: var(--ios-accent-soft); color: var(--ios-accent); box-shadow: none; }
.log-group { gap: 0; overflow: hidden; border-radius: 14px; background: var(--ios-group); }
.group-title { padding: 12px 13px 6px; margin: 0; background: var(--ios-bg); color: var(--ios-secondary); font-size: 11px; }
.row-card,
.theme-light .row-card,
.swipe-content .row-card { padding: 11px 13px; border: 0; border-bottom: 1px solid var(--ios-separator); border-radius: 0; background: var(--ios-group); backdrop-filter: none; }
.swipe-row { border-radius: 0; }
.row-date { color: var(--ios-label); font-size: 15px; font-weight: 600; }
.row-times, .row-note,
.app-shell:not(.theme-light) .row-times,
.app-shell:not(.theme-light) .row-note { color: var(--ios-secondary); font-style: normal; }
.chip, .theme-light .chip { padding: 4px 7px; border: 0; border-radius: 7px; background: #ededf2; color: var(--ios-secondary); }
.chip.amber, .chip.teal { background: var(--ios-accent-soft); color: var(--ios-accent); }

.tabbar,
.theme-light .tabbar {
  bottom: calc(9px + env(safe-area-inset-bottom));
  width: calc(100% - 20px);
  max-width: 410px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 22px;
  background: rgba(249,249,251,.88);
  box-shadow: 0 12px 34px rgba(35,39,47,.16), inset 0 1px 0 rgba(255,255,255,.9);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.tab-btn { min-height: 58px; padding: 5px 1px 4px; border-radius: 17px; color: #8e8e93; font-size: 10px; font-weight: 550; gap: 4px; }
.tab-btn > span:first-child { font-size: 25px !important; filter: grayscale(1); transition: transform .18s ease, filter .18s ease; }
.tab-btn.active { background: var(--ios-accent-soft); color: var(--ios-accent); box-shadow: inset 0 0 0 1px rgba(233,120,36,.08); }
.tab-btn.active > span:first-child { filter: none; }
.tab-btn:active > span:first-child { transform: scale(.9); }
.toast { bottom: 80px; border: 0; border-radius: 12px; background: rgba(28,28,30,.92); color: #fff; }
.modal-backdrop { background: rgba(0,0,0,.28); }
.modal-card { border: 0; border-radius: 20px; background: #fff; color: var(--ios-label); box-shadow: 0 18px 60px rgba(0,0,0,.2); }
.modal-card p, .modal-head h3 { color: var(--ios-label); }

/* Aspetto iOS scuro quando l'impostazione Tema è scura. */
.app-shell:not(.theme-light) {
  --ios-bg: #000;
  --ios-group: #1c1c1e;
  --ios-label: #f5f5f7;
  --ios-secondary: #98989f;
  --ios-separator: rgba(84,84,88,.52);
  --ios-accent: #ff9a4d;
  --ios-accent-soft: rgba(255,154,77,.16);
  background: var(--ios-bg);
}
.app-shell:not(.theme-light) .topbar { background: rgba(0,0,0,.86); }
.app-shell:not(.theme-light) .content { background: #000; }
.app-shell:not(.theme-light) .field,
.app-shell:not(.theme-light) .readout,
.app-shell:not(.theme-light) .tagpicker,
.app-shell:not(.theme-light) .history-actions,
.app-shell:not(.theme-light) .row-card,
.app-shell:not(.theme-light) .log-group,
.app-shell:not(.theme-light) .btn-secondary { background: var(--ios-group); }
.app-shell:not(.theme-light) .field input,
.app-shell:not(.theme-light) .field select,
.app-shell:not(.theme-light) .field textarea { color: var(--ios-label) !important; }
.app-shell:not(.theme-light) .tag-chip,
.app-shell:not(.theme-light) .chip { background: #2c2c2e; color: #d1d1d6; }
.app-shell:not(.theme-light) .filter-bar { background: #2c2c2e; }
.app-shell:not(.theme-light) .filter-btn.active { background: #48484a; color: #fff; box-shadow: none; }
.app-shell:not(.theme-light) .tabbar { background: rgba(28,28,30,.88); border-color: rgba(255,255,255,.1); box-shadow: 0 12px 34px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.08); }
.app-shell:not(.theme-light) .modal-card { background: #1c1c1e; }
.app-shell:not(.theme-light) .modal-card p,
.app-shell:not(.theme-light) .modal-head h3 { color: #f5f5f7; }

@media (max-width: 360px) {
  .content { padding-left: 8px; padding-right: 8px; }
  .topbar-title { font-size: 26px; }
  .field { grid-template-columns: minmax(82px,.8fr) minmax(0,1.4fr); padding-left: 11px; padding-right: 11px; }
  .field > span, .theme-light .field > span { font-size: 13px; }
  .field input, .field select, .native-picker-value { font-size: calc(16px + var(--value-text-adjust)); }
  .readout-value, .readout.size-lg .readout-value, .statistics-card .readout-value { font-size: calc(26px + var(--value-text-adjust)); }
  .day-save-check { width: 42px; height: 42px; flex-basis: 42px; }
}

@media (min-width: 760px) {
  .app-shell, .app-shell.theme-light { max-width: 430px; }
  .content { padding: 8px 12px 104px; }
  .tab-pane { display: flex; gap: 22px; }
  .tabbar, .theme-light .tabbar { max-width: 410px; }
}
