/* ============================================================
   GoalRealty™  –  App Stylesheet
   Design System: SaaS / Monday.com inspired
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --primary:        #4f46e5;
  --primary-dark:   #4338ca;
  --primary-light:  #ede9fe;
  --secondary:      #10b981;
  --secondary-dark: #059669;
  --accent:         #f59e0b;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --info:           #3b82f6;
  --info-light:     #eff6ff;

  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface-alt:    #f8fafc;
  --border:         #e2e8f0;
  --border-dark:    #cbd5e1;

  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;

  --sidebar-w:      240px;
  --topbar-h:       60px;
  --radius:         .75rem;
  --radius-sm:      .5rem;
  --shadow:         0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);

  --font:           'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Auth Layout ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(79,70,229,.25) 0%, transparent 70%);
  top: -150px; right: -150px;
  pointer-events: none;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(16,185,129,.15) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}
.auth-card {
  background: var(--surface);
  border-radius: 1.25rem;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: .25rem;
}
.auth-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

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

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo a {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a5b4fc 0%, #6ee7b7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}
.sidebar-logo span {
  font-size: .7rem;
  color: #475569;
  display: block;
  margin-top: 1px;
  -webkit-text-fill-color: #475569;
}
.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}
.nav-section {
  margin-bottom: .25rem;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #334155;
  padding: .5rem 1.5rem .35rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.5rem;
  color: #94a3b8;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}
.nav-item:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,.05);
  border-left-color: transparent;
}
.nav-item.active {
  color: #a5b4fc;
  background: rgba(79,70,229,.15);
  border-left-color: #6366f1;
}
.nav-item .nav-icon { font-size: 1rem; flex-shrink: 0; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: .8rem; font-weight: 600; color: #e2e8f0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.user-role  { font-size: .7rem; color: #64748b; }
.logout-btn {
  font-size: .72rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  padding: .2rem .5rem;
  border-radius: .3rem;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  text-decoration: none;
  white-space: nowrap;
}
.logout-btn:hover { background: rgba(239,68,68,.15); color: #ef4444; border-color: rgba(239,68,68,.3); }

.nav-item-danger { color: #f87171 !important; }
.nav-item-danger:hover { background: rgba(239,68,68,.12) !important; color: #ef4444 !important; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  padding: 2rem;
  flex: 1;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}
.page-header p {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h3 { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-icon.purple { background: var(--primary-light); }
.stat-icon.green  { background: #d1fae5; }
.stat-icon.amber  { background: #fef3c7; }
.stat-icon.blue   { background: var(--info-light); }
.stat-icon.red    { background: var(--danger-light); }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Goal Cards Grid ────────────────────────────────────────── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.goal-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.goal-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.goal-card-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.goal-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .65rem;
}
.goal-type-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.goal-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .25rem;
}
.goal-card .client { font-size: .8rem; color: var(--text-muted); }
.goal-card-body { padding: 1rem 1.5rem; flex: 1; }
.goal-card-footer {
  padding: .85rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-wrap { margin: .65rem 0; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
}
.progress-track {
  height: 7px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary) 0%, #818cf8 100%);
  transition: width .5s ease;
}
.progress-fill.green  { background: linear-gradient(90deg, var(--secondary) 0%, #6ee7b7 100%); }
.progress-fill.amber  { background: linear-gradient(90deg, var(--accent) 0%, #fcd34d 100%); }

/* ── Stage Pipeline ─────────────────────────────────────────── */
.stage-pipeline {
  display: flex;
  gap: 0;
  margin: 1rem 0;
  overflow-x: auto;
  padding-bottom: .25rem;
}
.stage-step {
  flex: 1;
  min-width: 80px;
  text-align: center;
  position: relative;
}
.stage-step:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0; top: 12px;
  width: 100%; height: 3px;
  background: var(--border);
  z-index: 0;
}
.stage-step.done::after   { background: var(--secondary); }
.stage-step.active::after { background: linear-gradient(90deg, var(--secondary) 0%, var(--border) 100%); }
.stage-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--border);
  border: 3px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  margin-bottom: .4rem;
  transition: background .3s, border-color .3s;
}
.stage-step.done   .stage-dot { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.stage-step.active .stage-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.stage-label {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-light);
  display: block;
}
.stage-step.done   .stage-label { color: var(--secondary-dark); }
.stage-step.active .stage-label { color: var(--primary); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .7rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 99px;
  text-transform: capitalize;
}
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-hold     { background: #fef3c7; color: #92400e; }
.badge-closed   { background: #e2e8f0; color: #475569; }
.badge-pending  { background: #f1f5f9; color: #64748b; }
.badge-progress { background: var(--primary-light); color: var(--primary-dark); }
.badge-done     { background: #d1fae5; color: #065f46; }
.badge-default  { background: #f1f5f9; color: #64748b; }
.badge-agent    { background: var(--info-light); color: #1e40af; }
.badge-buyer    { background: #fce7f3; color: #9d174d; }
.badge-broker   { background: #fef3c7; color: #92400e; }
.table-row-hover:hover { background: var(--surface-alt); }

/* ── Task List ──────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: .5rem; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.task-item:hover { border-color: var(--border-dark); background: var(--surface-alt); }
.task-item.is-done { opacity: .6; }
.task-item.is-done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border-dark);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  margin-top: 2px;
  background: none;
}
.task-check:hover { border-color: var(--primary); background: var(--primary-light); }
.task-check.checked { background: var(--secondary); border-color: var(--secondary); }
.task-check.checked::after { content: '✓'; font-size: .7rem; color: #fff; font-weight: 700; }
.task-check.in-progress { background: var(--primary-light); border-color: var(--primary); }
.task-info { flex: 1; min-width: 0; }
.task-title { font-size: .875rem; font-weight: 600; color: var(--text); }
.task-desc  { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.task-meta  {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .4rem;
  flex-wrap: wrap;
}
.task-due {
  font-size: .7rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: .2rem;
}
.task-due.overdue { color: var(--danger); }
.task-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

/* ── Chat ───────────────────────────────────────────────────── */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 340px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  max-height: 380px;
  min-height: 220px;
}
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.chat-msg.sent { align-self: flex-end; align-items: flex-end; }
.chat-msg.recv { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: .6rem .9rem;
  border-radius: .75rem;
  font-size: .855rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.sent .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: .2rem;
}
.chat-msg.recv .chat-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: .2rem;
}
.chat-meta { font-size: .68rem; color: var(--text-light); margin-top: .25rem; }
.chat-form {
  display: flex;
  gap: .5rem;
  padding: .75rem 0 0;
}
.chat-form input[type=text] {
  flex: 1;
  padding: .65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .875rem;
  transition: border-color .15s;
}
.chat-form input[type=text]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem 1.5rem;
}
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
}
label .required { color: var(--danger); margin-left: .15rem; }
.form-control {
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: .75rem; color: var(--text-muted); }
.form-error { font-size: .75rem; color: var(--danger); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.3);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(79,70,229,.3); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border-dark); }
.btn-success {
  background: var(--secondary);
  color: #fff;
}
.btn-success:hover { background: var(--secondary-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-sm { padding: .4rem .85rem; font-size: .78rem; }
.btn-lg { padding: .8rem 1.75rem; font-size: .95rem; }
.btn-icon {
  padding: .45rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--surface-alt); border-color: var(--border); color: var(--text); }

/* ── Alerts & Flash ─────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger   { background: var(--danger-light); color: #7f1d1d; border: 1px solid #fecaca; }
.alert-warning  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info     { background: var(--info-light); color: #1e3a8a; border: 1px solid #bfdbfe; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-alt); }

/* ── AI Insight Panel ───────────────────────────────────────── */
.ai-panel {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: #e2e8f0;
  position: relative;
  overflow: hidden;
}
.ai-panel::before {
  content: '✨';
  position: absolute;
  top: -10px; right: 10px;
  font-size: 4rem;
  opacity: .07;
}
.ai-panel h4 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #818cf8;
  margin-bottom: .5rem;
}
.ai-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .5rem 0;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .82rem;
  color: #94a3b8;
}
.ai-item:first-of-type { border-top: none; }
.ai-tag {
  font-size: .65rem;
  padding: .15rem .5rem;
  border-radius: 99px;
  background: rgba(99,102,241,.3);
  color: #a5b4fc;
  flex-shrink: 0;
  font-weight: 600;
  margin-top: .05rem;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: .4rem; }
.empty-state p  { font-size: .875rem; }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .65rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Tooltip ────────────────────────────────────────────────── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  font-size: .7rem;
  padding: .3rem .6rem;
  border-radius: .35rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Misc Utilities ─────────────────────────────────────────── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: .25rem; }
.gap-2  { gap: .5rem; }
.gap-3  { gap: .75rem; }
.gap-4  { gap: 1rem; }
.mt-1   { margin-top: .25rem; }
.mt-2   { margin-top: .5rem; }
.mt-3   { margin-top: .75rem; }
.mt-4   { margin-top: 1rem; }
.mb-4   { margin-bottom: 1rem; }
.mb-6   { margin-bottom: 1.5rem; }
.text-sm    { font-size: .875rem; }
.text-xs    { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.font-bold  { font-weight: 700; }
.truncate   { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.w-full     { width: 100%; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .goals-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hamburger { display: flex !important; }
  .topbar { padding: 0 1rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; }
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: .35rem;
  border: none;
  background: none;
  margin-right: .5rem;
}
.hamburger span {
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  display: block;
  transition: all .2s;
}
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.overlay.open { display: block; }

/* ── Task Comments ──────────────────────────────────────────── */
.task-wrap { display: flex; flex-direction: column; }

.task-comment-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border-radius: .4rem;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
  margin-left: auto;
  white-space: nowrap;
}
.task-comment-btn:hover,
.task-comment-btn.active {
  background: var(--primary-light);
  border-color: #c4b5fd;
  color: var(--primary);
}
.task-comment-btn.has-comments {
  color: var(--primary);
  font-weight: 600;
  border-color: #c4b5fd;
  background: var(--primary-light);
}
.tc-label { font-size: .72rem; }

.tc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: 0 .3rem;
}

.tc-panel {
  display: none;
  margin: .15rem 0 .35rem 2.75rem;
  border-left: 2px solid var(--border);
  padding-left: .9rem;
  animation: tcSlide .15s ease;
}
.tc-panel.open { display: block; }
@keyframes tcSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tc-list { display: flex; flex-direction: column; gap: .4rem; padding: .35rem 0; }
.tc-empty { font-size: .78rem; color: var(--text-light); padding: .25rem 0; }

.tc-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: .5rem .75rem;
}
.tc-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .25rem;
  flex-wrap: wrap;
}
.tc-author { font-size: .78rem; font-weight: 700; color: var(--text); }
.tc-time   { font-size: .68rem; color: var(--text-light); margin-left: auto; }
.tc-text   { font-size: .82rem; color: var(--text); line-height: 1.5; word-break: break-word; }

.tc-compose {
  display: flex;
  gap: .4rem;
  padding-top: .4rem;
}
.tc-input {
  flex: 1;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: .4rem;
  font-size: .82rem;
  background: var(--surface);
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.tc-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79,70,229,.1);
}
.tc-input::placeholder { color: var(--text-light); }
