/* ==========================================================================
   Project Dashboard — styles
   Mobile-first, dark theme by default, light theme via .theme-light
   ========================================================================== */

:root {
  --accent: #3b82f6;
  --accent-2: #14b8a6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 248px;
  --topbar-height: 60px;
  --transition: 0.18s ease;
}

/* ---------- Dark theme (default) ---------- */
body.theme-dark {
  --bg: #0f0f1a;
  --bg-elevated: #16161f;
  --panel-bg: rgba(255, 255, 255, 0.035);
  --panel-bg-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #e7e7ee;
  --text-secondary: #9999ac;
  --text-muted: #6b6b80;
  --input-bg: rgba(255, 255, 255, 0.04);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---------- Light theme ---------- */
body.theme-light {
  --bg: #f5f6fa;
  --bg-elevated: #ffffff;
  --panel-bg: #ffffff;
  --panel-bg-hover: #f0f1f7;
  --border: rgba(15, 15, 26, 0.08);
  --text-primary: #1c1c28;
  --text-secondary: #5e5e72;
  --text-muted: #9494a8;
  --input-bg: #ffffff;
  --shadow: 0 8px 24px rgba(15, 15, 26, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }

p { margin: 0; }

.muted { color: var(--text-muted); font-size: 0.85rem; font-weight: 400; }
.text-danger { color: var(--danger); }

/* ---------- Loading bar ---------- */
#loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 9999;
  transition: width 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
#loading-bar.active {
  opacity: 1;
  width: 70%;
}
#loading-bar.done {
  width: 100%;
  opacity: 0;
}

/* ---------- App layout ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 16px;
}

.sidebar-header .logo {
  font-size: 1.5rem;
}

.sidebar-header .logo-text {
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--panel-bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(20, 184, 166, 0.1));
  color: var(--text-primary);
  font-weight: 600;
}

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

.nav-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
}

.sidebar-section {
  margin-top: 18px;
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 12px;
}

.nav-item-area {
  font-size: 0.88rem;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.menu-toggle {
  display: inline-flex;
}

.search-form {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 38px;
  max-width: 420px;
}

.search-form input {
  border: none;
  background: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 100%;
  padding: 0 6px;
}

.search-icon {
  font-size: 0.85rem;
  opacity: 0.6;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.user-chip {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  display: none;
}

/* ---------- Content ---------- */
.content {
  flex: 1;
  padding: 16px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

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

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.breadcrumb {
  margin-bottom: 12px;
}

.breadcrumb a {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-secondary {
  background: var(--panel-bg);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--panel-bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition);
}

.icon-btn:hover {
  background: var(--panel-bg-hover);
}

.icon-btn-sm {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-secondary);
}

.icon-btn-sm:hover {
  background: var(--panel-bg-hover);
  color: var(--text-primary);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-status-active { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-status-paused { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-status-completed { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-status-archived { background: rgba(107, 114, 128, 0.18); color: #9ca3af; }

.badge-priority-alta { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-priority-media { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-priority-baixa { background: rgba(34, 197, 94, 0.12); color: var(--success); }

.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-muted { background: var(--panel-bg); color: var(--text-secondary); border: 1px solid var(--border); }

.area-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.area-icon {
  font-size: 1.1rem;
}

/* ---------- Panels / cards ---------- */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

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

/* ---------- Stats grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform var(--transition), background var(--transition);
}

.stat-card:hover {
  background: var(--panel-bg-hover);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Dashboard grid ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

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

.progress-bar-lg {
  height: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ---------- Deadline list ---------- */
.deadline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deadline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.deadline-item:hover {
  background: var(--panel-bg-hover);
}

.deadline-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.deadline-project {
  font-weight: 600;
  font-size: 0.88rem;
}

.deadline-project:hover {
  color: var(--accent);
}

.deadline-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deadline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.deadline-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------- Continue grid ---------- */
.continue-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.continue-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  transition: border-color var(--transition), transform var(--transition);
}

.continue-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.continue-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.continue-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.continue-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

select, input, textarea {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  outline: none;
  transition: border-color var(--transition);
}

select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
}

select {
  cursor: pointer;
}

/* ---------- Projects grid ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.project-card {
  display: block;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--panel-bg-hover);
}

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

.project-card-title {
  margin-bottom: 6px;
}

.project-card-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-footer {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- Empty states ---------- */
.empty-state {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 24px 12px;
}

.empty-state-block {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.empty-state-block h3 {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.empty-state-block p {
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* ---------- Project detail header ---------- */
.project-header {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.project-header-top {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.project-header h1 {
  margin-bottom: 8px;
}

.project-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.project-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 8px 0 14px;
  align-items: center;
}

.project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ---------- Subphases ---------- */
.subphase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subphase-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color var(--transition);
}

.subphase-item.dragging {
  opacity: 0.4;
}

.subphase-item.drag-over {
  border-color: var(--accent);
}

.subphase-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding-top: 2px;
  user-select: none;
}

.subphase-checkbox {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.subphase-content {
  flex: 1;
  min-width: 0;
}

.subphase-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.subphase-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.subphase-name.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subphase-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin: 4px 0;
}

.subphase-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.subphase-notes {
  font-style: italic;
}

.subphase-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.subphase-status-select {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.subphase-status-select.status-to-do { background: var(--panel-bg); color: var(--text-secondary); }
.subphase-status-select.status-in-progress { background: rgba(59, 130, 246, 0.12); color: var(--accent); border-color: rgba(59,130,246,0.3); }
.subphase-status-select.status-done { background: rgba(34, 197, 94, 0.12); color: var(--success); border-color: rgba(34,197,94,0.3); }
.subphase-status-select.status-blocked { background: rgba(239, 68, 68, 0.12); color: var(--danger); border-color: rgba(239,68,68,0.3); }

.inline-edit-form, .inline-add-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-add-form {
  border-top: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 6px;
}

.hidden {
  display: none !important;
}

.form-row {
  display: flex;
  flex-direction: column;
}

.form-row-cols {
  flex-direction: row;
  gap: 8px;
}

.form-row-cols > * {
  flex: 1;
}

.form-row-actions {
  flex-direction: row;
  gap: 8px;
}

.inline-form {
  display: inline;
}

/* ---------- Attachments / Documentos ---------- */
.upload-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.upload-form input[type="file"] {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
}

.attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  flex-wrap: wrap;
}

.attachment-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 0;
}

.attachment-link:hover {
  color: var(--accent);
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ---------- AI Insights panel ---------- */
.insights-panel {
  margin-bottom: 16px;
}

.insights-content {
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 12px;
}

.insights-content h1,
.insights-content h2,
.insights-content h3 {
  margin: 14px 0 6px;
  font-size: 0.95rem;
}

.insights-content h1:first-child,
.insights-content h2:first-child,
.insights-content h3:first-child {
  margin-top: 0;
}

.insights-content p {
  margin: 0 0 8px;
}

.insights-content ul,
.insights-content ol {
  margin: 0 0 8px;
  padding-left: 22px;
}

.insights-content li {
  margin-bottom: 4px;
}

.insights-content strong {
  color: var(--text-primary);
}

.insights-form {
  display: flex;
  justify-content: flex-end;
}

/* ---------- Follow-ups ---------- */
.followup-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.followup-form textarea {
  resize: vertical;
}

.followup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.followup-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.followup-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.followup-note {
  font-size: 0.86rem;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* ---------- Forms (project create/edit) ---------- */
.form-panel {
  max-width: 640px;
}

.project-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

textarea {
  resize: vertical;
  font-family: inherit;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  align-items: stretch;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }

.toast.toast-hide {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* ---------- Skeleton / fade-in ---------- */
.skeleton-fade {
  animation: fade-in 0.35s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Login page ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.login-card h1 {
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}

.login-form button {
  margin-top: 16px;
}

.login-theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet and up: sidebar becomes static */
@media (min-width: 880px) {
  .sidebar {
    position: sticky;
    transform: none;
    height: 100vh;
  }

  .sidebar-close {
    display: none;
  }

  .overlay {
    display: none;
  }

  .menu-toggle {
    display: none;
  }

  .user-chip {
    display: inline-flex;
  }

  .content {
    padding: 24px 32px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1.4fr 1fr;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-columns {
    grid-template-columns: 1.3fr 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .continue-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

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

  .stat-value {
    font-size: 1.2rem;
  }

  h1 {
    font-size: 1.3rem;
  }
}
