:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --amber-50: #fffbeb;
  --amber-200: #fde68a;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --red-600: #dc2626;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  -webkit-font-smoothing: antialiased;
}

.page { min-height: 100vh; }

.container {
  max-width: 768px;
  margin: 0 auto;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.header { display: flex; align-items: center; gap: 12px; }
.logo { height: 40px; width: 40px; object-fit: contain; }
.title { margin: 0; font-size: 18px; font-weight: 700; color: var(--slate-800); }
.week-label { margin: 0; font-size: 12px; color: var(--slate-500); }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--amber-200);
  background: var(--amber-50);
  padding: 16px;
  border-radius: 16px;
}
.banner-icon { color: var(--amber-600); flex-shrink: 0; margin-top: 2px; }
.banner-title { margin: 0; font-weight: 600; color: var(--amber-800); }
.banner-text { margin: 2px 0 0; font-size: 14px; color: var(--amber-700); }

.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Modulo codice */
.code-form {
  max-width: 384px;
  width: 100%;
  margin: 32px auto 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.code-form-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--slate-700);
}
.code-form-head svg { color: var(--indigo-600); }
.code-form-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.code-form .hint { margin: 0; font-size: 12px; color: var(--slate-500); text-align: center; }
.code-input {
  width: 100%;
  text-align: center;
  font-size: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  border: 1px solid var(--slate-300);
  border-radius: 12px;
  padding: 12px;
  outline: none;
}
.code-input:focus { box-shadow: 0 0 0 3px var(--indigo-100); border-color: var(--indigo-600); }
.form-error { margin: 0; font-size: 14px; color: var(--red-600); text-align: center; }

/* Pulsanti */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--indigo-600); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--indigo-700); }
.btn-outline {
  background: var(--white);
  color: var(--slate-600);
  border: 1px solid var(--slate-300);
  font-size: 13px;
  padding: 8px 12px;
}
.btn-outline:hover:not(:disabled) { background: var(--slate-100); }
.btn-ghost { background: transparent; color: var(--slate-500); font-size: 13px; padding: 8px 12px; }
.btn-ghost:hover:not(:disabled) { background: var(--slate-100); }
.btn-block { width: 100%; }

.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid var(--slate-200);
  border-top-color: var(--indigo-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Vista attiva */
.active-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.active-bar .greeting { margin: 0; font-size: 14px; color: var(--slate-600); }
.active-bar .greeting strong { font-weight: 600; }
.active-bar .actions { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* Griglia attività */
.activity-list { display: flex; flex-direction: column; gap: 12px; }
.activity-card {
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  color: inherit;
}
.activity-card:hover:not(:disabled) { border-color: var(--indigo-100); }
.activity-card:disabled { cursor: default; }
.activity-card.selected {
  background: var(--indigo-600);
  border-color: var(--indigo-600);
  color: var(--white);
  box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}
.activity-card.saved {
  background: var(--emerald-600);
  border-color: var(--emerald-600);
  box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.3);
}
.activity-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.activity-day { display: flex; align-items: center; gap: 12px; min-width: 0; }
.check-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--indigo-50);
  color: var(--indigo-600);
  flex-shrink: 0;
}
.selected .check-badge { background: rgba(255, 255, 255, 0.2); color: var(--white); }
.activity-day .day-name { margin: 0; font-weight: 600; text-transform: capitalize; color: var(--slate-800); }
.activity-day .day-date { margin: 0; font-size: 12px; color: var(--slate-500); }
.selected .day-name, .selected .day-date { color: var(--white); }
.vote-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-600);
  flex-shrink: 0;
  white-space: nowrap;
}
.selected .vote-badge { background: rgba(255, 255, 255, 0.2); color: var(--white); }
.activity-meta { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.type-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--indigo-50);
  color: var(--indigo-700);
  flex-shrink: 0;
}
.selected .type-badge { background: rgba(255, 255, 255, 0.2); color: var(--white); }
.activity-time { font-size: 12px; color: var(--slate-500); flex-shrink: 0; }
.selected .activity-time { color: var(--indigo-100); }
.activity-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate-700); }
.selected .activity-title { color: var(--white); }

.empty-week { text-align: center; font-size: 14px; color: var(--slate-500); padding: 32px 0; }

.note-input {
  width: 100%;
  border: 1px solid var(--slate-300);
  background: var(--white);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-top: 8px;
  margin-bottom: 8px;
}
.note-input:focus { box-shadow: 0 0 0 3px var(--indigo-100); border-color: var(--indigo-600); }

.notfound { text-align: center; padding: 40px 0; }
.notfound p:first-child { font-size: 18px; font-weight: 600; color: var(--slate-700); margin: 0; }
.notfound p:last-child { font-size: 14px; color: var(--slate-500); margin: 4px 0 0; }

@media (max-width: 640px) {
  .container { padding: 24px 12px; }
}