* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f3f6fb;
  color: #0f172a;
}

.authOverlay {
  position: fixed;
  inset: 0;
  background: #e0f2fe;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.authOverlay.show {
  display: flex;
}

.authCard {
  width: 360px;
  max-width: 92vw;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px;
}

body.authLocked .wrap {
  display: none;
}

.authCard h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.authFields {
  display: grid;
  gap: 8px;
}

.authFields input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
}

.authActions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.authMessage {
  min-height: 18px;
  margin: 8px 0 0;
  color: #b91c1c;
  font-size: 12px;
}

.wrap {
  max-width: 1500px;
  margin: 24px auto;
  padding: 0 16px;
}

.top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.topRow {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brandArea {
  display: flex;
  align-items: center;
  gap: 10px;
}

#projectTitleInput {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 24px;
  font-weight: 700;
  width: 560px;
  max-width: 56vw;
  text-align: center;
  background: #fff;
}

.topActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.titleRow {
  width: 100%;
  display: flex;
  justify-content: center;
}

.actionFooter {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 2px 2px;
}

.logoBox {
  width: 180px;
  height: 96px;
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
}

#logoPreview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

#logoPlaceholder {
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
}

#addActivityBtn {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.secondaryBtn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 1080px;
}

th,
td {
  border: 1px solid #e2e8f0;
  font-size: 12px;
  padding: 6px;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  white-space: normal;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.2px;
}

th:nth-child(3) {
  text-align: center;
}

td:nth-child(3) {
  text-align: left;
  min-width: 170px;
}

th:first-child,
td:first-child {
  min-width: 38px;
  width: 38px;
  padding: 4px;
}

th:nth-child(2),
td:nth-child(2) {
  min-width: 150px;
  width: 150px;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7) {
  min-width: 108px;
  width: 108px;
}

th:nth-child(8),
td:nth-child(8) {
  min-width: 165px;
  width: 165px;
}

td input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  background: #fff;
  margin: 0;
  display: block;
}

.notesCell {
  min-width: 260px;
}

.notesCell textarea {
  width: 100%;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  resize: horizontal;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.3;
  font-family: inherit;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

td.activityCell {
  text-align: left;
  font-weight: 600;
}

td.activityCell.level-1 {
  padding-left: 28px;
}

td.activityCell.level-2 {
  padding-left: 46px;
}

td.activityCell.level-3 {
  padding-left: 64px;
}

td select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 30px 4px 8px;
  font-size: 11px;
  background: #fff;
  background-position: right 8px center;
}

.pctCell {
  min-width: 150px;
}

.pctBtn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 6px;
  padding: 1px 4px;
  font-size: 10px;
  cursor: pointer;
  margin-right: 2px;
}

.pctBtn:last-child {
  margin-right: 0;
}

.pctBtn.is-active {
  background: #0ea5e9;
  border-color: #0284c7;
  color: #fff;
}

.addSubBtn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  line-height: 20px;
  font-weight: 700;
  cursor: pointer;
}

.collapseBtn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 6px;
  width: 20px;
  height: 20px;
  line-height: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 4px;
}

.collapseSpace {
  display: inline-block;
  width: 20px;
  margin-right: 4px;
}

.deleteBtn {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  line-height: 20px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
}

.subRow td {
  background: #fcfdff;
}

.subRow {
  cursor: move;
}

.dragHandle {
  display: inline-block;
  width: 18px;
  text-align: center;
  color: #64748b;
  font-weight: 700;
  user-select: none;
}

.subBracket {
  display: inline-block;
  width: 10px;
  color: #94a3b8;
  font-weight: 700;
}

.dragging td {
  opacity: 0.55;
}

.subRow td:nth-child(2),
.subRow td:nth-child(3),
.subRow td:nth-child(4),
.subRow td:nth-child(5),
.subRow td:nth-child(6),
.subRow td:nth-child(7),
.subRow td:nth-child(8),
.subRow td:nth-child(9),
.subRow td:nth-child(10) {
  padding-left: 18px;
}

.subRow td:nth-child(2) select,
.subRow td.activityCell input,
.subRow td:nth-child(8) input,
.subRow td:nth-child(10) input {
  padding-left: 14px;
}

.statusAuto {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  background: #f8fafc;
  font-weight: 600;
}

/* Quebra visual entre atividades mãe */
.mainRow td {
  border-top-width: 6px;
  border-top-color: #eef2f7;
}

.mainRow td:first-child {
  border-left-width: 4px;
}

/* Cores de identificação por status da atividade */
.mainRow.status-pendente td:first-child {
  border-left-color: #f59e0b;
}

.mainRow.status-iniciado td:first-child {
  border-left-color: #3b82f6;
}

.mainRow.status-aguardando td:first-child {
  border-left-color: #a855f7;
}

.mainRow.status-concluido td:first-child {
  border-left-color: #10b981;
}

.mainRow td.activityCell input {
  background: #f8fbff;
}

.subRow td.activityCell input {
  background: #ffffff;
}

.groupDoneRow td {
  background: #dcfce7;
  border-color: #dcfce7;
}

.groupDoneRow td.activityCell input {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

.readOnlyBanner {
  background: #e0f2fe;
  color: #0c4a6e;
}

.timelinePanel {
  margin-top: 12px;
  padding: 12px;
  overflow-x: auto;
}

.timelineHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.roadmapBlock {
  margin-bottom: 26px;
}

.roadmapTitle {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.roadmapLine {
  display: none;
}

.roadmapGrid {
  position: relative;
  display: grid;
  gap: 14px;
  min-width: max-content;
  padding: 0 4px;
}

.roadmapAxis {
  position: absolute;
  left: 0;
  right: 0;
  top: 112px;
  height: 3px;
  background: #475569;
  z-index: 1;
}

.roadCol {
  position: relative;
  height: 260px;
  z-index: 2;
}

.roadPoint {
  position: absolute;
  left: 50%;
  top: 101px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translateX(-50%);
}

.plannedDot {
  background: #2563eb;
}

.realDot {
  background: #f97316;
}

.roadLabel {
  position: absolute;
  width: 250px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.roadLabel.up {
  top: 0;
}

.roadLabel.down {
  top: 138px;
}

.roadConnector {
  position: absolute;
  left: 50%;
  width: 2px;
  background: #94a3b8;
  transform: translateX(-50%);
}

.roadLabel.up .roadConnector {
  top: 72px;
  height: 30px;
}

.roadLabel.down .roadConnector {
  top: -36px;
  height: 36px;
}

.roadDate {
  font-weight: 700;
  font-size: 12px;
  background: #fff;
  border: 1px solid #dbeafe;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 3px 6px;
}

.roadText {
  font-size: 11px;
  text-align: left;
  background: #fff;
  border: 1px solid #dbeafe;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 4px 6px;
  line-height: 1.3;
}

.roadItem {
  white-space: normal;
  word-break: break-word;
  margin-bottom: 2px;
}

.roadStatus {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  margin-right: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.roadStatus.status-pendente {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.roadStatus.status-iniciado {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.roadStatus.status-aguardando {
  background: #f3e8ff;
  border-color: #d8b4fe;
  color: #6b21a8;
}

.roadStatus.status-concluido {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

td.dateLate {
  background: #fee2e2;
}

td.dateSoon {
  background: #fef9c3;
}
