/* =============================================
   GemNative — Premium Project Intelligence UI
   Palette: Deep Black / Navy / Electric Indigo / Violet / Magenta
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Core Palette */
  --bg-base:       #07080f;
  --bg-surface:    #0d0f1e;
  --bg-elevated:   #121428;
  --bg-card:       #161930;
  --bg-card-hover: #1c2040;
  --bg-input:      #0f1224;

  /* Borders */
  --border:        rgba(99,102,241,0.15);
  --border-bright: rgba(99,102,241,0.35);
  --border-glow:   rgba(168,85,247,0.4);

  /* Brand Colors */
  --indigo:        #6366f1;
  --indigo-light:  #818cf8;
  --indigo-dark:   #4338ca;
  --violet:        #7c3aed;
  --violet-light:  #a78bfa;
  --purple:        #9333ea;
  --magenta:       #d946ef;
  --blue:          #3b82f6;
  --blue-deep:     #1e3a8a;

  /* Gradients */
  --grad-brand:    linear-gradient(135deg, #6366f1, #9333ea, #d946ef);
  --grad-card:     linear-gradient(135deg, rgba(99,102,241,0.08), rgba(147,51,234,0.04));
  --grad-glow:     radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.2) 0%, transparent 70%);

  /* Text */
  --text-primary:  #f1f2ff;
  --text-secondary:#a5aac8;
  --text-muted:    #5c6085;
  --text-accent:   #818cf8;

  /* Status Colors */
  --green:   #10b981;
  --yellow:  #f59e0b;
  --red:     #ef4444;
  --orange:  #f97316;
  --cyan:    #06b6d4;

  /* Spacing & Shape */
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.6);
  --shadow-glow:0 0 32px rgba(99,102,241,0.15);

  /* Typography */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-w: 240px;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--indigo-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--violet-light); }

input, textarea, select, button { font-family: inherit; }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(99,102,241,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(147,51,234,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(217,70,239,0.06) 0%, transparent 70%);
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

.login-card {
  position: relative;
  width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  backdrop-filter: blur(20px);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(99,102,241,0.5));
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 12px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .form-control {
  padding-left: 44px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(99,102,241,0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-bright);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--indigo);
  color: var(--indigo-light);
  background: rgba(99,102,241,0.08);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  color: #f87171;
}

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

.btn-success {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.4);
  color: #34d399;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* =============================================
   APP SHELL / LAYOUT
   ============================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(99,102,241,0.5));
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(99,102,241,0.1);
  color: var(--text-primary);
  border-color: var(--border);
}

.nav-item.active {
  background: rgba(99,102,241,0.15);
  color: var(--indigo-light);
  border-color: rgba(99,102,241,0.3);
}

.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--indigo);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(99,102,241,0.08);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); truncate: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-body {
  padding: 28px;
  flex: 1;
}

/* =============================================
   CARDS & PANELS
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover { border-color: var(--border-bright); }

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 24px; }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover { border-color: var(--border-bright); box-shadow: var(--shadow-glow); }
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
  background: rgba(99,102,241,0.12);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-delta {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}

.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* =============================================
   PROJECT CARDS
   ============================================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-color, var(--indigo));
}

.project-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow), var(--shadow-glow);
  color: inherit;
}

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

.project-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.project-client {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.project-deadline {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
}

.project-deadline.urgent { color: var(--red); }
.project-deadline.soon { color: var(--yellow); }
.project-deadline.ok { color: var(--green); }

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  gap: 12px;
}

.project-money {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
}

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
}

.progress-label {
  display: none;
}

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

.progress-labeled {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-labeled .progress-bar-wrap { flex: 1; }
.progress-labeled .pct-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: 36px;
  text-align: right;
}

/* =============================================
   BADGES
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-planning    { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.badge-active      { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.badge-paused      { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.badge-completed   { background: rgba(6,182,212,0.15);  color: #67e8f9; border: 1px solid rgba(6,182,212,0.3); }
.badge-cancelled   { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-todo        { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }
.badge-inprogress  { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.badge-review      { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.badge-done        { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.badge-blocked     { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-requested   { background: rgba(99,102,241,0.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25); }
.badge-delivered   { background: rgba(16,185,129,0.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.25); }
.badge-partial     { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.badge-rejected    { background: rgba(239,68,68,0.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.badge-pending     { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }
.badge-default     { background: rgba(99,102,241,0.1);  color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }

/* =============================================
   TABLES
   ============================================= */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(99,102,241,0.07);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(99,102,241,0.05);
}

/* =============================================
   AI ESTIMATION PANEL
   ============================================= */
.ai-panel {
  background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(147,51,234,0.05) 50%, rgba(217,70,239,0.04) 100%);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.ai-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(147,51,234,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.35);
  color: var(--indigo-light);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.ai-date-big {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ai-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.confidence-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.confidence-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: var(--grad-brand);
  border-radius: 2px;
}

.risk-list { list-style: none; }

.risk-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.risk-item.high   { background: rgba(239,68,68,0.08); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.risk-item.medium { background: rgba(245,158,11,0.08); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.risk-item.low    { background: rgba(99,102,241,0.08); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }

.next-steps-list { list-style: none; }

.step-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.step-item.critical { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
.step-item.high     { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }

/* =============================================
   DAILY PLAN TIMELINE
   ============================================= */
.daily-plan {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.plan-day {
  display: flex;
  gap: 16px;
  position: relative;
}

.plan-day::before {
  content: '';
  position: absolute;
  left: 29px;
  top: 40px;
  bottom: -12px;
  width: 2px;
  background: var(--border);
}

.plan-day:last-child::before { display: none; }

.plan-day-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(99,102,241,0.15);
  border: 2px solid rgba(99,102,241,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--indigo-light);
  flex-shrink: 0;
  margin-top: 12px;
}

.plan-day-body {
  flex: 1;
  padding: 12px 0 20px;
}

.plan-day-date {
  font-size: 0.72rem;
  color: var(--indigo-light);
  font-weight: 600;
  margin-bottom: 6px;
}

.plan-task {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-task::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--indigo);
  border-radius: 50%;
  flex-shrink: 0;
}

/* =============================================
   FINANCIAL SUMMARY
   ============================================= */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.finance-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.finance-amount {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 6px 0 4px;
}

.finance-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.finance-positive { color: var(--green); }
.finance-negative { color: var(--red); }
.finance-neutral  { color: var(--indigo-light); }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-wide { max-width: 860px; }

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}

.modal-close:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.4); color: #f87171; }

.modal-body { padding: 24px 28px; }

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* =============================================
   TABS
   ============================================= */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  color: var(--text-muted);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.tab.active {
  background: rgba(99,102,241,0.15);
  color: var(--indigo-light);
  border-color: rgba(99,102,241,0.3);
}

.tab:hover:not(.active) { color: var(--text-secondary); background: rgba(255,255,255,0.03); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* =============================================
   NOTES
   ============================================= */
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: all var(--transition);
  cursor: pointer;
}

.note-card:hover { border-color: var(--border-bright); }

.note-card.pinned {
  border-color: rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.04);
}

.note-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.note-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =============================================
   TASK LIST
   ============================================= */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.task-item:hover { border-color: var(--border-bright); }

.task-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border-bright);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition);
  position: relative;
}

.task-check:checked {
  background: var(--indigo);
  border-color: var(--indigo);
}

.task-check:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.task-name {
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex: 1;
}

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

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* =============================================
   ALERTS & TOASTS
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  animation: slideIn 0.3s var(--transition);
}

.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.info    { border-color: rgba(99,102,241,0.4); }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* =============================================
   GRID HELPERS
   ============================================= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-gap-2 { display: flex; align-items: center; gap: 8px; }
.flex-gap-3 { display: flex; align-items: center; gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--indigo-light); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: border-color var(--transition);
}

.search-bar:focus-within { border-color: var(--indigo); }

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  flex: 1;
  font-size: 0.875rem;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* Hamburger toggle — hidden on desktop by default, shown via media query on mobile */
#sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* Sidebar backdrop (mobile overlay dimming) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .finance-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }

  #sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border) !important;
  }
  #sidebar-toggle:active { background: rgba(99,102,241,0.1); }

  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 0.95rem; }
  .topbar-right .text-xs { display: none; } /* hide date string, too cramped */
  .topbar {
    height: auto;
    min-height: 54px;
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 8px;
  }
  .topbar-right { flex-wrap: wrap; gap: 6px; }
  .topbar-right .btn-sm { padding: 6px 10px; font-size: 0.78rem; }
}

@media (max-width: 600px) {
  .page-body { padding: 12px; }

  /* Stat cards — tighter, smaller */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-icon { width: 28px; height: 28px; font-size: 0.95rem; margin-bottom: 6px; }
  .stat-value { font-size: 1.15rem; line-height: 1.1; }
  .stat-label { font-size: 0.7rem; margin-top: 2px; }
  .stat-delta { font-size: 0.68rem; margin-top: 4px; }

  /* Project cards — denser */
  .projects-grid { grid-template-columns: 1fr; gap: 10px; }
  .project-card { padding: 14px; }
  .project-card-header { margin-bottom: 8px; }
  .project-title { font-size: 0.875rem; }
  .project-client { font-size: 0.72rem; }
  .project-deadline { font-size: 0.7rem; margin-bottom: 8px; }
  .project-footer { margin-top: 10px; }
  .project-money { font-size: 0.74rem; }

  /* Cards in general */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .card-title { font-size: 0.9rem; }
  .card-body { padding: 14px; }
  .mb-6 { margin-bottom: 16px; }
  .mb-4 { margin-bottom: 10px; }
  .section-title { font-size: 0.95rem; margin-bottom: 10px; }

  /* Notes — denser */
  .note-card { padding: 10px 14px; margin-bottom: 8px; }
  .note-title { font-size: 0.875rem; margin-bottom: 4px; }
  .note-preview { font-size: 0.76rem; }
  .note-meta { font-size: 0.68rem; margin-top: 6px; }

  /* Task items — denser */
  .task-item { padding: 9px 12px; margin-bottom: 6px; gap: 9px; }
  .task-name { font-size: 0.82rem; }

  /* Login card */
  .login-card { padding: 28px 18px; width: 100%; max-width: 380px; }

  /* Topbar */
  .topbar { height: 50px; }

  /* Modal — tighter padding */
  .modal { max-width: 94vw; }
  .modal-header { padding: 16px 16px 14px; }
  .modal-title { font-size: 0.92rem; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .form-group { margin-bottom: 14px; }
  .form-label { font-size: 0.72rem; margin-bottom: 5px; }
  .form-control { padding: 9px 12px; font-size: 0.85rem; }
  .grid-2, .grid-3, .grid-4 { gap: 10px; }

  /* Tabs — scrollable, smaller */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 3px; }
  .tab { flex: 0 0 auto; padding: 8px 12px; font-size: 0.8rem; white-space: nowrap; }

  /* Finance cards */
  .finance-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .finance-card { padding: 12px; }
  .finance-amount { font-size: 1.1rem; margin: 4px 0 2px; }
  .finance-label { font-size: 0.68rem; }

  /* Tables — compact rows */
  .data-table { font-size: 0.76rem; }
  .data-table th { padding: 8px 8px; font-size: 0.66rem; }
  .data-table td { padding: 8px 8px; }

  /* Buttons — slightly smaller on mobile to fit more in a row */
  .btn { padding: 8px 14px; font-size: 0.82rem; }
  .btn-sm { padding: 5px 10px; font-size: 0.74rem; }
  .btn-lg { padding: 11px 22px; font-size: 0.92rem; }

  /* Badges — tighter */
  .badge { padding: 2px 8px; font-size: 0.66rem; }

  /* AI panel — denser */
  .ai-panel { padding: 16px; }
  .ai-date-big { font-size: 1.5rem; }
  .step-item, .risk-item { padding: 8px 10px; font-size: 0.78rem; }

  /* Empty states — less vertical padding */
  .empty-state { padding: 32px 20px; }
  .empty-icon { font-size: 2.2rem; margin-bottom: 10px; }

  /* AI daily plan timeline — denser */
  .plan-day { gap: 10px; }
  .plan-day-num { width: 22px; height: 22px; font-size: 0.62rem; margin-top: 9px; }
  .plan-day::before { left: 22px; top: 32px; }
  .plan-day-body { padding: 9px 0 14px; }
  .plan-day-date { font-size: 0.66rem; margin-bottom: 4px; }
  .plan-task { font-size: 0.76rem; padding: 3px 0; }

  /* Daily log cards on daily_logs.php — denser */
  .panel { padding: 12px; }
}

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