:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  background: #f3f5f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}
[hidden] { display: none !important; }
.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: #f3f5f8; }
.login-form { width: min(100%, 360px); display: grid; gap: 18px; }
.login-form h1 { font-size: 28px; margin: 0; }
.login-form h2 { font-size: 18px; margin: 0 0 8px; color: #53616b; }
.login-form input { width: 100%; }
#login-error, #catalog-error { color: #a32940; font-size: 14px; }
.invite-summary {
  background: #e9f2f2;
  border: 1px solid #c4d8d8;
  border-radius: 6px;
  color: #174f50;
  font-size: 14px;
  margin: -4px 0 0;
  padding: 10px 12px;
}
#breadcrumbs { font-size: 14px; overflow-wrap: anywhere; }
#breadcrumbs a { color: #216869; }
.catalog { max-width: 1280px; margin: 0 auto; padding: 32px 20px; }
.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.catalog-heading h2 { font-size: 24px; overflow-wrap: anywhere; min-width: 0; }
.catalog-heading form { display: flex; gap: 8px; }
.catalog-heading form input { width: min(280px, 42vw); }
.catalog-row { display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid #d7dde7; padding: 20px 8px; color: #17202a; text-decoration: none; }
.catalog-row:hover { background: #e3eded; }
.catalog-row strong { min-width: 0; overflow-wrap: anywhere; }
.catalog-row span { color: #53616b; flex-shrink: 0; font-size: 14px; }
@media (max-width: 720px) { .catalog-heading { align-items: stretch; flex-direction: column; gap: 8px; } .catalog-heading form { flex-wrap: wrap; } .catalog-heading input { flex: 1; min-width: 0; width: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar { flex-shrink: 0; }
.board-filters { flex-shrink: 0; }
.catalog { width: 100%; overflow-y: auto; }
.login-view { overflow-y: auto; }

button,
input,
textarea {
  font: inherit;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d7dde7;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 20px;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 4px;
}

#status {
  color: #667085;
  font-size: 13px;
}

.board-filters {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d7dde7;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 0.75fr) repeat(4, minmax(130px, 180px)) minmax(300px, auto);
  padding: 10px 18px;
}

.board-filters select {
  background: #ffffff;
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #17202a;
  min-height: 38px;
  padding: 8px 10px;
}

.board-filters form {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 1fr) auto;
  min-width: 0;
}

.board-filters input {
  min-width: 0;
}

.topbar form {
  display: flex;
  gap: 8px;
}

input[type=color] {
  cursor: pointer;
  min-height: 38px;
  padding: 3px;
  width: 44px;
}

input,
textarea {
  background: #ffffff;
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #17202a;
  min-height: 38px;
  padding: 8px 10px;
}

button {
  background: #216869;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 12px;
}

button:hover {
  background: #174f50;
}

.board {
  align-items: flex-start;
  display: grid;
  gap: 16px;
  grid-auto-columns: minmax(280px, 320px);
  grid-auto-flow: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  min-width: 0;
  grid-template-rows: minmax(0, 1fr);
  overflow: auto hidden;
  padding: 18px 18px 30px;
}

.board {
  scrollbar-width: none;
}

.board::-webkit-scrollbar {
  display: none;
}

.board-scrollbar {
  background: #e7ebf0;
  border-top: 1px solid #cfd7e3;
  bottom: 0;
  height: 18px;
  left: 0;
  overflow-x: auto;
  overflow-y: hidden;
  position: fixed;
  right: 0;
  z-index: 30;
  scrollbar-width: auto;
  scrollbar-color: #7a8995 #e7ebf0;
}

.board-scrollbar > div {
  height: 1px;
}

.board-scrollbar::-webkit-scrollbar {
  height: 16px;
}

.board-scrollbar::-webkit-scrollbar-track {
  background: #e7ebf0;
}

.board-scrollbar::-webkit-scrollbar-thumb {
  background: #7a8995;
  border: 2px solid #e7ebf0;
  border-radius: 6px;
}

.cards {
  scrollbar-width: auto;
  scrollbar-color: #7a8995 #e7ebf0;
}
.cards::-webkit-scrollbar { width: 12px; height: 12px; }
.cards::-webkit-scrollbar-track { background: #e7ebf0; }
.cards::-webkit-scrollbar-thumb {
  background: #7a8995;
  border: 2px solid #e7ebf0;
  border-radius: 6px;
}

.list {
  background: var(--list-color, #e7ebf0);
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  max-height: 100%;
  min-height: 180px;
  min-width: 0;
  overflow: hidden;
}

.list header {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto 28px 28px 28px;
  padding: 12px;
}

.list h2 {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  margin: 0;
}

.list-name {
  background: transparent;
  border-color: transparent;
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  padding: 4px 0;
  width: 100%;
}

.list-name:focus {
  background: #ffffff;
  border-color: #c9d2df;
  padding: 4px 8px;
}

.list header { cursor: grab; }
.list header button {
  padding: 0;
  background: transparent;
  color: #216869;
  font-size: 20px;
  min-height: 30px;
  width: 28px;
}
.list header button:hover { background: #d0dedf; }
.delete-list { color: #a32940 !important; }
button:disabled { opacity: 0.35; cursor: default; }
.dragging-list { opacity: 0.45; }
.list-drop-before { border-left: 4px solid #216869; }
.list-drop-after { border-right: 4px solid #216869; }

.wip {
  color: #667085;
  font-size: 12px;
}

.cards {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  min-width: 0;
  overflow-y: auto;
  padding: 0 12px 10px;
  width: 100%;
}

.cards.drag-over {
  outline: 2px solid #216869;
  outline-offset: -4px;
}

.card {
  align-self: center;
  background: var(--card-color, #ffffff);
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  cursor: grab;
  /* A coluna e um flex container: sem isto o card encolhe quando a coluna
     enche e o overflow abaixo corta o titulo. Com 0, o card mantem a altura
     do proprio conteudo e quem rola e a coluna. */
  flex-shrink: 0;
  margin-inline: auto;
  max-width: 100%;
  min-height: 82px;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
  width: 100%;
}

.card-topline {
  align-items: start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 6px;
  min-width: 0;
}

.card-quick-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
}

.card-icon-button {
  align-items: center;
  background: #eef3f5;
  border: 1px solid #cad5de;
  border-radius: 6px;
  color: #44515c;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  line-height: 1;
  min-height: 26px;
  padding: 0;
  width: 26px;
}

.card-icon-button:hover,
.card-icon-button.has-value {
  background: #216869;
  border-color: #216869;
  color: #ffffff;
}

.quick-popover {
  background: #ffffff;
  border: 1px solid #c9d2df;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
  display: grid;
  gap: 6px;
  max-height: 320px;
  max-width: min(280px, calc(100vw - 16px));
  min-width: 220px;
  overflow-y: auto;
  padding: 10px;
  position: fixed;
  z-index: 80;
}

.quick-popover strong {
  font-size: 13px;
  margin-bottom: 2px;
}

.quick-option {
  align-items: center;
  background: #ffffff;
  border: 1px solid transparent;
  color: #17202a;
  display: grid;
  font-weight: 600;
  gap: 8px;
  grid-template-columns: 14px minmax(0, 1fr);
  justify-content: start;
  min-height: 34px;
  padding: 6px 8px;
  text-align: left;
}

.quick-option:hover,
.quick-option.selected {
  background: #e9f2f2;
  border-color: #c4d8d8;
}

.quick-option-marker {
  background: #c7d0da;
  border: 1px solid rgba(23, 32, 42, 0.18);
  border-radius: 50%;
  height: 12px;
  width: 12px;
}

.quick-option.selected .quick-option-marker {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #216869;
}

.quick-empty {
  color: #667085;
  font-size: 13px;
  padding: 6px 2px;
}

.card-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.pill {
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 4px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card:active {
  cursor: grabbing;
}

.card h3 {
  font-size: 14px;
  line-height: 1.3;
  margin: 0 0 8px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card p {
  color: #475467;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card footer {
  color: #667085;
  font-size: 11px;
  margin-top: 10px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.due-date {
  color: #8a4b00;
  display: block;
  font-size: 12px;
  margin-top: 8px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.due-date.overdue {
  color: #b32626;
  font-weight: 700;
}

.add-card {
  background: transparent;
  color: #216869;
  margin: 0 10px 10px;
}

dialog {
  border: 1px solid #c9d2df;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.25);
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px;
}

#card-dialog {
  width: 85vw;
}

#card-dialog form {
  gap: 16px;
}

.card-dialog-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  min-height: 0;
}

.card-dialog-main,
.card-dialog-side {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.card-dialog-side {
  align-self: start;
  background: #f7f9fb;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  padding: 14px;
}

.description-field { min-width: 0; }
.card-meta-edit {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.card-meta-edit select,
.admin-add select,
#user-dialog select {
  background: #ffffff;
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #17202a;
  min-height: 38px;
  padding: 8px 10px;
}
.card-meta-edit fieldset {
  border: 1px solid #c9d2df;
  border-radius: 6px;
  margin: 0;
  min-width: 0;
  padding: 8px 10px;
}
.card-meta-edit legend {
  font-size: 13px;
  font-weight: 650;
}
#card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#card-assignees {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.label-check {
  align-items: center;
  background: #f3f5f8;
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  padding: 4px 8px;
}
.label-check input {
  min-height: 16px;
  width: 16px;
}
.description-field > label { margin-bottom: 8px; }
.ql-toolbar.ql-snow { border-radius: 6px 6px 0 0; background: #f3f5f8; }
.ql-container.ql-snow { height: auto; font: inherit; border-radius: 0 0 6px 6px; }
.ql-editor { min-height: 180px; max-height: 240px; overflow-y: auto; font-size: 14px; overflow-wrap: anywhere; }
.ql-editor img { max-width: 100%; max-height: 360px; object-fit: contain; }
.ql-toolbar button { min-height: 28px; border-radius: 2px; }
.ql-snow .ql-tooltip { left: 0 !important; white-space: normal; max-width: 100%; }
.subtasks-heading { display: flex; align-items: center; justify-content: space-between; }
.subtasks-heading h3 { font-size: 15px; margin: 8px 0; }
#subtask-progress { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
#subtask-bar {
  --progress-color: #b32626;
  --progress-track: #f7dede;
  appearance: none;
  border: 1px solid var(--progress-color);
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
  height: 12px;
  background: var(--progress-track);
  display: block;
  margin-bottom: 12px;
}
#subtask-bar::-webkit-progress-bar { background: var(--progress-track); }
#subtask-bar::-webkit-progress-value { background: var(--progress-color); }
#subtask-bar::-moz-progress-bar { background: var(--progress-color); }
.subtask-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 32px 32px; align-items: center; gap: 8px; margin-bottom: 6px; }
.convert-subtask { padding: 0; background: transparent; color: #216869; font-size: 24px; }
.convert-subtask:hover { background: #dceeed; }
.card-code {
  color: #53616b;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.subtask-row input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: #268026; cursor: pointer; }
.subtask-row input:checked + input { text-decoration: line-through; color: #667085; }
.subtask-row input { min-width: 0; }
.remove-subtask { padding: 0; color: #a32940; background: transparent; font-size: 24px; }
.remove-subtask:hover { background: #fce8ec; }
.subtask-add { display: flex; gap: 8px; }
.subtask-add input { min-width: 0; flex: 1; }
#card-feedback { font-size: 13px; color: #9c3540; margin: 0; overflow-wrap: anywhere; }
#card-form menu { position: sticky; bottom: -1px; background: white; padding: 12px 0 0; z-index: 2; }
.card p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.card:focus-visible { outline: 2px solid #216869; }
.card-subtasks {
  display: block;
  color: #216869;
  font-size: 12px;
  margin-top: 8px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  word-break: break-word;
}
@media (max-width: 520px) { dialog { padding: 16px; } .ql-toolbar.ql-snow .ql-formats { margin-right: 5px; } }

.comments-section h3 { font-size: 15px; margin: 8px 0; }
#card-comments {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.comment {
  border-left: 3px solid #cfd7e3;
  padding: 6px 8px;
}
.comment strong {
  display: block;
  font-size: 12px;
}
.comment p {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.admin-grid {
  display: grid;
  gap: 18px;
}

#board-admin-dialog {
  width: 85vw;
}

#board-admin-form {
  gap: 16px;
}

#board-admin-form menu {
  background: #ffffff;
  bottom: -1px;
  padding-top: 12px;
  position: sticky;
  z-index: 2;
}

#board-admin-dialog .admin-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.admin-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-section {
  background: #fbfcfd;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
}

.admin-grid h3 {
  font-size: 15px;
  margin: 0;
}
.admin-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dde7;
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 44px 76px;
  padding: 8px;
}
.admin-row input,
.admin-row select {
  min-width: 0;
}

#board-admin-dialog .admin-row select {
  background: #ffffff;
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #17202a;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

#board-admin-dialog .admin-row button,
#board-admin-dialog .admin-add button {
  white-space: nowrap;
}
.admin-row button {
  background: #a32940;
}
.admin-add {
  background: #f3f6f8;
  border: 1px dashed #c9d2df;
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 44px auto;
  margin-top: 2px;
  padding: 8px;
}

.invite-box {
  background: #f3f6f8;
  border: 1px dashed #c9d2df;
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.invite-row,
.invite-result {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 130px 110px auto;
}

.project-admin .invite-row {
  grid-template-columns: minmax(0, 1fr) 120px auto;
}

.invite-result {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.invite-row select {
  background: #ffffff;
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #17202a;
  min-height: 38px;
  padding: 8px 10px;
}

.button-link {
  align-items: center;
  background: #216869;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.button-link:hover {
  background: #174f50;
}

#board-admin-dialog .admin-add {
  margin-top: 10px;
}
.admin-row.admin-list-row {
  grid-template-columns: minmax(0, 1fr) 90px 44px;
}

.admin-list-wip {
  width: 90px;
}

.admin-metadata-row {
  grid-template-columns: minmax(0, 1fr) 44px 82px;
}

.admin-member-row,
#admin-board-members + .admin-add {
  grid-template-columns: minmax(0, 1fr) 120px 104px;
}

#admin-lists,
#admin-statuses,
#admin-labels,
#admin-board-members {
  display: grid;
  gap: 8px;
}
.project-admin {
  display: grid;
  gap: 14px;
}
.project-admin h3 {
  font-size: 16px;
  margin: 0;
}
.project-member-add,
.create-user-add,
#project-members .admin-row,
#admin-board-members .admin-row,
#admin-board-members + .admin-add {
  grid-template-columns: minmax(0, 1fr) 120px 104px;
}

.create-user-action {
  background: #f3f6f8;
  border: 1px dashed #c9d2df;
  border-radius: 6px;
  padding: 8px;
}

.create-user-action button {
  width: 100%;
}

#user-dialog {
  width: min(420px, calc(100vw - 32px));
}

#user-dialog .invite-result {
  grid-template-columns: 1fr;
}

#user-feedback {
  color: #a32940;
  font-size: 13px;
  margin: 0;
  overflow-wrap: anywhere;
}

.project-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  margin-top: 20px;
}

.project-workspace,
.project-side {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.project-panel,
.project-admin > h3,
.project-admin > #project-members,
.project-admin > .admin-add,
.project-admin > .invite-box {
  min-width: 0;
}

.project-panel,
.project-admin {
  background: #fbfcfd;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  padding: 14px;
}

.project-panel h3 {
  font-size: 16px;
  margin: 0 0 10px;
}

.project-board-list,
.project-tool-list,
#project-members {
  display: grid;
  gap: 8px;
}

.project-tool-list {
  min-height: 82px;
}

.project-board-row {
  background: #ffffff;
  border: 1px solid #d7dde7;
  border-radius: 6px;
  padding: 14px 12px;
}

.project-admin > h3:not(:first-child) {
  border-top: 1px solid #d7dde7;
  padding-top: 14px;
}
#admin-activity {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.activity-row {
  background: #ffffff;
  border: 1px solid #d7dde7;
  border-left: 3px solid #216869;
  border-radius: 6px;
  padding: 8px 10px;
}
.activity-row small {
  color: #667085;
  display: block;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

dialog form {
  display: grid;
  gap: 12px;
}

dialog h2 {
  font-size: 18px;
  margin: 0;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

menu {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 4px 0 0;
  padding: 0;
}

menu button:first-child {
  background: #d7dde7;
  color: #17202a;
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar form {
    flex-direction: column;
  }

  .board-filters {
    grid-template-columns: 1fr;
  }

  .board {
    grid-auto-columns: minmax(260px, 86vw);
  }

  .card-meta-edit,
  .admin-add,
  .invite-row,
  .invite-result,
  #admin-board-members .admin-row,
  #admin-board-members + .admin-add {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #card-dialog {
    width: calc(100vw - 32px);
  }

  .card-dialog-layout {
    grid-template-columns: 1fr;
  }

  #board-admin-dialog {
    width: calc(100vw - 32px);
  }

  #board-admin-dialog .admin-grid {
    grid-template-columns: 1fr;
  }

  .project-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Wiki ---------- */

.wiki {
  display: grid;
  flex: 1;
  gap: 16px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  min-height: 0;
  padding: 18px 18px 30px;
  width: 100%;
}

.wiki-side {
  background: #e7ebf0;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 12px;
}

.wiki-side-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.wiki-side-head h3 {
  font-size: 15px;
  margin: 0;
  overflow-wrap: anywhere;
}

.wiki-pages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}

.wiki-page-link {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  color: #1d2939;
  cursor: pointer;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.wiki-page-link:hover { background: #f2f5f9; }

.wiki-page-link.active {
  background: #216869;
  border-color: #216869;
  color: #ffffff;
}

#wiki-page-form {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

/* Flex e nao grid: o Quill insere a propria barra de ferramentas como filho,
   entao um grid com numero fixo de linhas desalinha tudo. */
.wiki-main {
  background: #ffffff;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.wiki-main-head,
.wiki-main .ql-toolbar,
#wiki-error {
  flex-shrink: 0;
}

.wiki-main-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
}

#wiki-page-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  min-width: 180px;
}

#wiki-page-meta {
  color: #667085;
  font-size: 12px;
}

/* O editor ocupa a sobra e rola por dentro. */
#wiki-editor {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#wiki-editor .ql-editor {
  font-size: 14px;
  height: 100%;
  overflow-y: auto;
}

#wiki-error { color: #b32626; margin: 8px 0 0; }

@media (max-width: 900px) {
  .wiki {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .wiki-side { grid-template-rows: auto auto auto; }
  .wiki-pages { max-height: 180px; }
}
