:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #131313;
  --bg-soft: #1c1c1c;
  --bg-card: #232323;
  --bg-list: #1a1a1a;
  --orange: #FF521D;
  --orange-soft: #ff7a4d;
  --text: #f4f2ee;
  --text-dim: #9a9793;
  --border: #2c2c2c;
  --danger: #e5484d;
  --ok: #2E7D5B;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.6rem; background: var(--bg-soft); border-bottom: 1px solid var(--border);
}
.topbar-brand { font-weight: 700; letter-spacing: .01em; }
.topbar-user a.topbar-user-name { color: var(--text); text-decoration: none; }
.topbar-user a.topbar-user-name:hover { color: var(--orange-soft); }
.topbar-brand span { color: var(--orange); }
.back-link { text-decoration: none; color: var(--text-dim); }
.back-link:hover { color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: .9rem; color: var(--text-dim); }
.btn-link { color: var(--orange-soft); text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* buttons */
.btn-primary {
  background: var(--orange); color: #fff; border: none; border-radius: 6px;
  padding: .6em 1.2em; font-weight: 600; font-size: .9rem;
}
.btn-primary:hover { background: var(--orange-soft); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: .6em 1.2em; font-size: .9rem;
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-soft); }
.btn-ghost.small, .btn-primary.small { padding: .4em .8em; font-size: .8rem; }
.btn-danger {
  background: transparent; border: 1px solid var(--danger); color: var(--danger);
  border-radius: 6px; padding: .6em 1.2em; font-size: .85rem; margin-top: 1rem;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* auth pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  padding: 2.4rem; width: min(360px, 90vw); display: flex; flex-direction: column; gap: 1rem;
}
.auth-card h1 { font-family: var(--font); font-weight: 700; }
.auth-sub { color: var(--text-dim); font-size: .85rem; margin-top: -.6rem; }
.auth-error { color: var(--danger); font-size: .85rem; }
.auth-ok { color: #7bd0a8; font-size: .85rem; }
.perfil-sep { border: none; border-top: 1px solid var(--border); margin: .4rem 0; }
.auth-card label { display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; color: var(--text-dim); }
.auth-card input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .65em .8em; font-size: .95rem;
}
.auth-card button { margin-top: .4rem; }
.auth-link { text-align: center; color: var(--orange-soft); font-size: .85rem; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

/* boards list */
.boards-page { padding: 2rem 2.4rem; max-width: 1100px; margin: 0 auto; }
.boards-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; gap: 1rem; flex-wrap: wrap; }
.boards-head-actions { display: flex; align-items: center; gap: .6rem; }
.boards-head-actions a { text-decoration: none; }
.boards-head h1 { font-family: var(--font); font-weight: 700; }
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.board-tile {
  display: block; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.4rem; text-decoration: none; color: var(--text); transition: border-color .2s, transform .2s;
}
.board-tile:hover { border-color: var(--orange); transform: translateY(-2px); }
.board-tile-name { font-weight: 600; margin-bottom: .4rem; }
.board-tile-owner { font-size: .8rem; color: var(--text-dim); }
.empty-hint { color: var(--text-dim); }

/* board page */
.board-page {
  padding: 1.4rem 1.6rem; overflow-x: auto; height: calc(100vh - 62px);
  background: #e56a35;
}
.board-title { font-family: var(--font); font-weight: 700; margin-bottom: 1.2rem; }
.list-count { font-size: .75rem; color: var(--text-dim); padding: 0 .4rem; flex: none; }
.list-more-btn {
  background: none; border: none; color: var(--orange-soft); font-size: .8rem; padding: .5rem 0;
  width: 100%; text-align: left;
}
.list-more-btn:hover { text-decoration: underline; }
.lists-row { display: flex; gap: 1rem; align-items: flex-start; }
.list-col {
  background: var(--bg-list); border-radius: 10px; width: 272px; flex: none;
  display: flex; flex-direction: column; max-height: calc(100vh - 160px);
}
.list-col.drag-over { outline: 2px dashed var(--orange); }
.list-header {
  display: flex; align-items: center; justify-content: space-between; padding: .8rem .9rem .4rem;
  cursor: grab;
}
.list-header input {
  background: transparent; border: none; color: var(--text); font-weight: 600; font-size: .95rem;
  width: 100%; padding: .2em;
}
.list-header input:focus { outline: 1px solid var(--border); border-radius: 4px; }
.list-remove { background: none; border: none; color: var(--text-dim); font-size: 1.1rem; padding: 0 .3rem; }
.list-remove:hover { color: var(--danger); }
.list-body { padding: .3rem .7rem; overflow-y: auto; display: flex; flex-direction: column; gap: .55rem; min-height: 12px; }
.list-footer { padding: .5rem .9rem .9rem; }
.add-card-btn {
  background: none; border: none; color: var(--text-dim); font-size: .85rem; padding: .4em 0; width: 100%; text-align: left;
}
.add-card-btn:hover { color: var(--orange-soft); }
.add-card-form { display: flex; flex-direction: column; gap: .5rem; }
.add-card-form textarea {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .5em .6em; font-size: .88rem; resize: vertical;
}
.add-card-actions { display: flex; gap: .5rem; }

.add-list-col { width: 272px; flex: none; }
.add-list-btn {
  background: rgba(255,255,255,.04); border: 1px dashed var(--border); border-radius: 10px; color: var(--text-dim);
  padding: .9rem; width: 100%; text-align: left; font-size: .9rem;
}
.add-list-btn:hover { color: var(--orange-soft); border-color: var(--orange); }
.add-list-form {
  background: var(--bg-list); border-radius: 10px; padding: .8rem; display: flex; flex-direction: column; gap: .5rem;
}
.add-list-form input {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .5em .6em;
}

/* card */
.card-item {
  background: var(--bg-card); border-radius: 8px; padding: .7rem .8rem; cursor: pointer;
  border: 1px solid transparent; transition: border-color .15s;
}
.card-item:hover { border-color: var(--orange); }
.card-item.dragging { opacity: .4; }
.card-labels-row { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-label-pill {
  display: inline-flex; align-items: center; padding: .18em .7em; border-radius: 12px;
  font-size: .72rem; font-weight: 600; line-height: 1.5;
}
.card-title-text { font-size: 14px; line-height: 1.45; font-weight: 400; letter-spacing: .1px; }
.card-meta-row { display: flex; align-items: center; gap: .8rem; margin-top: .5rem; font-size: .74rem; color: var(--text-dim); }
.card-meta-row span { display: inline-flex; align-items: center; gap: .3em; }
.card-due.overdue { color: var(--danger); }
.card-due.done { color: #7bd0a8; }
.card-meta-row .done { color: #7bd0a8; }
.card-avatars-row { display: flex; gap: .3rem; margin-left: auto; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 100; overflow-y: auto; }
.modal.hidden { display: none; }
.modal-box {
  background: var(--bg-soft); border-radius: 12px; border: 1px solid var(--border); padding: 1.6rem;
  width: min(420px, 94vw);
}
.modal-box h2 { font-family: var(--font); font-weight: 700; margin-bottom: 1rem; }
.modal-box input[type=text] {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .6em .7em; margin-bottom: 1rem;
}
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }

.card-modal-v2 { width: min(920px, 96vw); padding: 1.2rem 1.4rem 1.6rem; }
.card-modal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.list-badge {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .4em .9em;
  font-size: .8rem; font-weight: 600; color: var(--text-dim);
}
.card-modal-columns { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.8rem; }
@media (max-width: 760px) { .card-modal-columns { grid-template-columns: 1fr; } }

.card-modal-left, .card-modal-right { max-height: 78vh; overflow-y: auto; }
.card-title-row { margin-bottom: 1rem; }
.card-title-input {
  width: 100%; background: transparent; border: none; color: var(--text); font-size: 1.35rem; font-weight: 700;
  font-family: var(--font); font-weight: 700; padding: .3em;
}
.card-title-input:focus { outline: 1px solid var(--border); border-radius: 4px; }

.quick-actions-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.quick-action-btn {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .55em 1em; font-size: .82rem; font-weight: 500;
}
.quick-action-btn:hover, .quick-action-btn.active { border-color: var(--orange); color: var(--orange-soft); }

.card-summary { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.card-summary-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.card-summary-label-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); width: 100%; }

.quick-panel {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
}
.quick-panel.hidden { display: none; }
.quick-panel h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: .6rem; }
.quick-panel input[type=date] {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .5em .7em;
}

.desc-section h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: .5rem; }
.desc-section textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .6em .7em; font-size: .9rem; margin-bottom: .5rem;
}

.card-modal-right { border-left: 1px solid var(--border); padding-left: 1.6rem; }
.card-modal-right h3 { font-size: .82rem; color: var(--text-dim); margin-bottom: .8rem; }

.avatar-chip {
  display: inline-flex; align-items: center; gap: .4em; padding: .3em .8em .3em .4em; border-radius: 14px;
  font-size: .8rem; font-weight: 600; cursor: pointer; background: var(--bg-card); border: 1px solid var(--border);
  opacity: .55;
}
.avatar-chip.active { opacity: 1; border-color: var(--orange); }
.avatar-circle {
  width: 22px; height: 22px; border-radius: 50%; background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; flex: none;
}
.avatar-circle.small { width: 20px; height: 20px; font-size: .62rem; }
.label-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.label-none-hint { font-size: .8rem; color: var(--text-dim); }

/* dropdown de etiquetas */
.label-dd { position: relative; }
.label-dd-toggle {
  width: 100%; text-align: left; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: .55em .8em; font-size: .85rem;
}
.label-dd-toggle:hover, .label-dd-toggle.active { border-color: var(--orange); color: var(--orange-soft); }
.label-dd-menu {
  margin-top: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .7rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.label-dd-menu.hidden { display: none; }
.label-dd-menu > input {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .5em .7em; font-size: .85rem;
}
.label-dd-list { display: flex; flex-direction: column; gap: .35rem; max-height: 240px; overflow-y: auto; }
.label-dd-row {
  display: flex; align-items: center; gap: .5rem; width: 100%; border: none; cursor: pointer;
  padding: .55em .7em; border-radius: 6px; font-size: .82rem; font-weight: 600; text-align: left;
  opacity: .78; transition: opacity .12s, outline-color .12s; outline: 2px solid transparent;
}
.label-dd-row:hover { opacity: 1; }
.label-dd-row.active { opacity: 1; outline-color: rgba(255,255,255,.55); }
.label-dd-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-dd-check { flex: none; font-weight: 700; }
.label-dd-edit { flex: none; opacity: .7; padding: 0 .2em; }
.label-dd-edit:hover { opacity: 1; }
.label-dd-new { align-self: flex-start; margin-top: .2rem; }

.label-chip-wrap { display: inline-flex; align-items: center; gap: .25rem; }
.label-chip {
  padding: .35em .8em; border-radius: 14px; font-size: .78rem; font-weight: 600; cursor: pointer;
  opacity: .45;
}
.label-chip.active { opacity: 1; }
.label-edit-btn {
  background: none; border: none; color: var(--text-dim); font-size: .8rem; padding: .2em .3em; border-radius: 4px;
}
.label-edit-btn:hover { color: var(--orange-soft); background: rgba(255,255,255,.06); }

.label-editor {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .9rem;
  display: flex; flex-direction: column; gap: .7rem; margin-bottom: .6rem;
}
.label-editor.hidden { display: none; }
.label-editor input[type=text] {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  padding: .5em .7em; font-size: .88rem; margin-bottom: 0;
}
.label-swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.swatch.active { border-color: #fff; }
.label-color-custom {
  display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--text-dim);
}
.label-color-custom input[type=color] {
  width: 36px; height: 26px; border: 1px solid var(--border); border-radius: 6px; background: none; padding: 0; cursor: pointer;
}
.checklist-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; font-size: .88rem; }
.checklist-row input[type=checkbox] { accent-color: var(--orange); }
.checklist-row.done span { text-decoration: line-through; color: var(--text-dim); }
.checklist-row button { background: none; border: none; color: var(--text-dim); margin-left: auto; }
.checklist-row button:hover { color: var(--danger); }
.checklist-add { display: flex; gap: .5rem; margin-top: .4rem; }
.checklist-add input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .5em .7em;
}
.comment-item { background: var(--bg); border-radius: 6px; padding: .6rem .7rem; margin-bottom: .5rem; font-size: .85rem; }
.comment-item .comment-meta { color: var(--text-dim); font-size: .74rem; margin-bottom: .3rem; }
.comment-add { display: flex; flex-direction: column; gap: .5rem; }
.comment-add textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .5em .7em;
}
.comment-body { line-height: 1.4; word-break: break-word; }
.comment-body a { color: var(--orange-soft); }
.md-img, .comment-body img {
  max-width: 100%; border-radius: 6px; margin-top: .4rem; display: block; border: 1px solid var(--border);
}

/* data concluída */
.due-complete-row { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-dim); margin-top: .6rem; }
.due-complete-row input { accent-color: var(--ok); }

/* checklists nomeados */
.checklist-box { border: 1px solid var(--border); border-radius: 8px; padding: .7rem .8rem; margin-bottom: .8rem; background: var(--bg-card); }
.checklist-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.checklist-name {
  flex: 1; background: transparent; border: none; color: var(--text); font-weight: 600; font-size: .9rem; padding: .2em;
}
.checklist-name:focus { outline: 1px solid var(--border); border-radius: 4px; }
.checklist-prog { font-size: .75rem; color: var(--text-dim); flex: none; }
.checklist-del { background: none; border: none; color: var(--text-dim); flex: none; }
.checklist-del:hover { color: var(--danger); }

/* anexos */
.attachments-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .8rem; }
.attach-empty { color: var(--text-dim); font-size: .85rem; }
.attach-item { display: flex; align-items: center; gap: .7rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .6rem; }
.attach-thumb {
  width: 48px; height: 48px; border-radius: 6px; background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex: none; overflow: hidden; text-decoration: none;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-info { flex: 1; min-width: 0; }
.attach-name { display: block; font-size: .85rem; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-name:hover { color: var(--orange-soft); }
.attach-sub { font-size: .72rem; color: var(--text-dim); }
.attach-del { background: none; border: none; color: var(--text-dim); font-size: 1.1rem; flex: none; }
.attach-del:hover { color: var(--danger); }
.attach-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.attach-upload-btn { cursor: pointer; display: inline-flex; align-items: center; }
.attach-link-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.attach-link-form.hidden { display: none; }
.attach-link-form input {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .5em .7em; font-size: .85rem;
}

.card-modal-footer-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; }
.card-modal-footer-actions .btn-danger { margin-top: 0; }
