/* SYSTEM SAFE AREA */
html {
  background-color: var(--bg-primary);
  min-height: 100%;
}

body {
  min-height: 100dvh;
  align-items: flex-start;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-container,
.main-layout {
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.modal-overlay {
  height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.modal-card {
  max-height: calc(90dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
/* VER TIFORCE MOBILE - MODERN DESIGN SYSTEM */
:root {
  --bg-primary: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-input: #334155;
  --accent-blue: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: #0b1329;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

/* SCREENS */
.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: block !important;
  animation: fadeIn 0.3s ease;
}

.screen-tab {
  display: none;
  width: 100%;
}

.screen-tab.active {
  display: block !important;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.filter-pills-bar {
  display: flex;
  background: rgba(30, 41, 59, 0.7);
  border-radius: var(--radius-md);
  padding: 4px;
  margin: 1rem 1.2rem 0.5rem 1.2rem;
  gap: 4px;
  border: 1px solid var(--border-color);
}

.filter-pill {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-pill.active {
  background: var(--accent-blue);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.pill-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: var(--transition-fast);
}

.pill-btn.active {
  background: var(--accent-emerald);
  color: #0f172a;
  border-color: var(--accent-emerald);
  font-weight: 700;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  gap: 1rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* SCREEN 1: LOGIN */
.login-wrapper {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.brand-header {
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.logo-icon {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-emerald));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.brand-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-header h1 span {
  color: var(--accent-blue);
  font-weight: 300;
}

.brand-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.8rem 1.5rem;
  box-shadow: var(--shadow-main);
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  font-size: 1.1rem;
}

.input-icon-wrapper input {
  padding-left: 2.8rem !important;
}

.form-control, input[type="text"], input[type="password"], input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.demo-hints {
  background-color: rgba(56, 189, 248, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--accent-blue);
  margin-bottom: 1.2rem;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background-color: #475569;
  color: #fff;
}

.alert-danger {
  background-color: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--accent-rose);
  color: var(--accent-rose);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 1rem;
  text-align: center;
}

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 1.5rem;
}

/* MAIN LAYOUT */
.main-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* HEADER */
.app-header {
  padding: 1rem 1.2rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-emerald));
  color: #0f172a;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.sync-status {
  margin: 0.45rem 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.6rem;
  background: #17365d;
  color: #f8fafc;
  font-size: 0.82rem;
  line-height: 1.35;
}

.sync-status.error { background: #7f1d1d; }
.sync-status[hidden] { display: none; }

.icon-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.icon-btn.danger:hover {
  background: rgba(244, 63, 94, 0.2);
}

/* NAV TABS */
.nav-tabs {
  display: flex;
  background-color: #1e293b;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 67px;
  z-index: 90;
}

.nav-tab {
  flex: 1;
  padding: 0.8rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
}

.tab-icon { font-size: 1.2rem; }
.tab-label { font-size: 0.75rem; font-weight: 500; }

.badge {
  background: var(--accent-rose);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 700;
}

/* CONTENT AREA */
.content-area {
  padding: 1.2rem;
  flex: 1;
}

/* DATE SELECTOR BAR */
.date-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.2rem;
}

.btn-sm {
  background: var(--bg-input);
  border: none;
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.date-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-blue);
}

/* APPOINTMENTS CARDS */
.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.appt-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1.2rem;
  position: relative;
  transition: var(--transition-fast);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.appt-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
}

.appt-card.completed {
  border-left: 4px solid var(--accent-emerald);
}

.appt-card.pending {
  border-left: 4px solid var(--accent-amber);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.commessa-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

.status-pill.pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.status-pill.completed { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

.client-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.maps-link {
  color: var(--accent-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.maps-link:hover { text-decoration: underline; }

.card-actions {
  display: flex;
  gap: 0.6rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* SETTINGS CARD */
.settings-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.sub-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem;
  background: #1e293b;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.status-indicator.online { background-color: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: #1e293b;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
  border-top: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
}

.info-banner {
  background: rgba(15, 23, 42, 0.6);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-blue);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.info-item { margin-bottom: 0.3rem; }
.info-item .label { font-weight: 600; color: var(--text-muted); margin-right: 0.4rem; }
.info-item .value { color: var(--text-main); }

.pdf-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  margin: 0 0 1rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(14, 165, 233, 0.1);
  color: #bae6fd;
  font-size: 0.8rem;
}

.pdf-panel span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1rem 0;
}

.form-row {
  display: flex;
  gap: 0.8rem;
}
.col-6 { flex: 1; }

.timesheet-day-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.timesheet-day-summary > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.45);
}

.timesheet-day-summary span {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timesheet-day-summary strong {
  color: var(--text-main);
  font-size: 0.95rem;
}

.timesheet-periods {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.timesheet-period {
  padding: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.36);
}

.timesheet-period h3 {
  margin: 0 0 0.65rem;
  color: #bae6fd;
  font-size: 0.95rem;
}

.timesheet-period .form-group,
.timesheet-totals .form-group {
  margin-bottom: 0.55rem;
}

.timesheet-period .form-group:last-child,
.timesheet-totals .form-group:last-child {
  margin-bottom: 0;
}

.timesheet-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0.8rem 0 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(14, 165, 233, 0.08);
}

.timesheet-totals .form-control {
  border-color: rgba(56, 189, 248, 0.45);
}

.signature-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-rose);
  font-size: 0.8rem;
  cursor: pointer;
}

.signature-container {
  position: relative;
  background: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

canvas#signatureCanvas {
  width: 100%;
  height: 120px;
  display: block;
  touch-action: none;
}

.canvas-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #cbd5e1;
  font-size: 0.85rem;
  pointer-events: none;
}

.modal-footer {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}
.modal-footer button { flex: 1; }

.save-progress-status {
  min-height: 1.3rem;
  margin-top: 0.55rem;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.save-progress-status.saving { color: #fbbf24; }
.save-progress-status.saved { color: #4ade80; }
.save-progress-status.error { color: #fb7185; }

@media (max-width: 380px) {
  .modal-header-actions .btn-sm { padding: 0.45rem 0.55rem; font-size: 0.72rem; }
  .modal-footer { gap: 0.4rem; }
  .modal-footer button { padding-left: 0.45rem; padding-right: 0.45rem; font-size: 0.75rem; }
}

/* STILI MULTI-DAY ASSEGNATI */
.assigned-days-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px 0;
}
.day-chip {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.day-chip.active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

/* STILI DOCUMENTO BLOCCATO */
.alert-locked {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.status-pill.locked {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.btn-secondary-locked {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

/* Landscape signature workspace occupies the Android full screen. */
body.signing-fullscreen { overflow: hidden; }
#signatureScreen[hidden] { display: none !important; }
#signatureScreen {
  position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column;
  align-items: center; gap: 8px; overflow: hidden; background: #0f172a; color: #fff;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  box-sizing: border-box;
}
#signatureScreen h2 { margin: 0; font-size: 1.15rem; text-align: center; flex-shrink: 0; }
#signatureScreen > p { margin: 0; font-size: .8rem; text-align: center; flex-shrink: 0; }
#signatureScreen #previousSignaturePreview { height: 32px !important; max-width: 240px !important; flex-shrink: 0; margin: 0 auto; }
#signatureScreen .signature-workspace { background: #fff; width: 100%; height: auto; min-height: 0; flex: 1 1 0; position: relative; margin: 0; overflow: hidden; }
#signatureScreen canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#signatureScreen .canvas-placeholder { color: #555; pointer-events: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: max-content; max-width: 90%; }
.signature-actions { display: flex; flex-wrap: nowrap; gap: 10px; width: 100%; flex-shrink: 0; }
.signature-actions button { flex: 1 1 0; min-height: 44px; padding: 8px; }
#signaturePreview { margin-left: auto; margin-right: auto; }
/* Home and calendar for the signed-in technician. */
#homeScreen[hidden], #mainTabs[hidden] { display: none !important; }
.mobile-home { display: flex; flex-direction: column; gap: 18px; padding: 28px 18px; }
.mobile-home button { min-height: 72px; font-size: 1.1rem; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.calendar-header h2 { font-size: 1.15rem; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 14px 0; }
.calendar-grid > strong { text-align: center; font-size: .8rem; }
.calendar-day { min-height: 45px; border: 1px solid #395475; border-radius: 6px; background: #1e293b; color: white; }
.calendar-day.selected { background: #3b82f6; }
.calendar-day-count { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; margin-left: 4px; padding: 0 4px; border-radius: 10px; background: #dc2626; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1; }
.calendar-day-items { display: flex; flex-direction: column; gap: 9px; }
.calendar-item { text-align: left; min-height: 48px; }
.remember-login { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.header-home-btn { min-height: 44px; padding: 0 10px; border: 1px solid #60a5fa; border-radius: 8px; background: #1e3a5f; color: #fff; font-weight: 700; white-space: nowrap; }
.header-home-btn[hidden] { display: none !important; }

/* Checklist manutenzione */
.check-header{display:flex;align-items:center;justify-content:space-between;gap:12px}
#checklistsScreen{padding:16px;overflow-y:auto}
.check-card,.check-group{background:var(--bg-card,#1e293b);border:1px solid var(--border-color,#475569);border-radius:12px;margin:12px 0;padding:14px;color:var(--text-main,#f8fafc)}
.check-group summary{font-weight:700;padding:8px;cursor:pointer}
.check-field{border-top:1px solid var(--border-color,#475569);padding:12px 0;display:grid;gap:8px}
.check-field label{font-weight:600;line-height:1.5}
#checkEditor select,#checkEditor input,#checkEditor textarea{font:inherit;min-height:46px;padding:10px;border-radius:8px;border:1px solid #64748b;background:var(--bg-input,#334155);color:var(--text-main,#f8fafc);width:100%;box-sizing:border-box;color-scheme:dark}
#checkEditor textarea{min-height:62px}
.check-sign img{display:block;max-width:100%;width:280px;height:70px;object-fit:contain;background:#fff}
.check-sign{margin:16px 0}
.check-actions{display:grid;gap:12px;margin:20px 0}
.check-busy{pointer-events:none;opacity:.7}
.check-sign-overlay{position:fixed;inset:0;z-index:20000;background:white;display:flex;flex-direction:column;color:#0f172a}
.check-sign-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px;flex-shrink:0;background:#e2e8f0}
.check-sign-bar button{padding:8px;min-height:40px}
.check-sign-overlay canvas{width:100%;flex:1;min-height:0;display:block;touch-action:none}

/* Checklist: same dark palette as the Android app; readable notes and command receipts. */
#checklistsScreen{background:var(--bg-primary,#0f172a);color:var(--text-main,#f8fafc)}
#checkEditor .check-general-notes{margin:22px 0;padding:16px;background:var(--bg-card,#1e293b);border:1px solid var(--border-color);border-radius:12px}
.check-general-notes label{display:block;font-size:1.1rem;font-weight:700;margin-bottom:12px}
#checkEditor #checkGeneralNotes{min-height:190px;font-size:17px;line-height:1.5;resize:vertical}
#checkEditor textarea::placeholder{color:#cbd5e1;opacity:1}
#checkEditor select:focus,#checkEditor input:focus,#checkEditor textarea:focus{outline:2px solid #38bdf8;outline-offset:2px}
#checkStatus,.check-action-status,.check-completed{padding:14px;margin:14px 0;border:1px solid #475569;border-radius:10px;background:#1e293b;color:#e2e8f0;font-size:16px;line-height:1.5;overflow-wrap:anywhere}
#checkStatus:empty,.check-action-status:empty{display:none}
#checkStatus[data-kind="success"],.check-action-status[data-kind="success"]{background:#123d35;border-color:#34d399;color:#d1fae5}
#checkStatus[data-kind="error"],.check-action-status[data-kind="error"]{background:#4c202c;border-color:#fb7185;color:#ffe4e6}
#checkStatus[data-kind="working"],.check-action-status[data-kind="working"]{background:#173c5c;border-color:#38bdf8;color:#e0f2fe}
.check-actions .btn{min-height:54px;font-size:16px;white-space:normal}

/* Missing checklist controls: contrast, labels and group counts, updated while typing. */
.check-progress{position:sticky;top:0;z-index:5;margin:16px 0;padding:14px;background:#422b16;border:2px solid #fbbf24;border-radius:12px;box-shadow:0 5px 14px #0005;color:#fff7ed}
.check-progress strong{display:block;font-size:18px}
.check-progress p{margin:8px 0;line-height:1.45}
.check-progress .btn{min-height:44px}
.check-progress.check-progress-complete{background:#123d35;border-color:#34d399;color:#d1fae5}
.check-group summary{display:flex;justify-content:space-between;align-items:center;gap:12px;line-height:1.4}
.check-group-count{flex-shrink:0;font-size:13px;font-weight:700;background:#78350f;color:#fef3c7;border-radius:8px;padding:5px 8px}
.check-group-count[data-complete="true"]{background:#14532d;color:#dcfce7}
.check-group.check-group-missing{border:2px solid #fbbf24}
.check-field.check-missing,.check-sign.check-missing{background:#4c202c;border:2px solid #fb7185;border-left-width:6px;border-radius:10px;padding:14px;margin:12px 0}
.check-missing-badge{display:inline-block;justify-self:start;width:fit-content;font-size:12px;font-weight:800;letter-spacing:.04em;background:#be123c;color:white;border-radius:6px;padding:5px 8px}
.check-missing-badge[hidden],.check-progress button[hidden]{display:none!important}
#checkEditor .check-missing input,#checkEditor .check-missing select{border:2px solid #fb7185}
.check-sign{padding:14px;border-radius:10px;border:1px solid #475569;display:grid;gap:10px}
.check-optional{color:#cbd5e1;font-size:14px;margin-bottom:10px}
.check-field,.check-sign{scroll-margin-top:180px}

/* Timesheets share the checklist palette, note size and receipt panels. */
#timesheetModal .modal-card{background:var(--bg-primary);color:var(--text-main);border:1px solid #475569}
#timesheetModal .timesheet-period,#timesheetModal .timesheet-totals,#timesheetModal #signatureGroup{background:var(--bg-card);border:1px solid #475569;border-radius:12px;padding:14px}
#timesheetModal .timesheet-period h3{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:18px;margin-bottom:14px}
#timesheetModal .form-control{background:var(--bg-input);color:var(--text-main);border:1px solid #64748b;min-height:48px;font-size:17px;color-scheme:dark}
#timesheetModal .form-control::placeholder{color:#cbd5e1}
#timesheetModal #sheetDescription{min-height:190px;line-height:1.5;resize:vertical}
#timesheetModal .hours-incomplete{background:#4c202c!important;border:2px solid #fb7185!important;border-left-width:6px!important}
#timesheetModal .form-control.hours-missing{border:2px solid #fb7185}
#hoursCompleteness{position:static}
#signatureGroup .check-missing-badge{margin:12px 0}
#timesheetModal .save-progress-status{padding:14px;margin:16px 0;border:1px solid #475569;border-radius:10px;line-height:1.5;font-size:16px;background:#1e293b;color:#e2e8f0;text-align:left}
#timesheetModal .save-progress-status:empty{display:none}
#timesheetModal .save-progress-status.saved{background:#123d35;border-color:#34d399;color:#d1fae5}
#timesheetModal .save-progress-status.error{background:#4c202c;border-color:#fb7185;color:#ffe4e6}
#timesheetModal .save-progress-status.saving{background:#173c5c;border-color:#38bdf8;color:#e0f2fe}
#timesheetModal .modal-footer{display:flex;flex-wrap:wrap;gap:12px}
#timesheetModal .modal-footer .btn{min-height:54px;flex:1 1 140px;font-size:16px;white-space:normal}
