* {
  box-sizing: border-box;
}

:root {
  --accent: #1877f2;
  --accent-dark: #0f5fd1;
  --bg: #16171a;
  --bg-soft: #1f2024;
  --sidebar-bg: #0e0f11;
  --border: rgba(255, 255, 255, 0.08);
  --ink: #ffffff;
  --muted: #9a9ea6;
  --font: "Poppins", "Century Gothic", "Trebuchet MS", "Segoe UI", Verdana, Helvetica, Arial, sans-serif;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

#app {
  display: flex;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
#sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

#sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 18px;
  font-weight: 800;
  font-size: 14px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

#sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.nav-item--active {
  background: rgba(24, 119, 242, 0.16);
  color: #ffffff;
}

.nav-item--active svg {
  color: var(--accent);
}

#sidebar-footer {
  padding: 14px 18px;
  font-size: 11px;
  color: #5a5d64;
  border-top: 1px solid var(--border);
}

#bridge-status {
  color: var(--muted);
  margin-bottom: 8px;
}

#bridge-status.bridge-status--on {
  color: #4ade80;
}

#import-btn {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
}

#import-btn:hover:not(:disabled) {
  background: rgba(24, 119, 242, 0.18);
  border-color: var(--accent);
  color: #8fbaf9;
}

#import-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- main ---------- */
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

#main-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  margin: 0;
}

.count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#header-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
}

#header-actions button:hover {
  background: rgba(24, 119, 242, 0.18);
  border-color: var(--accent);
  color: #8fbaf9;
}

#content-body {
  flex: 1;
  padding: 24px 32px 60px;
  width: 100%;
}

.empty-state {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.empty-state svg {
  color: #3a3b40;
  margin-bottom: 12px;
}

/* ---------- grade de ofertas (3 blocos por fileira) ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

@media (max-width: 1500px) {
  .dash-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1200px) {
  .dash-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: grab;
  display: flex;
  flex-direction: column;
}

.dash-card--dragging {
  opacity: 0.4;
}

.dash-card-media {
  position: relative;
}

.dash-thumb {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: #2a2b30;
}

.dash-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.dash-drag-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.dash-photo-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dash-photo-btn:hover {
  background: var(--accent);
}

.dash-card--waiting-paste .dash-photo-btn {
  background: var(--accent);
}

.dash-paste-hint {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  background: rgba(24, 119, 242, 0.55);
}

.dash-card--waiting-paste .dash-paste-hint {
  display: flex;
}

.dash-card--waiting-paste {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.dash-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dash-page {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-days {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #c7ccd4;
  background: #2a2b30;
  border-radius: 999px;
  padding: 2px 8px;
}

.dash-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.dash-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.dash-actions a,
.dash-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.dash-actions a:hover,
.dash-actions button:hover {
  background: rgba(24, 119, 242, 0.18);
  border-color: var(--accent);
  color: #8fbaf9;
}

.dash-actions .dash-remove {
  margin-left: auto;
  color: #ff8080;
  border-color: rgba(255, 90, 90, 0.3);
}

.dash-actions .dash-remove:hover {
  background: rgba(255, 90, 90, 0.14);
  border-color: #ff6b6b;
  color: #ff8080;
}

.dash-actions .dash-goto-empty {
  border-style: dashed;
  color: var(--muted);
}

.dash-actions .dash-goto-empty:hover {
  color: #8fbaf9;
}

.dash-actions .dash-edit {
  padding: 5px 7px;
}

/* ---------- view "Páginas de Ofertas" ---------- */
.pages-add-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.pages-add-box textarea {
  flex: 1;
  min-height: 70px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 12px;
  padding: 10px;
}

.pages-add-box textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.pages-add-box button {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.pages-add-box button:hover {
  background: var(--accent-dark);
}

.idea-add-box {
  flex-direction: column;
  align-items: stretch;
}

.idea-add-box input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
}

.idea-add-box input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.idea-add-box button {
  align-self: flex-end;
}

/* ---------- view "Ideias de Ofertas" ---------- */
.idea-card-body {
  position: relative;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.idea-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 22px;
  margin-bottom: 6px;
}

.idea-title {
  font-weight: 800;
  font-size: 13px;
  word-break: break-word;
}

.idea-notes {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-notes--empty {
  font-style: italic;
  opacity: 0.7;
}

.idea-card .dash-rank {
  position: static;
  flex-shrink: 0;
}

.idea-card .dash-drag-handle {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  color: var(--muted);
}

.idea-card-body--edit {
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.idea-edit-title {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  padding: 8px;
}

.idea-edit-notes {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 12px;
  padding: 8px;
  min-height: 90px;
  resize: vertical;
}

.idea-edit-title:focus,
.idea-edit-notes:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.page-card-body {
  position: relative;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.page-domain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 22px;
  margin-bottom: 6px;
}

.page-domain {
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-url {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 12px;
}

.page-card .dash-rank {
  position: static;
  flex-shrink: 0;
}

.page-card .dash-drag-handle {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  color: var(--muted);
}

.count-badge:empty {
  display: none;
}

/* ---------- view "Meta Semanal" ---------- */
.goals-setup {
  max-width: 420px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.goals-setup h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.goals-setup p {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.goals-setup-row {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.goals-setup-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.goals-setup-row input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 10px;
}

.goals-setup-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.goals-setup button,
.goals-header-actions button {
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.goals-setup button:hover,
.goals-header-actions button:hover {
  background: var(--accent-dark);
}

.goals-header-actions #goals-edit-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--ink);
}

.goals-header-actions #goals-edit-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.goals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.goals-week-range {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 4px;
}

.goals-progress-label {
  font-size: 12px;
  color: var(--muted);
}

.goals-header-actions {
  display: flex;
  gap: 8px;
}

.goals-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
  margin-bottom: 24px;
}

.goals-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4ade80);
  transition: width 0.25s ease;
}

.goals-offers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.goal-offer-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.goal-offer-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.goal-offer-label {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 800;
  font-size: 13px;
  padding: 2px 0;
}

.goal-offer-label:hover,
.goal-offer-label:focus {
  border-bottom-color: var(--border);
  outline: none;
}

.goal-offer-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #c7ccd4;
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 9px;
}

.goal-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.goal-check {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.goal-check:hover {
  border-color: var(--accent);
  color: #8fbaf9;
}

.goal-check--on {
  background: linear-gradient(135deg, var(--accent), #4ade80);
  border-color: transparent;
  color: #fff;
}

.goals-history {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.goals-history h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}

.goals-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.goals-history-row {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 8px 12px;
}
