:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-light: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --purple: #8b5cf6;
  --purple-soft: #f5f3ff;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px -4px rgba(15, 23, 42, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR & HEADER */
.navbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-info h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.brand-info p {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
}

.nav-tab {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.nav-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-selector-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}

.user-select {
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  outline: none;
  cursor: pointer;
}

/* MAIN CONTAINER */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
  width: 100%;
  flex: 1;
}

/* VIEWS */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* DASHBOARD WELCOME & CARDS */
.welcome-banner {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: var(--radius);
  color: #fff;
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15);
}

.welcome-text h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.welcome-text p {
  color: #94a3b8;
  font-size: 14px;
}

.welcome-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-white {
  background: #fff;
  color: #1e293b;
  border-color: #cbd5e1;
}
.btn-white:hover {
  background: #f8fafc;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

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

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 6px;
}

/* TOOLBAR & SEARCH */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 10px;
  flex: 1;
  min-width: 250px;
}

.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  width: 100%;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background: #f8fafc;
  color: var(--text);
}

.filter-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #bfdbfe;
}

/* BADGES & TAGS */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.3;
}

.badge-private {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-public {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.badge-priority-alta, .badge-priority-urgente {
  background: #fff1f2;
  color: #e11d48;
}

.badge-priority-normal {
  background: #f0f9ff;
  color: #0284c7;
}

.badge-priority-baixa {
  background: #f8fafc;
  color: #64748b;
}

.badge-schedule {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

/* ================================================= */
/* MÓDULO NOTAS: STICKY NOTES AUTO-ADESIVAS */
/* ================================================= */
.notes-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.sticky-note {
  position: relative;
  min-height: 240px;
  border-radius: 4px 4px 18px 4px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  font-family: inherit;
}

.sticky-note:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.sticky-note.pinned {
  transform: rotate(0.8deg);
}
.sticky-note.pinned:hover {
  transform: translateY(-4px) rotate(0.3deg);
}

/* Cores dos Post-its */
.sticky-note.color-yellow { background: #fffde7; border-top: 10px solid #fbc02d; color: #5d4037; }
.sticky-note.color-green  { background: #f1f8e9; border-top: 10px solid #7cb342; color: #33691e; }
.sticky-note.color-blue   { background: #e1f5fe; border-top: 10px solid #039be5; color: #01579b; }
.sticky-note.color-pink   { background: #fce4ec; border-top: 10px solid #e91e63; color: #880e4f; }
.sticky-note.color-purple { background: #f3e5f5; border-top: 10px solid #ab47bc; color: #4a148c; }
.sticky-note.color-orange { background: #fff3e0; border-top: 10px solid #fb8c00; color: #e65100; }

.note-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

.note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.note-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.note-content {
  font-size: 13.5px;
  line-height: 1.5;
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
}

.note-footer {
  margin-top: auto;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.85;
}

.note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.btn-convert-task {
  background: rgba(0, 0, 0, 0.08);
  border: 0;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-convert-task:hover {
  background: rgba(0, 0, 0, 0.16);
}

/* ================================================= */
/* TAREFAS PESSOAIS & NOC */
/* ================================================= */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.task-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.15s ease;
  position: relative;
}

.task-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.task-card.done {
  opacity: 0.75;
  background: #f8fafc;
}

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

.task-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-check-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
}

.custom-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  display: grid;
  place-items: center;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.custom-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.task-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.task-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  white-space: pre-wrap;
}

.task-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.task-footer {
  border-top: 1px solid var(--line-light);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* NOC TABLE / ROWS */
.noc-table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.noc-item {
  display: grid;
  grid-template-columns: 120px 2fr 1.2fr 1.2fr 140px 180px;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-light);
  transition: background 0.15s ease;
  cursor: pointer;
}

.noc-item:last-child {
  border-bottom: 0;
}

.noc-item:hover {
  background: #f8fafc;
}

/* AGENDAMENTOS */
.schedules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.schedule-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 5px solid var(--primary);
}

/* MODAL STYLES */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--panel);
  border-radius: var(--radius);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
  background: transparent;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* FOTOS & DRAG AND DROP */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s;
}

.dropzone:hover, .dropzone.drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.photos-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.photo-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  animation: slideUp 0.2s ease-out;
}

.toast.show {
  display: block;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 900px) {
  .noc-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
