/* O quadro do Niupi: sempre escuro, como o Niupi (o André, 2026-10-23: "não é preciso modos"). */
:root {
  --bg: #1b1e25;
  --column: #20242c;
  --card: #262a33;
  --cardHover: #2c313b;
  --border: #343a47;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #5b8def;
  --ringing: #f0b232;
  --danger: #e5534b;
  --ok: #3fb950;
  --chip: #313745;
  --shadow: 0 4px 14px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select, textarea { font: inherit; color: inherit; }

.spacer { flex: 1; }

/* ---------- topo ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.top h1 { margin: 0; font-size: 18px; }

.tabs { display: flex; gap: 4px; }

.tabs button {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--muted);
}

.tabs button[aria-selected="true"] {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
}

.toggle { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; cursor: pointer; }

.live {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.live.on { background: var(--ok); }
.live.off { background: var(--danger); }

/* ---------- lembretes a tocar ---------- */

.ringing {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 0;
}

.ring {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--ringing);
  border-radius: 12px;
  background: var(--card);
  flex-wrap: wrap;
}

.ring .text { flex: 1; min-width: 160px; }
.ring .late { color: var(--ringing); font-size: 12px; }

.notice {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--danger);
}

/* ---------- quadro ---------- */

.board {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  align-items: flex-start;
}

.column {
  flex: 1 0 220px;
  max-width: 340px;
  background: var(--column);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 110px);
}

.column > h2 {
  margin: 0;
  padding: 12px 14px 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  display: flex;
  gap: 8px;
}

.column > h2 .count { font-weight: normal; }

/* ← → ✎ ✕ das colunas: aparecem ao passar por cima (sempre, em ecrãs de toque) */
.column > h2 .tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.column:hover > h2 .tools, .column > h2 .tools:focus-within { opacity: 1; }
@media (hover: none) { .column > h2 .tools { opacity: 1; } }
.column > h2 .tools button { font-size: 13px; padding: 0 4px; text-transform: none; }
.column > h2 .tools button:hover { color: var(--text); }

/* Backlog: o que ainda não é para fazer, mais apagado */
.column.parked { border-style: dashed; background: transparent; }
.column.parked .card { box-shadow: none; opacity: .85; }

.column.newColumn {
  flex: 0 0 190px;
  background: transparent;
  border-style: dashed;
  padding: 10px;
}

.column.newColumn input { width: 100%; }

.cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 10px 12px;
  overflow-y: auto;
  min-height: 60px;
}

.column.dropTarget { border-color: var(--accent); }
.column.noDrop { opacity: .55; }

.dropMarker { height: 3px; border-radius: 2px; background: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  box-shadow: var(--shadow);
  user-select: none;
}

.card:hover { background: var(--cardHover); }
.card.dragging { opacity: .4; }
.card.isRinging { border-color: var(--ringing); }
.card.isDone .title { color: var(--muted); text-decoration: line-through; }

.card .title { word-break: break-word; }
.card .title .star { color: var(--ringing); margin-right: 4px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}

.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 1px 8px;
}

.meta a { color: var(--accent); text-decoration: none; }

/* ---------- acrescentar ---------- */

.add {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 8px;
}

.add input[name="title"] { flex: 1 1 100%; }
.add input[type="datetime-local"] { flex: 1 1 150px; }

input, select, textarea {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
  min-width: 0;
}

input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button.primary, button.plain, button.danger {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.icon { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 16px; }

/* ---------- editor ---------- */

dialog {
  width: min(520px, calc(100vw - 32px));
  background: var(--column);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0, 0, 0, .45); }

dialog form { display: flex; flex-direction: column; gap: 12px; padding: 16px; }

dialog label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
dialog label > input, dialog label > select, dialog label > textarea { color: var(--text); font-size: 14px; }
dialog label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 160px; }

.editorHead, .editorFoot { display: flex; align-items: center; gap: 8px; }
.editorHead span { color: var(--muted); }

.source { margin: 0; font-size: 12px; color: var(--muted); }
.source a { color: var(--accent); }

.history { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); max-height: 160px; overflow-y: auto; }

/* ---------- atividade ---------- */

.badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.activity {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.activityBar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.activityBar input[type="search"] { flex: 1 1 180px; }

.kinds { display: flex; gap: 6px; flex-wrap: wrap; }

.kind {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.kind[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }

.activitySection h2, .day h2 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.activitySection h2 button { text-transform: none; letter-spacing: normal; font-size: 12px; padding: 3px 10px; }

#activityUnseen { margin-bottom: 24px; }
.day { margin-bottom: 20px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.entry {
  display: grid;
  grid-template-columns: 24px 74px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.entry.unseen { border-left: 3px solid var(--accent); }
.entry .icon { text-align: center; }
.entry time { color: var(--muted); font-size: 12px; padding-top: 2px; white-space: nowrap; }
.entry .what { min-width: 0; }
.entry .title { word-break: break-word; }
.entry .body { color: var(--muted); font-size: 13px; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.entry.long .body { cursor: pointer; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.entry.long .body.open { display: block; }
.rowTools { display: flex; gap: 8px; align-items: center; }
.rowTools a { color: var(--accent); text-decoration: none; font-size: 13px; }
.rowTools button.icon { font-size: 14px; padding: 0 4px; }
.rowTools button.icon:hover { color: var(--ok); }

.empty { color: var(--muted); }
.more { display: block; margin: 8px auto 24px; }

/* ---------- 📱 o PIN: a janela no PC e o ecrã do telemóvel ---------- */

.top .phoneButton { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; cursor: pointer; color: var(--muted); font-size: 13px; }
.top .phoneButton:hover { color: var(--text); border-color: var(--accent); }
dialog.phone { width: min(380px, calc(100vw - 32px)); }
dialog.phone form.body { gap: 12px; padding: 16px 20px 20px; }
dialog.phone h2 { margin: 0; font-size: 16px; display: flex; align-items: center; }
dialog.phone h2 .spacer { flex: 1; }
dialog.phone h2 .icon { outline: none; }  /* o showModal põe o foco no ✕: sem o contorno branco */
dialog.phone h2 .icon:hover, dialog.phone h2 .icon:focus-visible { color: var(--text); }
dialog.phone p { margin: 0; color: var(--muted); font-size: 13px; }
dialog.phone code { color: var(--text); background: var(--chip); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
dialog.phone input[name] { letter-spacing: .4em; font-size: 18px; text-align: center; }
dialog.phone .row { justify-content: flex-end; align-items: center; gap: 8px; }
dialog.phone .msg { margin-right: auto; font-size: 13px; color: var(--muted); }
dialog.phone .msg.ok { color: var(--ok); }
dialog.phone .msg.bad { color: var(--danger); }
dialog.phone .sessions { font-size: 12px; }
dialog.phone .pinState { color: var(--text); }
dialog.phone .pinState.ok::first-letter { color: var(--ok); }
dialog.phone .qrRow { display: flex; gap: 14px; align-items: center; }
dialog.phone .qr { background: #fff; border-radius: 10px; padding: 4px; line-height: 0; flex: none; }
dialog.phone .qrRow p { flex: 1; min-width: 0; }
dialog.phone code { word-break: break-all; }  /* o endereço do Funnel é comprido: parte em vez de dar scroll */
dialog.phone { overflow-x: hidden; }

.pinScreen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.pinScreen .who { font-size: 20px; font-weight: 600; }
.pinScreen .hint { color: var(--muted); font-size: 13px; margin-top: -10px; min-height: 18px; text-align: center; }
.pinScreen .hint.bad { color: var(--danger); }
.dots { display: flex; gap: 14px; height: 18px; }
.dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.dots span.on { background: var(--accent); border-color: var(--accent); }
.dots.bad span { border-color: var(--danger); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keys button { height: 72px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); font-size: 26px; cursor: pointer; touch-action: manipulation; }
.keys button:active { background: var(--accent); color: #fff; }
.keys button.plain { border: none; background: none; font-size: 15px; color: var(--muted); }
.keys button:disabled { opacity: .35; cursor: default; }
.pinScreen .locked { color: var(--ringing); font-size: 13px; text-align: center; }

/* ---------- trabalho (o diário: work.js) ---------- */

.work { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 16px; }
.workBar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.workBar .kinds { flex: 1 1 auto; }
.workBar input[type="date"] { padding: 3px 8px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.segmented button { background: var(--card); border: none; padding: 4px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.collected { color: var(--muted); font-size: 12px; }

.periodTitle { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.periodTitle span { color: var(--muted); font-weight: normal; font-size: 13px; margin-left: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.stat .n { font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: 12px; }

.timeBox { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 22px; }
.timeBox h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.bars { display: grid; grid-template-columns: minmax(120px, 230px) 1fr 56px; gap: 6px 10px; align-items: center; font-size: 13px; }
.bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bars .h { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.workDay { margin-bottom: 22px; }
.workDay > h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; gap: 10px; align-items: baseline; }
.workDay > h2 .spent { text-transform: none; letter-spacing: normal; font-weight: normal; font-size: 12px; }

.project { background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.project > header { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.project > header .pname { font-weight: 600; }
.project > header .pgroup { color: var(--muted); font-size: 12px; }
.project > header .spacer { flex: 1; }
.project > header .ptime { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.project ul { list-style: none; margin: 0; padding: 4px 0; }
.project li { display: grid; grid-template-columns: 70px 22px 1fr; gap: 8px; padding: 4px 12px; align-items: start; }
.project li > div { min-width: 0; }
.project li time { color: var(--muted); font-size: 12px; padding-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.project li .ic { text-align: center; }
.project li .t { word-break: break-word; }
.project li .t a { color: var(--text); text-decoration: none; }
.project li .t a:hover { color: var(--accent); text-decoration: underline; }
.project li .sub { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; font-size: 12px; color: var(--muted); }
.project li .sub span { word-break: break-word; }
.project li .sub code { font: 11px Consolas, monospace; background: var(--chip); border-radius: 4px; padding: 0 5px; word-break: break-all; }
.project li.small .t, .project li.small .t a { color: var(--muted); }
.project li.pr .t a, .project li.release .t a { font-weight: 600; }
.project .moreSmall { padding: 2px 12px 8px 112px; font-size: 12px; color: var(--muted); cursor: pointer; background: none; border: none; text-align: left; }
.project .moreSmall:hover { color: var(--accent); }

.empty.big { text-align: center; padding: 48px 16px; }
.empty.big .e { font-size: 34px; }

@media (max-width: 640px) {
  .tabs { flex-wrap: wrap; }
  .bars { grid-template-columns: 1fr 48px; row-gap: 2px; }
  .bars .name { grid-column: 1 / -1; margin-top: 6px; }
  .project li { grid-template-columns: 22px 1fr; }
  .project li time { grid-column: 2; }
  .project li .ic { grid-row: 1 / span 2; }
  .project .moreSmall { padding-left: 42px; }
  .entry { grid-template-columns: 22px 1fr auto; }
  .entry time { grid-column: 2; grid-row: 1; }
  .entry .rowTools { grid-column: 3; grid-row: 1; }
  .entry .what { grid-column: 1 / -1; grid-row: 2; }
  .board { flex-direction: column; align-items: stretch; }
  .column, .column.newColumn { flex: none; max-width: none; max-height: none; }
}
