:root {
  --bg: #09090b;
  --bg-alt: #18181b;
  --panel: #27272a;
  --panel-hover: #3f3f46;
  --soft: #3f3f46;
  --text: #fafafa;
  --text-dim: #a1a1aa;
  --text-muted: #71717a;
  --line: #3f3f46;
  --brand: #6366f1;
  --brand-hover: #818cf8;
  --brand-2: #312e81;
  --brand-glow: rgba(99, 102, 241, 0.3);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--brand-glow);
  --radius: 16px;
  --radius-sm: 10px;
}

.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-sm { width: 20px; height: 20px; }
.ico-sm svg { width: 14px; height: 14px; }

.ico-lg { width: 40px; height: 40px; }
.ico-lg svg { width: 28px; height: 28px; }

.ico-xl { width: 56px; height: 56px; }
.ico-xl svg { width: 40px; height: 40px; }

.ico-brand { color: var(--brand); }
.ico-success { color: var(--success); }
.ico-warning { color: var(--warning); }
.ico-danger { color: var(--danger); }
.ico-muted { color: var(--text-muted); }

.ico-bg {
  background: var(--panel);
  border-radius: 10px;
  padding: 8px;
}

.ico-bg-lg {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
}

.ico-bg-lg svg {
  stroke: #fff;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state-icon.success { 
  background: linear-gradient(135deg, #10b981, #059669); 
}
.empty-state-icon.success svg { stroke: #fff; }

.empty-state-icon.info { 
  background: linear-gradient(135deg, #3b82f6, #2563eb); 
}
.empty-state-icon.info svg { stroke: #fff; }

.empty-state-icon.neutral { 
  background: linear-gradient(135deg, #6b7280, #4b5563); 
}
.empty-state-icon.neutral svg { stroke: #fff; }
.empty-state-icon.warning { background: linear-gradient(135deg, #f59e0b, #f97316); }
.empty-state-icon.warning svg { stroke: #fff; }
.empty-state-icon.neutral { background: linear-gradient(135deg, #6b7280, #4b5563); }
.empty-state-icon.neutral svg { stroke: #fff; }

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.section-icon svg {
  width: 14px;
  height: 14px;
}

.section-icon.actions { background: var(--brand-glow); }
.section-icon.actions svg { stroke: var(--brand-hover); }

.section-icon.payments { background: var(--success-bg); }
.section-icon.payments svg { stroke: var(--success); }

.section-icon.deadlines { background: var(--warning-bg); }
.section-icon.deadlines svg { stroke: var(--warning); }

.section-icon.risk { background: var(--danger-bg); }
.section-icon.risk svg { stroke: var(--danger); }

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
}

.stat-icon svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
}

.icon-leads-bg { background: linear-gradient(135deg, #f59e0b, #f97316); }
.icon-clients-bg { background: linear-gradient(135deg, #10b981, #059669); }
.icon-proposals-bg { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.icon-projects-bg { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.icon-billing-bg { background: linear-gradient(135deg, #f59e0b, #f97316); }

.mobile-header { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
  .mobile-header { display: flex; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--brand-hover); text-decoration: none; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #18181b 0%, #0f0f11 100%);
  border-right: 1px solid var(--line);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: 0 4px 20px var(--brand-glow);
}

.brand strong {
  font-size: 1.2rem;
  background: linear-gradient(90deg, #fff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav { display: grid; gap: 6px; }

.nav a {
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--text-dim);
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav a:hover {
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.nav a.active {
  background: linear-gradient(90deg, var(--brand-glow), transparent);
  color: var(--brand-hover);
  border-left: 3px solid var(--brand);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.content {
  flex: 1;
  padding: 32px 40px;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
    var(--bg);
}

.content-auth { display: grid; place-items: center; }

.header-block {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .7rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 12px;
}

h1, h2, h3 { margin: 0 0 14px; }

h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.1;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #d4d4d8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 1.15rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 18px;
}

.muted { color: var(--text-muted); }
.small { font-size: .85rem; }

.card {
  background: linear-gradient(145deg, var(--panel) 0%, var(--bg-alt) 100%);
  border: 1px solid rgba(63, 63, 70, 0.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow), var(--shadow-glow);
}

.stats-grid, .grid { display: grid; gap: 20px; margin-bottom: 24px; }

.stats-grid { 
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.stat {
  display: grid;
  gap: 12px;
  padding: 24px;
  background: linear-gradient(145deg, var(--panel) 0%, var(--bg-alt) 100%);
  border: 1px solid rgba(63, 63, 70, 0.5);
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.stat:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: var(--shadow-glow);
}

.stat span {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.stat strong {
  font-size: 2.4rem;
  background: linear-gradient(135deg, var(--brand) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stack, .stack-sm, .timeline { display: grid; gap: 12px; }
.stack-sm { gap: 10px; }

.list-row, .focus-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-alt);
  transition: all 0.25s ease;
}

.focus-item {
  flex-direction: column;
  align-items: flex-start;
}

.list-row:hover, .focus-item:hover {
  background: var(--panel);
  border-color: var(--brand);
  transform: translateX(4px);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: var(--brand-hover);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.btn {
  border: 0;
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
  color: #fff;
  border-radius: 12px;
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px var(--brand-glow);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--brand-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--panel-hover);
  border-color: var(--brand);
}

.full { width: 100%; }

.toolbar, .actions, .inline-form { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover td {
  background: var(--panel);
}

label { display: grid; gap: 8px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  background: var(--bg-alt);
  color: var(--text);
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

textarea { resize: vertical; }

.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-form.compact { gap: 12px; }
.full-row { grid-column: 1 / -1; }

.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }

.details-grid div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.note-block {
  margin-top: 18px;
  padding: 18px;
  background: var(--bg-alt);
  border-radius: 16px;
  border: 1px solid var(--line);
}

.clean-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }

.timeline-item {
  padding: 14px 16px;
  background: var(--bg-alt);
  border-radius: 14px;
  border-left: 3px solid var(--brand);
}

.milestone-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  background: var(--bg-alt);
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--bg-alt);
}

.top-border { border-top: 1px solid var(--line); padding-top: 18px; }
.margin-top { margin-top: 18px; }
.margin-bottom { margin-top: 18px; }

.dashboard-section {
  margin-bottom: 32px;
}

.dashboard-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-section h2::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--brand) 0%, #8b5cf6 100%);
  border-radius: 2px;
}

.action-item {
  position: relative;
  overflow: hidden;
}

.action-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity 0.2s;
}

.action-item:hover::before {
  opacity: 1;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

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

.card {
  animation: fadeInUp 0.4s ease-out;
}

.stat:nth-child(1) { animation-delay: 0.05s; }
.stat:nth-child(2) { animation-delay: 0.1s; }
.stat:nth-child(3) { animation-delay: 0.15s; }
.stat:nth-child(4) { animation-delay: 0.2s; }

.list-row, .focus-item {
  animation: fadeInUp 0.3s ease-out;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .grid.three, .grid-form, .details-grid { grid-template-columns: 1fr; }
  .sidebar { width: 240px; }
}

@media (max-width: 860px) {
  .shell { display: flex; flex-direction: column; }
  
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  .burger-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }
  
  .burger-btn span {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
  }
  
  .burger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .burger-btn.active span:nth-child(2) {
    opacity: 0;
  }
  
  .burger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
  
  .sidebar {
    position: fixed;
    top: 57px;
    left: 0;
    width: 280px;
    height: calc(100vh - 57px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 99;
    padding: 20px;
    overflow-y: auto;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
  }
  
  .sidebar-overlay.open {
    display: block;
  }
  
  .content { 
    padding: 20px 16px; 
    min-height: calc(100vh - 57px);
  }
  
  .header-block, .toolbar, .actions, .inline-form { 
    flex-direction: column; 
    align-items: stretch; 
  }
  
  .page-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .page-header .btn {
    width: 100%;
    justify-content: center;
  }
  
  .overview-hero {
    flex-direction: column;
    text-align: center;
  }
  
  .hero-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .hero-actions .btn {
    width: 100%;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stat {
    padding: 16px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .stat strong {
    font-size: 1.8rem;
  }
  
  .grid-section {
    grid-template-columns: 1fr;
  }
  
  .dash-card {
    padding: 16px;
  }
  
  .filter-bar {
    flex-direction: column;
  }
  
  .filter-bar input,
  .filter-bar select {
    width: 100%;
  }
  
  .filter-bar .btn {
    width: 100%;
  }
  
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .data-table th,
  .data-table td {
    padding: 12px 8px;
    font-size: 0.85rem;
  }
  
  .auth-card {
    padding: 24px 20px;
    margin: 16px;
  }
  
  .grid-form {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1rem;
  }
  
  .list-row, .action-item, .deadline-item, .payment-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .btn {
    padding: 14px 18px;
    min-height: 48px;
    font-size: 1rem;
  }
  
  input, select, textarea {
    padding: 14px 16px;
    font-size: 16px;
  }
  
  .details-grid {
    grid-template-columns: 1fr;
  }
  
  .milestone-card, .timeline-item {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 16px 12px;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
  
  .stat strong {
    font-size: 1.5rem;
  }
  
  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .nav a {
    padding: 12px;
    font-size: 0.9rem;
  }
  
  .user-info {
    padding: 10px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  .badge, .status-badge {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}