:root {
  --bg: #f7f7f5;
  --card: #fff;
  --line: #d9d9d4;
  --txt: #1f1f1f;
  /* 2026-05-29: palette regolata per WCAG AA, testo normale >= 4.5:1 sui fondi usati. */
  --muted: #5f6368;
  --soft: #f4f4f2;
  --accent: #c53727;
  --accent-d: #9f261d;
  --hi: #c53727;
  --mid: #a35a00;
  --lo: #1f5fbf;
  --min: #646a73;
  --prog: #6546bd;
  --ok: #15803d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 6px rgba(0, 0, 0, .03);
  --shadow-lg: 0 14px 50px rgba(0, 0, 0, .22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.splash {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  color: var(--accent);
}

.app {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: #fbfbfa;
}

.mobile-sidebar-backdrop,
.drawer-close,
.sidebar-toggle {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 6px;
  font-size: 17px;
  font-weight: 750;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(500px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  color: var(--accent);
  font-size: 21px;
  font-weight: 750;
}

.auth-panel h1 {
  margin: 0 0 18px;
  color: var(--txt);
  font-size: clamp(34px, 6vw, 56px);
  line-height: .98;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.auth-panel p strong {
  color: var(--txt);
  font-weight: 750;
}

.auth-actions {
  display: grid;
  gap: 14px;
  margin-top: 36px;
  margin-right: auto;
  margin-left: auto;
  max-width: 420px;
}

.auth-actions button {
  width: 100%;
  min-height: 74px;
  border-radius: 4px;
  padding: 13px 18px;
}

.auth-primary,
.auth-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  text-align: left;
}

.auth-primary {
  border: 1px solid #dadce0;
  background: #fff;
  color: #3c4043;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .16);
}

.auth-secondary {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--txt);
}

.google-icon,
.offline-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.offline-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-copy {
  display: grid;
  gap: 3px;
}

.auth-copy strong {
  color: inherit;
  font-size: 14px;
  font-weight: 650;
}

.auth-copy small {
  color: inherit;
  font-size: 12.5px;
  font-weight: 400;
  opacity: .78;
}

.auth-actions button:disabled {
  cursor: wait;
  opacity: .75;
}

.btn-loader {
  width: 22px;
  height: 22px;
  border: 2px solid #dadce0;
  border-top-color: #4285f4;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.auth-note {
  margin-top: 24px !important;
  font-size: 15px !important;
  max-width: 560px;
}

.auth-note strong {
  color: var(--txt);
  font-weight: 750;
}

.nav-stat,
.sync-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 14px;
}

.nav-stat .big {
  font-size: 28px;
  font-weight: 750;
  line-height: 1;
}

.nav-stat .lab,
.sync-message {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.sync-title {
  color: var(--txt);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.sync-box.connected .sync-title,
.sync-box.dirty .sync-title,
.sync-box.saving .sync-title {
  color: var(--ok);
}

.sync-box.error .sync-title,
.sync-box.setup .sync-title {
  color: var(--accent);
}

.sync-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.sync-actions button,
.acts button,
.top-sync {
  border: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--txt);
  padding: 8px 10px;
  font-size: 13px;
}

.top-sync {
  display: none;
}

.sync-actions button:first-child,
.top-sync {
  background: var(--accent);
  color: white;
  font-weight: 650;
}

.acts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.acts button {
  background: transparent;
  text-align: left;
}

.acts button:hover,
.sync-actions button:hover {
  filter: brightness(.96);
}

.sync-actions button:disabled,
.top-sync:disabled {
  cursor: wait;
  opacity: .75;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 14px 6px 0;
}

.legend .t {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12.5px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.hi { background: var(--hi); }
.dot.mid { background: var(--mid); }
.dot.lo { background: var(--lo); }
.dot.min { background: var(--min); }

.main {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 36px 82px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.new-task-btn {
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
}

.new-task-btn:hover {
  background: var(--accent-d);
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.section {
  margin-bottom: 26px;
}

.section h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.section h2 .bar {
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--sc);
}

.section h2 .n {
  color: var(--muted);
  font-weight: 500;
}

.item {
  margin-bottom: 9px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cc);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
}

.item:hover,
.item:focus-visible {
  outline: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .07);
}

.row1 {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.row2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 11px;
  padding-left: 36px;
  color: var(--muted);
  font-size: 13px;
}

.check {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 2px solid var(--cc);
  border-radius: 50%;
  background: transparent;
}

.check:hover,
.item.done .check {
  background: var(--cc);
}

.check:hover::after,
.item.done .check::after {
  content: "";
  width: 6px;
  height: 10px;
  margin-top: -2px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg);
}

.name {
  flex: 1;
  min-width: 0;
  color: var(--txt);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 16px;
  line-height: 1.5;
}

.item:hover .name {
  color: var(--accent);
}

.item.done .name {
  color: var(--muted);
  text-decoration: line-through;
}

.score {
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 8px;
  background: var(--cc);
  color: white;
  padding: 4px 11px;
  font-size: 13px;
  font-weight: 750;
}

.meta-i,
.due {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
}

.meta-i b {
  color: var(--txt);
  font-weight: 650;
}

.due {
  font-size: 12.5px;
  font-weight: 650;
}

.due.over { color: var(--hi); }
.due.soon { color: var(--mid); }
.due.norm { color: var(--lo); }

.link-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-left: 36px;
  font-size: 15px;
  font-weight: 600;
}

.link-row a {
  color: var(--lo);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-row a:hover {
  text-decoration: underline;
}

.spacer {
  flex: 1;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  transition: background .15s, color .15s;
}

.iconbtn.pomo {
  width: 34px;
  height: 34px;
  font-size: 20px;
}

.iconbtn.pomo:hover {
  background: #fdecea;
}

.iconbtn.menu {
  width: 34px;
  height: 34px;
  color: var(--muted);
  font-size: 18px;
  letter-spacing: 1px;
}

.iconbtn.menu:hover {
  background: var(--soft);
  color: var(--txt);
}

.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  box-shadow: 0 6px 20px rgba(220, 76, 62, .45);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.fab:hover {
  background: var(--accent-d);
  transform: translateY(-2px);
}

.ctxmenu {
  position: absolute;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.ctxmenu button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--txt);
  padding: 10px 12px;
  text-align: left;
}

.ctxmenu button:hover {
  background: var(--soft);
}

.ctx-icon {
  flex: 0 0 22px;
  color: currentColor;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.ctxmenu .danger {
  color: var(--accent);
}

.language-switch {
  /* 2026-05-29: switch lingua locale alla PWA, separato dai dati task sincronizzati. */
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.language-switch select {
  appearance: none;
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 17px) 50% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 12px) 50% / 5px 5px no-repeat,
    var(--card);
  color: var(--txt);
  padding: 0 34px 0 10px;
  font-size: 13px;
  font-weight: 400;
  line-height: 38px;
}

.credits {
  margin-top: 28px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 20, 20, .5);
  backdrop-filter: blur(3px);
}

.overlay.show {
  display: flex;
}

.confirm,
.modal {
  width: min(380px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.confirm {
  padding: 24px;
  text-align: center;
}

.confirm h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.confirm p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
  word-break: break-word;
}

.confirm .ic {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #fdecea;
  color: var(--accent);
  font-weight: 800;
}

.edit-dialog {
  text-align: left;
}

.edit-dialog h3 {
  text-align: center;
}

.edit-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--txt);
  font-size: 14px;
  font-weight: 600;
}

.edit-field.col {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--txt);
  padding: 9px 10px;
  outline: none;
}

.edit-field textarea {
  min-height: 70px;
  resize: vertical;
  line-height: 1.5;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  border-color: var(--accent);
}

.cbtns,
.mbtns {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}

.cbtns button,
.mbtns button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
  font-weight: 650;
}

.no,
.reset,
.pause {
  border: 1px solid var(--line) !important;
  background: var(--soft);
  color: var(--txt);
}

.yes,
.start {
  background: var(--accent);
  color: white;
}

.modal {
  position: relative;
  width: min(340px, 92vw);
  padding: 48px 22px 20px;
  text-align: center;
}

.modal .close {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
  color: var(--muted);
  font-size: 22px;
}

.mtask {
  max-height: 48px;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 0 8px;
  color: var(--txt);
  font-size: 15px;
  font-weight: 650;
}

.progring {
  position: relative;
  width: 170px;
  aspect-ratio: 1;
  margin: 0 auto 18px;
}

.progring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.clock {
  color: var(--accent);
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1;
}

.state {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-bottom: 10px;
}

.presets button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--txt);
  padding: 6px 13px;
  font-size: 13px;
}

.presets .on {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.custom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12.5px;
}

.custom input {
  width: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  text-align: center;
}

.empty {
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: #fdecea;
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
}

.install-banner,
.update-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto;
  border-radius: 14px;
  background: #1f1f1f;
  color: white;
  padding: 14px;
  box-shadow: var(--shadow-lg);
}

.credits {
  padding: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.credits a {
  color: var(--txt);
  text-decoration: none;
  font-weight: 650;
}

.credits a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.mobile-credits {
  display: none;
}

.install-banner,
.update-banner {
  background: var(--accent);
}

.install-banner div,
.update-banner div {
  flex: 1;
}

.install-banner strong,
.install-banner span,
.update-banner strong,
.update-banner span {
  display: block;
}

.install-banner span,
.update-banner span {
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
}

.install-banner button,
.update-banner button {
  border: 0;
  border-radius: 9px;
  background: white;
  color: #1f1f1f;
  padding: 9px 12px;
  font-weight: 650;
}

.install-banner .ghost,
.update-banner .ghost {
  border: 1px solid rgba(255, 255, 255, .26);
  background: transparent;
  color: white;
}

@media (max-width: 780px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    width: min(292px, 84vw);
    overflow-y: auto;
    padding-top: 18px;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    z-index: 49;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(0, 0, 0, .34);
    opacity: 0;
    transition: opacity .18s ease, visibility .18s ease;
  }

  .mobile-sidebar-backdrop.show {
    visibility: visible;
    opacity: 1;
  }

  .drawer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--txt);
    font-size: 24px;
    line-height: 1;
  }

  .main {
    max-width: none;
    padding: 18px 16px 118px;
  }

  .topbar {
    position: relative;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding-right: 96px;
  }

  .top-actions {
    align-items: flex-start;
    flex-direction: row;
  }

  .sidebar-toggle {
    display: inline-flex;
    position: absolute;
    top: 0;
    right: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--txt);
    padding: 0;
    box-shadow: var(--shadow);
    font-size: 21px;
    font-weight: 500;
    line-height: 1;
  }

  .sidebar-toggle:hover {
    border-color: #c8c8c2;
    background: var(--soft);
  }

  .new-task-btn {
    display: none;
  }

  .top-sync {
    position: absolute;
    top: 0;
    right: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--accent);
    padding: 0;
    box-shadow: var(--shadow);
    font-size: 22px;
    line-height: 1;
  }

  .top-sync:hover {
    border-color: #c8c8c2;
    background: var(--soft);
  }

  .top-sync.saving .sync-icon {
    animation: spin .9s linear infinite;
  }

  .mini-google-icon {
    width: 20px;
    height: 20px;
  }

  .top-sync:disabled {
    cursor: wait;
    opacity: 1;
  }

  .row2 {
    gap: 14px;
    margin-top: 13px;
    padding-left: 0;
  }

  .link-row {
    padding-left: 0;
  }

  .fab {
    right: 18px;
    bottom: calc(58px + env(safe-area-inset-bottom));
  }

  .credits {
    display: none;
  }

  .mobile-credits {
    position: fixed;
    right: 70px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 70px;
    z-index: 39;
    display: flex;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
  }

  .mobile-credits a {
    color: var(--txt);
    text-decoration: none;
    font-weight: 650;
  }

  .mobile-credits a:hover {
    color: var(--accent);
    text-decoration: underline;
  }
}
