:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --personal: #2563eb;
  --garant1: #059669;
  --garant2: #d97706;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --done: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

header {
  background: #1e293b;
  color: white;
  padding: 1.5rem 2rem;
  text-align: center;
}

header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.2rem; }
header p { opacity: 0.9; font-size: 0.9rem; }

.appointment {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.15);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  margin-top: 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.global-progress {
  max-width: 1500px;
  margin: 1rem auto 0;
  padding: 0 1.25rem;
}

.progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--personal), var(--garant1), var(--garant2));
  width: 0%;
  transition: width 0.4s ease;
  border-radius: 999px;
}

.progress-text {
  text-align: center;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.actions {
  text-align: center;
  margin: 0.75rem auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
}

.btn {
  background: #64748b;
  color: white;
  border: none;
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn:hover { background: #475569; }
.btn-primary { background: var(--personal); }
.btn-primary:hover { background: #1d4ed8; }
.btn-reset { background: var(--danger); }
.btn-reset:hover { background: #dc2626; }

.api-status {
  font-size: 0.75rem;
  color: var(--muted);
  width: 100%;
  text-align: center;
}

.api-status.error { color: var(--danger); }
.api-status.ok { color: var(--garant1); }

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 1500px;
  margin: 0 auto 1.5rem;
  padding: 0 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .columns { grid-template-columns: 1fr; }
}

.column {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.column-header {
  padding: 1.1rem 1.15rem 0.85rem;
}

.column-header h2 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

.column.personal .column-header h2 { color: var(--personal); }
.column.garant1 .column-header h2 { color: var(--garant1); }
.column.garant2 .column-header h2 { color: var(--garant2); }

.column-header .subtitle {
  font-size: 0.78rem;
  color: var(--muted);
}

.section-progress {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.5rem;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.column-body { padding: 0 1rem 1.1rem; }

.group {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.75rem;
}

.group:last-child { margin-bottom: 0; }

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  flex: 1;
}

.group-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.15rem 0.3rem;
}

.group-actions button:hover { color: var(--text); }

.item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.32rem 0.25rem;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.item:hover { background: rgba(255, 255, 255, 0.85); }
.item.done .item-label { text-decoration: line-through; color: var(--muted); }

.item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--done);
  flex-shrink: 0;
}

.item-main { flex: 1; min-width: 0; }

.item-label {
  font-size: 0.8rem;
  line-height: 1.35;
  cursor: pointer;
}

.item-actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.item:hover .item-actions { opacity: 1; }

.item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.1rem 0.25rem;
  color: var(--muted);
}

.item-actions button:hover { color: var(--text); }
.item-actions .del:hover { color: var(--danger); }

.tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.2rem;
}

.tag.optional { background: #fef3c7; color: #92400e; }
.tag.recommended { background: #dbeafe; color: #1e40af; }
.tag.original { background: #fce7f3; color: #9d174d; }

.italian-note {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.35rem;
  padding: 0.25rem 0;
}

.fr-tr {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 400;
}

.add-item-btn {
  margin-top: 0.4rem;
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

.add-item-btn:hover {
  border-color: var(--personal);
  color: var(--personal);
}

.notes {
  max-width: 1500px;
  margin: 0 auto 1.5rem;
  padding: 0 1.25rem;
}

.notes-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  padding: 1rem 1.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.notes-box strong { color: var(--text); }

footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

@media print {
  .actions, footer, .item-actions, .group-actions, .add-item-btn { display: none !important; }
  .column { break-inside: avoid; box-shadow: none; }
  body { background: white; }
}

@media (max-width: 1100px) {
  .item-actions { opacity: 1; }
}
