@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;600;800&family=Poppins:wght@300;400;500;600&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;1,9..144,400&display=swap');

:root {
  --bg: #0a0a0c;
  --surface: #131318;
  --surface-2: #1b1b22;
  --line: #26262f;
  --text: #ece9e2;
  --muted: #8f8c85;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.12);
  --apertura: #4cc38a;
  --chiusura: #5b8def;
  --centrale: #e8c547;
  --trasferta: #9b6dd6;
  --assente: #6b6b74;
  --danger: #e05263;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Unbounded', sans-serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-bottom: 12px; }
h3 { font-size: 0.9rem; }

.serif { font-family: 'Fraunces', serif; font-style: italic; color: var(--muted); }

/* ---------- layout ---------- */
#app { max-width: 1080px; margin: 0 auto; padding: 0 16px 96px; }

header.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 22px 2px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
header.topbar .brand { display: flex; align-items: baseline; gap: 10px; }
header.topbar .brand b { font-family: 'Unbounded'; font-weight: 800; font-size: 1.15rem; }
header.topbar .brand b span { color: var(--gold); }
header.topbar .date { color: var(--muted); font-size: 0.8rem; }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: rgba(10,10,12,0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
nav.tabs button {
  background: none; border: none; color: var(--muted);
  font-family: 'Poppins'; font-size: 0.62rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 8px; border-radius: 10px; min-width: 54px;
}
nav.tabs button .ico { font-size: 1.15rem; }
nav.tabs button.active { color: var(--gold); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card.gold-spine { border-left: 3px solid var(--gold); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: 0.82rem; }
.small { font-size: 0.78rem; }

/* ---------- shift board ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 820px) { .board { grid-template-columns: 1fr; } }

.board .day-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.board .day-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline;
}
.board .day-head .wd { font-family: 'Unbounded'; font-size: 0.82rem; text-transform: capitalize; }
.board .day-head.today .wd { color: var(--gold); }
.board .day-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.shift-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: 10px; padding: 8px 12px;
  border-left: 3px solid var(--assente);
}
.shift-pill.apertura { border-left-color: var(--apertura); }
.shift-pill.chiusura { border-left-color: var(--chiusura); }
.shift-pill.centrale { border-left-color: var(--centrale); }
.shift-pill.trasferta { border-left-color: var(--trasferta); }
.shift-pill.open { border-left-color: var(--danger); background: rgba(224,82,99,0.08); }
.shift-pill .who { font-weight: 500; font-size: 0.88rem; flex: 1; }
.shift-pill .who.me { color: var(--gold); }
.shift-pill .hours { font-family: 'Unbounded'; font-size: 0.72rem; color: var(--muted); }
.shift-pill .note { font-size: 0.7rem; color: var(--muted); width: 100%; }

.absent-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 0.68rem; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.gold { color: var(--gold); border-color: rgba(212,175,55,0.4); background: var(--gold-soft); }
.badge.red { color: var(--danger); border-color: rgba(224,82,99,0.4); }

.day-note {
  background: var(--gold-soft); border: 1px solid rgba(212,175,55,0.3);
  color: var(--gold); font-size: 0.75rem; padding: 6px 10px; border-radius: 8px;
}

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 2px 16px; }
.legend .item { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--muted); }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- agenda ---------- */
.agenda-day { margin-bottom: 18px; }
.agenda-day .day-label {
  font-family: 'Unbounded'; font-size: 0.75rem; color: var(--muted);
  text-transform: capitalize; margin-bottom: 8px; padding-left: 2px;
}
.agenda-day .day-label.today { color: var(--gold); }
.event-row {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 6px;
}
.event-row .time { font-family: 'Unbounded'; font-size: 0.7rem; color: var(--muted); min-width: 76px; padding-top: 2px; }
.event-row .bar { width: 3px; align-self: stretch; border-radius: 2px; }
.event-row .title { font-size: 0.88rem; }
.event-row .src { font-size: 0.68rem; color: var(--muted); }

/* ---------- forms ---------- */
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-family: 'Poppins'; font-size: 0.9rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
label { font-size: 0.72rem; color: var(--muted); display: block; margin: 10px 0 4px; }

button.btn {
  background: var(--gold); color: #14120a; border: none;
  font-family: 'Unbounded'; font-weight: 600; font-size: 0.75rem;
  padding: 11px 20px; border-radius: 10px; cursor: pointer;
}
button.btn:hover { filter: brightness(1.08); }
button.btn.ghost { background: transparent; color: var(--gold); border: 1px solid rgba(212,175,55,0.45); }
button.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(224,82,99,0.45); }
button.btn.small { padding: 7px 12px; font-size: 0.65rem; }
button:disabled { opacity: 0.5; cursor: default; }

.iconbtn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 4px; }
.iconbtn:hover { color: var(--danger); }

/* ---------- lists ---------- */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-size: 0.9rem; }
.list-row .title.done { text-decoration: line-through; color: var(--muted); }
.amount { font-family: 'Unbounded'; font-size: 0.85rem; }
.amount.big { font-size: 1.5rem; color: var(--gold); }

.check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--muted);
  background: none; cursor: pointer; flex-shrink: 0; color: transparent; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.check.on { background: var(--gold); border-color: var(--gold); color: #14120a; }

.prio { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; }
.prio.p1 { background: var(--danger); }
.prio.p2 { background: var(--centrale); }
.prio.p3 { background: var(--muted); }

.ctx-badge { font-size: 0.64rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); text-transform: capitalize; }

.overdue { color: var(--danger); }
.soon { color: var(--centrale); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.login-box h1 span { color: var(--gold); }
.login-box .serif { margin-bottom: 28px; display: block; }

/* ---------- misc ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--gold); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: 0.82rem; z-index: 100;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.toast.err { border-color: var(--danger); }

.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--gold); color: var(--gold); }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .n { font-family: 'Unbounded'; font-size: 1.25rem; color: var(--gold); }
.stat .l { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 0.85rem; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 12px; }

.bar-chart .bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.8rem; }
.bar-chart .bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-chart .bar-fill { height: 100%; border-radius: 99px; }

a { color: var(--gold); }
code.inline { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; font-size: 0.78rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
