*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --bg2: #020617;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #6b7280;
  --accent: #38bdf8;
  --accent2: #0ea5e9;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

/* LAYOUT */
.app {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* SIDEBAR */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.sidebar button:hover,
.sidebar button.active {
  background: var(--bg);
  color: var(--text);
}

/* CONTENT */
.content {
  overflow-y: auto;
  padding: 20px;
}

.view { display: none; }
.view.active { display: block; }

/* OVERVIEW */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.overview-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.overview-card h3 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overview-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overview-card ul li {
  font-size: 13px;
  color: var(--text);
}

.badge {
  background: var(--accent);
  color: var(--bg2);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
}

/* PROGRESS */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  margin: 10px 0 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.4s ease;
}

/* CALENDÁRIO */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 14px;
}

.calendar-header button {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.cal-day {
  min-height: 64px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
}

.cal-day.today {
  border-color: var(--accent);
}

.cal-day .day-num {
  font-weight: 700;
  margin-bottom: 4px;
}

.cal-day .day-event {
  font-size: 10px;
  background: var(--accent);
  color: var(--bg2);
  border-radius: 4px;
  padding: 1px 4px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.events-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

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

.events-panel-header button {
  background: var(--accent);
  border: none;
  color: var(--bg2);
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
}

#events-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#events-list li {
  font-size: 13px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* TAREFAS */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-header button {
  background: var(--accent);
  border: none;
  color: var(--bg2);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filters button {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.filters button.active {
  background: var(--accent);
  color: var(--bg2);
  border-color: var(--accent);
}

.categories-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.categories-summary b {
  color: var(--text);
}

#tasks-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.task-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-item .task-text {
  flex: 1;
}

.task-item .task-text small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.task-item.done .task-text span {
  text-decoration: line-through;
  color: var(--muted);
}

/* IDEIAS */
#ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.idea-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  border-top-width: 3px;
}

.idea-card h4 {
  margin-bottom: 6px;
}

.idea-card p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.idea-card small {
  font-size: 11px;
  color: var(--muted);
}

/* MODAIS */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-box h3 {
  margin-bottom: 4px;
}

.modal-box label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.modal-box input,
.modal-box select,
.modal-box textarea {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.modal-actions button {
  padding: 7px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.modal-actions button:first-child {
  background: var(--accent);
  color: var(--bg2);
}

.btn-secondary {
  background: var(--bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

/* RESPONSIVO */
@media (max-width: 600px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto 1fr;
  }

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .topbar { grid-column: 1; }
}