.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(47, 39, 22, 0.05);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 8px;
}

.panel-heading img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--font-secondary);
  font-size: 1rem;
}

.table-wrap {
  overflow: visible;
  padding: 0 14px 14px;
}

.pp-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.pp-table th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pp-table th,
.pp-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.check-cell {
  width: 30px;
}

.small-check {
  width: 16px;
  height: 16px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-soft);
}

.delete-cell {
  width: 96px;
  text-align: right;
  white-space: nowrap;
}

.delete-row,
.edit-row {
  height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 8px;
}

.delete-row {
  width: 28px;
  padding: 0;
  border-radius: 50%;
  color: #9d3a32;
}

.actions-table .action-cell {
  width: auto;
}

.actions-table .priority-cell {
  width: 58px;
  text-align: center;
}

.assignments-table .assignment-cell {
  width: 34%;
}

.assignments-table .date-cell {
  width: 96px;
}

.assignments-table .note-cell {
  width: auto;
}

.assignments-table .priority-cell {
  width: 56px;
  text-align: center;
}

.pp-table .priority-cell {
  padding-left: 4px;
  padding-right: 4px;
}

.pp-table .delete-cell {
  padding-left: 2px;
  padding-right: 4px;
}

.delete-row:hover,
.edit-row:hover {
  color: var(--green);
  background: var(--paper-soft);
  border-color: var(--line);
}

.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 12px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--green);
  cursor: pointer;
}

.text-action:hover {
  border-color: var(--gold);
}

.idea-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.idea-item {
  position: relative;
  padding: 12px 44px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.idea-item p {
  margin: 0 0 8px;
  color: var(--green);
  white-space: pre-wrap;
}

.idea-item time {
  color: var(--muted);
  font-size: 0.78rem;
}

.idea-item button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--green);
  cursor: pointer;
}

.empty-state {
  color: var(--muted);
  margin: 0;
}

.priority-control {
  position: relative;
  display: inline-grid;
}

.priority-trigger,
.priority-popover button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.priority-trigger:hover {
  border-color: var(--line);
}

.priority-dot {
  width: 11px;
  height: 11px;
  display: block;
  border-radius: 50%;
}

.priority-red {
  background: #c84b43;
}

.priority-yellow {
  background: #d9a21b;
}

.priority-green {
  background: #3d8b60;
}

.priority-popover {
  position: absolute;
  z-index: 8;
  top: 31px;
  left: 50%;
  display: none;
  grid-template-columns: repeat(3, 28px);
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.priority-control.is-open .priority-popover {
  display: grid;
}

.pp-form {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
}

.pp-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pp-field {
  display: grid;
  gap: 5px;
  color: var(--green-soft);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pp-field-full {
  grid-column: 1 / -1;
}

.pp-field label {
  color: var(--green-soft);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pp-field input,
.pp-field select,
.pp-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--green);
  padding: 9px 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.pp-field textarea {
  min-height: 96px;
  resize: vertical;
}

.pp-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pp-mini-button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--green);
  cursor: pointer;
  text-decoration: none;
}

.pp-mini-button:hover {
  border-color: var(--gold);
}

.pp-mini-button.danger {
  color: #9d3a32;
}

.pp-list {
  display: grid;
  gap: 10px;
}

.pp-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 12px;
}

.pp-record strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
}

.pp-record h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.pp-record p {
  margin: 0 0 8px;
  color: var(--green-soft);
}

.pp-record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pp-workbench {
  display: grid;
  gap: 16px;
}

.copy-box {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  color: var(--green);
  padding: 12px;
  resize: vertical;
}

.pp-inline-input {
  min-height: 34px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--green);
  padding: 6px 9px;
}

.construction-list {
  margin: 12px 0 0;
  color: var(--green-soft);
}

.backup-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.backup-panel h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.backup-panel input[type="file"] {
  max-width: 100%;
  font-size: 0.82rem;
}

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

  .pp-record {
    grid-template-columns: 1fr;
  }
}

/* ── Lembretes & Atribuições — itens concluídos ── */
tr.is-done td { opacity: 0.55; }
tr.is-done [data-edit-id] { text-decoration: line-through; color: var(--muted); }
tr.done-separator td { padding: 4px 8px; font-size: 0.72rem; color: var(--muted); border: none; text-align: center; letter-spacing: 0.05em; pointer-events: none; }

/* ── Prioridade sem bolinha ── */
.priority-none { background: transparent; border: 1.5px solid var(--muted); }

/* ── Edição inline ── */
[data-edit-id] { cursor: text; display: block; border-radius: 3px; padding: 1px 3px; margin: -1px -3px; outline: none; }
[data-edit-id]:hover:not([contenteditable="true"]) { background: var(--paper-soft); }
[data-edit-id][contenteditable="true"] { background: var(--paper-soft); outline: 2px solid rgba(184, 138, 45, 0.45); outline-offset: 1px; }

/* ── Ver mais link no panel-heading ── */
.ver-mais-link { margin-left: auto; font-size: 0.78rem; color: var(--green-soft); border-bottom: 1px solid transparent; white-space: nowrap; }
.ver-mais-link:hover { border-color: var(--gold); color: var(--green); }

/* ── Oficina: seção lembretes/atribuições ── */
.la-section-title { font-size: 0.88rem; font-weight: 700; color: var(--green-soft); margin: 12px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.la-tab-btn.is-active { border-color: var(--gold); background: var(--green); color: var(--surface-strong); }

/* ─── Células editáveis de Atribuições ─────────────────────────────────── */

/* Span editável com borda visível (used in assignments-table) */
.assignments-table .atr-field {
  display: block;
  width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font-size: 0.86rem;
  cursor: text;
  transition: border-color 120ms, background 120ms;
  outline: none;
  box-sizing: border-box;
}

.assignments-table .atr-field:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-size: 0.80rem;
}

.assignments-table .atr-field:hover:not([contenteditable="true"]) {
  border-bottom-color: var(--green-soft) !important;
}

.assignments-table .atr-field[contenteditable="true"] {
  border: 1px solid var(--gold) !important;
  border-radius: var(--radius) !important;
  background: var(--paper-soft) !important;
  outline: none;
}

.assignments-table .atr-field.is-done {
  text-decoration: line-through;
  opacity: 0.55;
}

/* Célula de ações em atribuições: prioridade + X juntos */
.atr-actions-cell {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

/* Célula de ações em lembretes: td fica como table-cell,
   conteúdo se alinha à direita com text-align + inline-flex nos filhos */
.lembrete-actions-cell {
  display: table-cell !important; /* nunca sobrescrever com flex */
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
  width: 1%;            /* colapsar ao mínimo necessário */
  padding: 6px 10px 6px 6px;
}

/* Filhos como inline-flex para participar do text-align: right */
.lembrete-actions-cell .priority-control {
  display: inline-flex;
  vertical-align: middle;
}

.lembrete-actions-cell .delete-row {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 5px;
}

/* Atribuições: mesma abordagem */
.atr-actions-cell {
  display: table-cell !important;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
  width: 1%;
  padding: 4px 10px 4px 6px;
}

.atr-actions-cell .priority-control {
  display: inline-flex;
  vertical-align: middle;
}

.atr-actions-cell .delete-row {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 5px;
}

/* Tamanho das colunas na tabela de atribuições */
.assignments-table .assignment-cell { width: 32%; }
.assignments-table .date-cell        { width: 15%; }
.assignments-table .note-cell        { width: 38%; }
.assignments-table .delete-cell      { width: 15%; }

/* ─── Painéis home (Lembrete + Atribuições): diferenciação visual ───────── */

.home-panels .panel {
  background: var(--surface-strong);     /* #fffdf8 — quase branco, vs. cards #fffaf0 */
  border-color: rgba(71, 102, 92, 0.22); /* borda com toque verde */
}

.home-panels .panel-heading {
  background: transparent;
  padding-bottom: 10px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(71, 102, 92, 0.14);
}

.home-panels .panel-heading h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--green);
}

/* ─── CORREÇÕES v10 ─────────────────────────────────────────────────────── */

/* X e bolinha: centralização vertical garantida */
.delete-row {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
}

/* Células editáveis: texto quebra, linha expande */
.actions-table td,
.assignments-table td {
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: break-word;
}

.action-cell [data-edit-id],
.assignment-cell .atr-field,
.note-cell .atr-field {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Placeholder reaparecer quando campo fica vazio (CSS :empty) */
[data-edit-id]:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-size: 0.86rem;
  pointer-events: none;
}

.atr-field:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-size: 0.86rem;
  pointer-events: none;
}

/* Accordion de lembretes concluídos */
.done-accordion {
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.done-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-family: var(--font-primary);
}

.done-accordion-header:hover { color: var(--green-soft); }

.done-chevron {
  display: inline-block;
  transition: transform 180ms;
  font-size: 1rem;
  line-height: 1;
}

.done-accordion-header[aria-expanded="true"] .done-chevron {
  transform: rotate(90deg);
}

.done-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-top: 1px solid var(--line);
  opacity: 0.6;
}

.done-item-text {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  color: var(--muted);
  text-decoration: line-through;
  word-break: break-word;
}

.done-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Células de ações nos dois boxes: garante table-cell + alinhamento correto */
.lembrete-actions-cell,
.atr-actions-cell {
  display: table-cell !important;
  vertical-align: middle !important;
  text-align: right;
  white-space: nowrap;
  width: 1%;
  padding: 6px 10px 6px 6px;
}

/* ─── CORREÇÕES v11: lembrete-actions-cell e data ──────────────────────── */

/* Lembrete: célula de ações com largura explícita (não 1% que colapsa) */
.lembrete-actions-cell {
  width: 72px !important;   /* fixa: cabe bolinha (28px) + gap (6px) + X (28px) + padding */
}

/* Data: não quebrar linha — override do word-break global nos td */
.assignments-table .date-cell,
.assignments-table .date-cell .atr-field {
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  width: 108px !important;  /* espaço certo para dd/mm/aaaa com padding */
}

/* ─── v12: botões Adicionar + Cancelar alinhados no form ─────────────────── */
.pp-actions-row .text-action {
  margin-top: 0;        /* cancela o margin-top: 12px global do .text-action */
  min-height: 34px;
}

.pp-actions-row .pp-mini-button {
  min-height: 34px;     /* iguala a altura ao .text-action */
  display: inline-flex;
  align-items: center;
}

/* ─── v16: fundo e bordas dos painéis Lembrete / Atribuições ──────────────── */
.home-panels .panel {
  background: var(--paper-soft) !important;  /* #fbf7ee — creme quente, distinto do branco */
  border: 1.5px solid rgba(71, 102, 92, 0.28) !important; /* borda verde sutil */
  box-shadow: 0 6px 18px rgba(47, 39, 22, 0.07) !important;
}

.home-panels .panel-heading {
  border-bottom: 1px solid rgba(71, 102, 92, 0.12) !important;
}

/* Ícones dos painéis: tamanho e alinhamento correto */
.home-panels .panel-heading img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ─── v17: painéis com borda dourada para diferenciação clara ─────────────── */
.home-panels .panel {
  background: var(--paper-soft) !important;   /* #fbf7ee — creme quente */
  border: 2px solid var(--gold) !important;   /* #b88a2d — dourado, distinção visual */
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(184, 138, 45, 0.10) !important;
}

.home-panels .panel-heading {
  border-bottom: 1px solid var(--gold-soft) !important; /* linha dourada clara */
}

.home-panels .panel-heading img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
