:root {
  --bg: #0e1117;
  --bg2: #161b22;
  --bg3: #1c2230;
  --panel: #1a1f29;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #489EA9;
  --accent2: #0A4D56;
  --teal: #0A4D56;
  --turq: #489EA9;
  --danger: #ef4444;
  --green: #22c55e;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, 'Segoe UI', Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  font-size: 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }

/* Login */
.login-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, #1a2030, var(--bg));
}
.login-box {
  background: var(--panel); border: 1px solid var(--border);
  padding: 36px; border-radius: 16px; width: 340px; box-shadow: var(--shadow);
}
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-box input { margin-bottom: 14px; }
.login-box button {
  width: 100%; background: var(--accent); color: #fff; border: none;
  padding: 11px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.login-box button:hover { background: var(--accent2); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* Topbar */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.logo { color: var(--accent); font-size: 20px; }
.actions { display: flex; gap: 8px; }
.btn {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
}
.btn:hover { background: #232b38; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { background: transparent; border-color: #5b2a2a; color: var(--danger); }
.btn.danger:hover { background: rgba(239,68,68,.12); }
.btn.small { padding: 6px 10px; font-size: 12px; }

/* Board */
.board {
  display: flex; gap: 14px; padding: 18px; height: calc(100vh - 56px);
  overflow-x: auto; overflow-y: hidden; align-items: flex-start;
}
.list {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  width: 290px; min-width: 290px; max-height: 100%; display: flex; flex-direction: column;
}
.list.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.list-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); cursor: grab;
}
.list-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.list-name { font-weight: 600; font-size: 14px; flex: 1; }
.list-count { background: var(--bg3); color: var(--muted); font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.list-menu { color: var(--muted); font-size: 18px; background: none; border: none; padding: 0 4px; }
.cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.add-card { margin: 0 10px 10px; color: var(--muted); font-size: 13px; text-align: left; padding: 8px; border-radius: 8px; background: transparent; border: 1px dashed var(--border); }
.add-card:hover { color: var(--text); border-color: var(--accent); }

.card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 12px; cursor: grab; font-size: 14px;
}
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; }
.card-title { line-height: 1.35; word-break: break-word; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #2a3344; color: #aeb9cc; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.prio { font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 600; text-transform: uppercase; }
.prio.alta { background: rgba(245,158,11,.18); color: #f59e0b; }
.prio.urgente { background: rgba(239,68,68,.18); color: #ef4444; }
.prio.normal { background: rgba(99,102,241,.16); color: #818cf8; }
.prio.baixa { background: rgba(139,148,158,.16); color: #8b949e; }
.src-badge { background: rgba(34,197,94,.14); color: var(--green); padding: 2px 6px; border-radius: 6px; font-size: 10px; }
.due { margin-left: auto; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 560px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-head { display: flex; padding: 18px 18px 0; gap: 10px; }
.modal-title-input { font-size: 17px; font-weight: 600; border: none; background: transparent; padding: 6px 0; }
.close-x { background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; padding: 0 4px; }
.close-x:hover { color: var(--text); }
.modal-body { padding: 6px 18px 18px; overflow-y: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.spacer { flex: 1; }
.meta-box pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; font-size: 12px; color: var(--muted); overflow-x: auto; white-space: pre-wrap;
}
.comments { margin-top: 8px; }
#commentList { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.cmt { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.cmt .who { color: var(--accent); font-size: 11px; margin-bottom: 2px; }

/* Side panels */
.side-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 100%;
  background: var(--panel); border-left: 1px solid var(--border); z-index: 40;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.side-head h2 { font-size: 17px; }
.side-body { padding: 18px; overflow-y: auto; }
.side-body section { margin-bottom: 26px; }
.side-body h3 { font-size: 14px; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.events { list-style: none; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.events code { background: var(--bg); padding: 2px 6px; border-radius: 5px; color: var(--accent); margin-right: 6px; }

.wh-item, .in-item {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 10px;
}
.wh-item .row, .in-item .row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.wh-item input, .in-item input, .in-item select, .wh-item select { font-size: 13px; padding: 8px 10px; }
.url-copy { display: flex; gap: 6px; align-items: center; }
.url-copy code {
  flex: 1; background: var(--bg); padding: 8px 10px; border-radius: 7px; font-size: 11px;
  color: var(--green); overflow-x: auto; white-space: nowrap;
}
.mini { display: flex; gap: 6px; flex-wrap: wrap; }
.mini button { padding: 5px 9px; font-size: 12px; }
.badge-on { color: var(--green); font-size: 11px; }
.badge-off { color: var(--muted); font-size: 11px; }

/* Activity */
.act-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.act-type { color: var(--accent); font-weight: 600; }
.act-time { color: var(--muted); font-size: 11px; margin-left: auto; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: var(--shadow);
}
.toast.err { border-color: var(--danger); color: #fca5a5; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2c3442; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Acrescimos multiusuario ---- */
.login-logo { font-size: 38px; color: var(--accent); text-align: center; margin-bottom: 6px; }
.login-box input { margin-bottom: 12px; }
.user-chip { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; border-left: 1px solid var(--border); margin-left: 4px; }
#userName { font-size: 13px; font-weight: 600; }
.role-badge { font-size: 10px; padding: 2px 7px; border-radius: 6px; background: var(--bg3); color: var(--muted); text-transform: uppercase; font-weight: 700; }
.role-badge.admin { background: rgba(99,102,241,.2); color: #a5b4fc; }

.section-block { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.inline-add { display: flex; gap: 6px; margin-top: 8px; }
.inline-add input { flex: 1; }
.inline-add input.narrow { flex: 0 0 130px; }

.link-row { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.link-row a { color: var(--accent); text-decoration: none; font-size: 13px; flex: 1; word-break: break-all; }
.link-row a:hover { text-decoration: underline; }
.link-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.link-del, .cmt-del { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 2px; }
.link-del:hover, .cmt-del:hover { color: var(--danger); }

.cmt { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.cmt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cmt-head .who { color: var(--accent); font-size: 12px; font-weight: 600; }
.cmt-head .when { color: var(--muted); font-size: 11px; }
.cmt-head .cmt-del { margin-left: auto; }
.cmt-text { font-size: 13px; line-height: 1.4; }

.small-modal { width: 380px; }

.act-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.act-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.act-user { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; }
.act-sum { font-size: 13px; line-height: 1.35; }
.act-sum.act-danger { color: #fca5a5; font-weight: 600; }
.act-time { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ---- Barra de status dentro da tarefa (mover sem arrastar) ---- */
.status-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.status-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.status-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: all .12s; }
.status-pill .pill-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pill, #6b7280); flex: 0 0 auto; }
.status-pill:hover { border-color: var(--pill); background: color-mix(in srgb, var(--pill) 14%, transparent); }
.status-pill.atual { background: var(--pill); border-color: var(--pill); color: #fff; cursor: default; }
.status-pill.atual .pill-dot { background: #fff; }

/* ---- Marca Genaro Advocacia ---- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; color: var(--text); }
.login-logo-img { width: 72px; height: 72px; border-radius: 16px; display: block; margin: 0 auto 14px; box-shadow: 0 6px 20px rgba(10,77,86,.5); }

/* Topbar e botoes primarios na cor do escritorio */
.topbar { border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(10,77,86,.18), transparent); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: #0c5c68; }
.login-box button { background: var(--teal); }
.login-box button:hover { background: #0c5c68; }
.role-badge.admin { background: rgba(72,158,169,.22); color: #7fd0da; }
