:root {
  --bg: #f3f4f6;
  --surface: #fff;
  --surface-2: #ececef;
  --soft: #f6f6f7;
  --text: #16171a;
  --muted: #6b6f76;
  --line: #e2e3e7;
  --border: #ced0d6;
  --primary: #ef7912;
  --primary-d: #d4660a;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --nav: #0a0a0a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0e;
    --surface: #1a1b1e;
    --surface-2: #232427;
    --soft: #1f2023;
    --text: #eceef0;
    --muted: #989ba3;
    --line: #2d2f33;
    --border: #3c3e44;
    --primary: #f0832a;
    --primary-d: #ffa559;
    --danger: #f87171;
    --ok: #4ade80;
    --warn: #fbbf24;
    --nav: #000;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  --bg: #0b0c0e;
  --surface: #1a1b1e;
  --surface-2: #232427;
  --soft: #1f2023;
  --text: #eceef0;
  --muted: #989ba3;
  --line: #2d2f33;
  --border: #3c3e44;
  --primary: #f0832a;
  --primary-d: #ffa559;
  --danger: #f87171;
  --ok: #4ade80;
  --warn: #fbbf24;
  --nav: #000;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 121, 18, .18);
}

textarea {
  resize: vertical;
  min-height: 64px;
}

input[type=checkbox] {
  width: auto;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin: 12px 0 4px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.ico {
  display: inline-flex;
  vertical-align: -3px;
}

.ico svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

/* botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
}

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

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-d);
}

.btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn.danger:hover {
  background: var(--soft);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--soft);
}

.btn.sm {
  padding: 4px 9px;
  font-size: 12.5px;
}

.btn.block {
  width: 100%;
  margin-top: 18px;
  padding: 11px;
}

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

.icon-btn {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.icon-btn:hover {
  background: var(--soft);
  color: var(--text);
}

/* login */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100%;
  background: linear-gradient(135deg, #0a0a0a, #2a1708);
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-size: 21px;
  text-align: center;
  color: #0f172a;
}

.login-card .muted {
  text-align: center;
  margin: 4px 0 8px;
}

.login-card label {
  color: #0f172a;
}

.brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 12px;
  background: #0a0a0a;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
}

.brand-mark img {
  width: 26px;
  height: 26px;
  display: block;
}

.alert {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 9px 12px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 13px;
}

/* topbar */
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 52px;
  flex: 0 0 52px;
  background: var(--nav);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  position: relative;
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 700;
  margin-right: 12px;
  white-space: nowrap;
}

.logo:hover {
  text-decoration: none;
}

.logo .brand-mark {
  width: auto;
  height: auto;
  margin: 0;
  background: transparent;
}

.logo .brand-mark img {
  width: 24px;
  height: 24px;
}

.topbar nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
}

.topbar nav a {
  color: #cbd5e1;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar nav a:hover {
  background: rgba(255, 255, 255, .1);
  text-decoration: none;
  color: #fff;
}

.topbar nav a.on {
  background: var(--primary);
  color: #fff;
}

.spacer {
  flex: 1;
}

.userbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: #fff;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.userbtn:hover {
  background: rgba(255, 255, 255, .1);
}

.userbtn .uname {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.notif-bell {
  position: relative;
  color: #fff;
  margin-right: 2px;
}

.notif-bell:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.install-btn {
  color: #fff;
  margin-right: 2px;
}

.install-btn:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.notif-panel {
  width: 380px;
  max-height: 420px;
  padding: 0;
  overflow-y: auto;
}

.notif-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.notif-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.notif-item:hover {
  background: var(--soft);
  text-decoration: none;
}

.notif-item.unread {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.notif-item .ico {
  margin-top: 2px;
  color: var(--muted);
  flex: 0 0 auto;
}

#view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page {
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 22px;
  flex: 1;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.settings-tab {
  border: 0;
  background: transparent;
  padding: 9px 4px;
  margin-right: 18px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.settings-tab:hover {
  color: var(--text);
}

.settings-tab.on {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.loading,
.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

/* avatar */
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
  border: 2px solid var(--surface);
  overflow: hidden;
}

.avatar.sm {
  width: 22px;
  height: 22px;
  font-size: 9.5px;
  border-width: 1.5px;
}

.avatar.lg {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.avatar.xl {
  width: 84px;
  height: 84px;
  font-size: 28px;
  border-width: 3px;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatars {
  display: flex;
}

.avatars .avatar {
  margin-left: -6px;
}

.avatars .avatar:first-child {
  margin-left: 0;
}

/* menus e popovers */
.pop {
  position: absolute;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 190px;
  padding: 6px;
}

.pop button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
}

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

.pop button.danger {
  color: var(--danger);
}

.pop hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

/* boards */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.board-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 112px;
  padding: 14px;
  border-radius: 12px;
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform .12s;
}

.board-tile:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.board-tile h3 {
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.board-tile .desc {
  font-size: 12px;
  opacity: .9;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-tile .stats {
  display: flex;
  gap: 6px;
  font-size: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .25);
  font-weight: 600;
  font-size: 12px;
}

.chip.red {
  background: #fee2e2;
  color: #b91c1c;
}

.board-tile.new {
  background: var(--surface-2);
  color: var(--muted);
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  box-shadow: none;
  cursor: pointer;
  font-weight: 600;
  text-align: center;
}

.board-tile.new:hover {
  background: var(--soft);
}

/* dashboard do cliente */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--border);
}

.stat-card.ok {
  border-top-color: var(--ok);
}

.stat-card.warn {
  border-top-color: var(--warn);
}

.stat-card.bad {
  border-top-color: var(--danger);
}

.stat-n {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-l {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.stat-delta {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
  color: var(--muted);
}

.stat-delta.ok {
  color: var(--ok);
}

.stat-delta.bad {
  color: var(--danger);
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  color: var(--text);
  min-height: 100px;
}

.dash-card:hover {
  background: var(--soft);
  text-decoration: none;
  transform: translateY(-2px);
}

.dash-card .t {
  font-weight: 700;
  font-size: 15px;
  margin-top: 4px;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 6px;
}

.access-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.period-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.period-pills .muted {
  margin-left: auto;
}

.chart-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 4px;
  box-shadow: var(--shadow);
}

.chart-wrap svg {
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--nav);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* quadro (kanban) */
.board-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--bc, #2563eb), color-mix(in srgb, var(--bc, #2563eb) 62%, #000));
}

.board-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #fff;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, .14);
}

.board-bar h1 {
  font-size: 18px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.board-bar .btn {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border-color: transparent;
}

.board-bar .btn:hover {
  background: rgba(255, 255, 255, .3);
}

.board-bar .btn.on {
  background: #fff;
  color: #0f172a;
}

.board-bar input[type=search] {
  width: 190px;
  background: rgba(255, 255, 255, .2);
  border-color: transparent;
  color: #fff;
}

.board-bar input[type=search]::placeholder {
  color: rgba(255, 255, 255, .75);
}

.board-bar input[type=search]:focus {
  background: #fff;
  color: #0f172a;
}

.ro-banner {
  background: #fef9c3;
  color: #854d0e;
  padding: 7px 16px;
  font-size: 13px;
}

.lists {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  padding: 14px 16px 18px;
  overflow-x: auto;
  align-items: flex-start;
}

.done-section {
  flex: 0 0 auto;
  margin: 0 16px 14px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 2px 14px;
}

.done-section summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
  color: var(--text);
}

.done-section .count {
  color: var(--muted);
  font-weight: 400;
}

.done-body {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0 10px;
}

.list {
  flex: 0 0 292px;
  width: 292px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.list.dragging {
  opacity: .45;
}

.list-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 6px 12px;
  cursor: grab;
}

.list-head h3 {
  font-size: 14px;
  flex: 1;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.list-head input {
  font-weight: 700;
  padding: 4px 6px;
}

.list-head .count {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0 7px;
}

.tarefas {
  overflow-y: auto;
  padding: 2px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 10px;
}

.tarefa {
  background: var(--surface);
  border-radius: 9px;
  padding: 9px 10px;
  box-shadow: 0 1px 1px rgba(15, 23, 42, .14);
  cursor: pointer;
  border: 1px solid transparent;
}

.tarefa:hover {
  border-color: var(--primary);
}

.tarefa.dragging {
  opacity: .4;
}

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

.ctitle {
  overflow-wrap: anywhere;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.pill {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
  min-width: 34px;
  min-height: 8px;
  line-height: 16px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .2);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge.due {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--soft);
}

.badge.due.over {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
}

.badge.due.today {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.badge.due.done {
  background: #dcfce7;
  color: #166534;
}

.badge.cl.full {
  color: #166534;
  background: #dcfce7;
  padding: 1px 6px;
  border-radius: 6px;
}

.badge.vis {
  color: var(--primary);
}

.badge.rv {
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 600;
}

.badge.rv.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.rv.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.rv.bad {
  background: #fee2e2;
  color: #b91c1c;
}

.badges .avatars {
  margin-left: auto;
}

.list-foot {
  padding: 6px 8px 8px;
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-align: left;
}

.add-btn:hover {
  background: var(--surface-2);
}

.composer textarea {
  min-height: 58px;
}

.composer .row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.add-list {
  flex: 0 0 292px;
}

.add-list>.add-btn {
  background: rgba(255, 255, 255, .22);
  color: #fff;
  padding: 11px 12px;
  border-radius: 12px;
}

.add-list>.add-btn:hover {
  background: rgba(255, 255, 255, .34);
}

.add-list .composer {
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
  padding: 8px;
  border-radius: 12px;
}

/* modais */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 12px;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal.wide {
  max-width: 1536px;
  background: var(--soft);
  height: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal.mid {
  max-width: 640px;
}

.modal-head {
  padding: 18px 22px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head h2 {
  font-size: 18px;
  flex: 1;
}

.modal-body {
  padding: 4px 22px 18px;
}

.modal-foot {
  padding: 12px 22px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-x {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
}

.section {
  margin-top: 20px;
}

.section>h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.sw {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.sw.on {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface) inset;
}

/* modal da tarefa (cm = "card modal", nome histórico das classes) */
.cm-head {
  padding: 20px 52px 10px 24px;
  flex: 0 0 auto;
}

.cm-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.cm-toolbar .avatars {
  margin-left: 4px;
}

.cm-toolbar .avatar-add,
.cm-toolbar .toolbar-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
}

.cm-toolbar .avatar-add {
  border: 1.5px dashed var(--line);
  color: var(--muted);
}

.cm-toolbar .avatar-add:hover {
  color: var(--text);
  border-color: var(--text);
  background: var(--soft);
}

.cm-toolbar .toolbar-btn {
  border: 1.5px solid var(--line);
  color: var(--muted);
}

.cm-toolbar .toolbar-btn:hover {
  color: var(--text);
  border-color: var(--text);
  background: var(--soft);
}

.cm-toolbar .toolbar-btn.on {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.cm-toolbar .toolbar-btn.urgent-on {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.cm-toolbar .toolbar-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.cm-toolbar .toolbar-time {
  margin-right: 4px;
  white-space: nowrap;
}

.avatar-check {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--surface);
}

.cm-title {
  font-size: 20px;
  font-weight: 700;
  border-color: transparent;
  background: transparent;
  padding: 4px 8px;
  margin-left: -8px;
}

.cm-title:hover {
  background: var(--soft);
}

.cm-title:focus {
  background: var(--surface);
}

h2.cm-title-ro {
  font-size: 20px;
}

.cm-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 22px;
  padding: 4px 24px 24px;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}

.cm-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cm-tabwrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.cm-tabwrap.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cm-comments {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cm-feed {
  margin-top: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.reply-bar b {
  color: var(--text);
}

.reply-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  border-left: 2px solid var(--line);
  padding: 4px 8px;
  border-radius: 6px;
  margin: 4px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reply-ref b {
  color: var(--text);
}

.cm-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.cm-side h5 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 6px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.cm-side h5:first-child {
  margin-top: 0;
}

.cm-side h5 .ico {
  color: var(--muted);
}

.info-tip {
  display: inline-flex;
  color: var(--muted);
  cursor: help;
  text-transform: none;
  letter-spacing: normal;
}

.info-tip:hover {
  color: var(--text);
}

.cm-side .side-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.cm-side .side-row:first-child {
  margin-top: 0;
}

.cm-side .side-row h5 {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.cm-side .side-row>select,
.cm-side .side-row>input,
.cm-side .side-row>.client-picker,
.cm-side .side-row>a,
.cm-side .side-row>button {
  flex: 1 1 auto;
  min-width: 0;
}

.client-picker-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.client-picker-btn:hover {
  border-color: var(--primary);
}

.client-picker-btn svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.client-picker-btn .cpb-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-picker-btn .cpb-label.muted {
  color: var(--muted);
}

.cm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 4px;
}

.box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.desc-view {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 54px;
  cursor: text;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.desc-view.empty {
  color: var(--muted);
  background: var(--soft);
  border-style: dashed;
}

.checklist {
  margin-bottom: 14px;
}

.cl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cl-head strong {
  flex: 1;
}

.progress {
  height: 7px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress>i {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width .2s;
}

.progress.full>i {
  background: var(--ok);
}

.progress.over>i {
  background: var(--danger);
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 2px;
  border-radius: 6px;
  margin: 0;
  font-weight: 400;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

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

.item input {
  margin-top: 3px;
}

.item span {
  flex: 1;
  overflow-wrap: anywhere;
}

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

.item .icon-btn {
  visibility: hidden;
}

.item:hover .icon-btn {
  visibility: visible;
}

.inline-add {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.att {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 6px;
}

.att .thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
}

.att .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.att .info {
  flex: 1;
  min-width: 0;
}

.att .info a {
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
}

.tag.internal {
  background: #fef3c7;
  color: #92400e;
}

.tag.client {
  background: #dcfce7;
  color: #166534;
}

.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.comment .bubble {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 0;
}

.comment.internal .bubble {
  background: #fffbeb;
  border-color: #fde68a;
  color: #0f172a;
}

.comment .who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.comment .body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mention {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary-d);
  font-weight: 600;
  padding: 0 3px;
  border-radius: 4px;
}

.comment.log {
  margin-bottom: 8px;
}

.comment.log .bubble {
  background: var(--soft);
  border-style: dashed;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 12px;
}

.log-avatar {
  background: var(--muted) !important;
  color: #fff;
}

.icon-btn.log-toggle.on {
  color: var(--primary);
  background: var(--soft);
}

.user-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
  font-size: 13.5px;
}

.user-check:hover {
  background: var(--soft);
}

.label-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 6px 10px;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  margin-bottom: 5px;
  text-align: left;
  opacity: .5;
}

.label-opt.on {
  opacity: 1;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
  font-weight: 600;
  font-size: 13px;
}

.switch input {
  width: 36px;
  height: 20px;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  border: 0;
  padding: 0;
  transition: background .15s;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left .15s;
}

.switch input:checked {
  background: var(--ok);
}

.switch input:checked::after {
  left: 18px;
}

.side-btn {
  width: 100%;
  justify-content: flex-start;
  margin-top: 4px;
}

/* tabelas */
.table-wrap {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

.role {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  white-space: nowrap;
}

.role.client {
  background: #dcfce7;
  color: #166534;
}

.role.member {
  background: #e0f2fe;
  color: #075985;
}

.status-off {
  color: var(--danger);
  font-weight: 600;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-end;
}

.filters>div {
  min-width: 140px;
  flex: 1;
}

.filters label {
  margin-top: 0;
}

.board-view>.filters {
  padding: 12px 16px 0;
  margin-bottom: 10px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.team-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 2px solid transparent;
}

.team-card:hover,
.team-card.on {
  border-color: var(--primary);
}

.team-card .top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.team-card .last {
  font-size: 12.5px;
  color: var(--text);
  min-height: 36px;
  overflow-wrap: anywhere;
}

.team-card .nums {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.num {
  font-size: 12px;
  background: var(--soft);
  border-radius: 8px;
  padding: 3px 8px;
}

.num b {
  font-weight: 800;
}

.num.bad {
  background: #fee2e2;
  color: #b91c1c;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.act {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}

.act.k-tarefa {
  background: #dbeafe;
  color: #1e40af;
}

.act.k-comment {
  background: #ede9fe;
  color: #5b21b6;
}

.act.k-attachment {
  background: #ffedd5;
  color: #9a3412;
}

.act.k-checklist {
  background: #dcfce7;
  color: #166534;
}

.act.k-auth {
  background: #f1f5f9;
  color: #475569;
}

.act.k-user {
  background: #fee2e2;
  color: #991b1b;
}

.act.k-board,
.act.k-list,
.act.k-label {
  background: #cffafe;
  color: #155e75;
}

.mine-group {
  margin-bottom: 22px;
}

.mine-group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.mine-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
  color: var(--text);
}

.mine-row:hover {
  text-decoration: none;
  background: var(--soft);
}

.mine-row .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.mine-row .t {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.row-between {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .5px;
}

.label-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.label-row input[type=text],
.label-row input:not([type]) {
  flex: 1;
}

.label-row select {
  width: 110px;
}

.label-row input[type=color] {
  flex: 0 0 44px;
}

/* toasts */
#toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  max-width: 90vw;
  animation: pop .18s ease-out;
}

.toast.error {
  background: #b91c1c;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 720px) {
  .cm-body {
    grid-template-columns: 1fr;
  }

  .page {
    padding: 14px;
  }

  .topbar .uname {
    display: none;
  }

  .list {
    flex-basis: 84vw;
    width: 84vw;
  }

  .add-list {
    flex-basis: 84vw;
  }

  .logo span.name {
    display: none;
  }

  .access-grid {
    grid-template-columns: 1fr;
  }
}