/* ============================================
   ORBUS — Master Stylesheet
   ============================================ */

/* 1. CSS Variables */
:root {
  /* Backgrounds */
  --bg-primary: #0a0b10;
  --bg-card: #0f1017;
  --bg-card-hover: #13141c;
  --bg-input: #12131a;
  --bg-sidebar: #0c0d13;
  --bg-modal-overlay: rgba(0, 0, 0, 0.6);

  /* Borders & Dividers */
  --border: #232323;
  --border-focus: #3a3a3a;

  /* Text */
  --text-primary: #c5c5c5;
  --text-muted: #a2a2a2;
  --text-heading: #e0e0e0;
  --text-inverse: #0a0b10;

  /* Semantic Colors */
  --blue: #1f7eff;
  --red: #ef443e;
  --green: #17ce69;
  --purple: #8d5af9;
  --pink: #f4469a;
  --teal: #02d0ff;
  --yellow: #e9be12;

  /* Semantic Aliases */
  --status-online: var(--green);
  --status-idle: var(--yellow);
  --status-working: var(--blue);
  --status-offline: #555555;

  --priority-critical: var(--red);
  --priority-high: #ff8c42;
  --priority-medium: var(--yellow);
  --priority-low: var(--text-muted);

  --client-active: var(--green);
  --client-proposal: var(--blue);
  --client-waiting: var(--yellow);
  --client-complete: var(--purple);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --transition: 0.2s ease;

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
}

/* 2. Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img { max-width: 100%; }

.hidden { display: none !important; }

/* 3. Typography */
h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.3;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.3;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.text-small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* 4. Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  height: 32px;
  width: auto;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: 2px;
}

.sidebar-nav {
  padding: var(--space-md) 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-lg);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-heading);
  background: rgba(141, 90, 249, 0.08);
  border-right: 2px solid var(--purple);
}

.nav-item svg {
  flex-shrink: 0;
}

.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: var(--space-md);
}

.mobile-menu-btn {
  display: none;
}

.header-agents {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.agent-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.agent-dot .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.inbox-btn {
  position: relative;
}

.inbox-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.user-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

#app {
  flex: 1;
  padding: var(--space-lg);
  max-width: 1400px;
  width: 100%;
}

.bottom-nav {
  display: none;
}

/* 5. Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  height: 48px;
  width: auto;
  margin-bottom: var(--space-md);
}

.login-card h1 {
  margin-bottom: var(--space-lg);
  letter-spacing: 4px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: var(--space-xs);
}

/* 6. Cards & Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: background var(--transition), border-color var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.card-clickable {
  cursor: pointer;
}

.card-flat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

/* 7. Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.stat-card-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* 8. Client Pipeline */
.pipeline-list {
  display: flex;
  flex-direction: column;
}

.pipeline-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.pipeline-row:hover {
  background: var(--bg-card-hover);
}

.pipeline-row:last-child {
  border-bottom: none;
}

.pipeline-name {
  font-weight: 500;
  min-width: 140px;
  color: var(--text-heading);
}

.pipeline-phase {
  color: var(--text-muted);
  font-size: 13px;
  flex: 1;
}

.pipeline-progress-bar {
  width: 120px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.pipeline-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--purple);
  transition: width var(--transition);
}

/* 9. Inbox */
.inbox-list {
  display: flex;
  flex-direction: column;
}

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
}

.inbox-item:hover {
  background: var(--bg-card-hover);
}

.inbox-item.unread {
  background: var(--bg-card-hover);
}

.inbox-item:last-child {
  border-bottom: none;
}

.inbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.inbox-title {
  flex: 1;
  color: var(--text-primary);
}

.inbox-time {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* 10. Activity Feed */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.activity-text {
  flex: 1;
  color: var(--text-primary);
}

.activity-time {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* 11. Kanban Board */
.kanban-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.kanban-toolbar select {
  width: auto;
  min-width: 120px;
}

.kanban-board {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-md);
  min-height: 400px;
  align-items: flex-start;
}

.kanban-column {
  flex: 1;
  min-width: 250px;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.kanban-column-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kanban-column-count {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-muted);
}

.kanban-column .top-border {
  height: 2px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-cards {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 60px;
}

.kanban-cards.drag-over {
  background: rgba(141, 90, 249, 0.05);
  border: 1px dashed var(--purple);
  border-radius: var(--radius-sm);
}

/* 12. Task Cards */
.task-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.task-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.task-card.dragging {
  opacity: 0.5;
}

.task-card-title {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.task-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* 13. Client Cards & Detail */
.client-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.client-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.client-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.client-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
}

.client-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.client-card-row {
  display: flex;
  justify-content: space-between;
}

.client-card-row .label {
  color: var(--text-muted);
}

.client-card-row .value {
  color: var(--text-primary);
  font-weight: 500;
}

.client-card-links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.client-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.client-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.budget-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: var(--space-sm);
}

.budget-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width var(--transition);
}

/* 14. Agent Cards & Detail */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.agent-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
}

.agent-type {
  font-size: 12px;
  color: var(--text-muted);
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-left: auto;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.agent-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: 13px;
}

.agent-card-body .label {
  color: var(--text-muted);
}

.agent-card-body .value {
  color: var(--text-primary);
}

/* 15. Cost Center */
.cost-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.cost-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.cost-summary-stats {
  display: flex;
  gap: var(--space-2xl);
}

.cost-stat {
  display: flex;
  flex-direction: column;
}

.cost-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
}

.cost-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.cost-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--space-md);
}

.cost-progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 3px;
}

.cost-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* 16. Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
}

.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.data-table tr:nth-child(even) {
  background: var(--bg-card);
}

.data-table tr:nth-child(odd) {
  background: var(--bg-primary);
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

/* 17. Forms & Inputs */
input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
  transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a2a2a2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

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

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* 18. Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.15s ease;
}

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

.modal-header h2 {
  font-size: 16px;
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

/* 19. Badges & Dots */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active {
  background: rgba(23, 206, 105, 0.12);
  color: var(--green);
}

.badge-proposal {
  background: rgba(31, 126, 255, 0.12);
  color: var(--blue);
}

.badge-waiting {
  background: rgba(233, 190, 18, 0.12);
  color: var(--yellow);
}

.badge-complete {
  background: rgba(141, 90, 249, 0.12);
  color: var(--purple);
}

.badge-blocked {
  background: rgba(239, 68, 62, 0.12);
  color: var(--red);
}

.badge-in_progress {
  background: rgba(31, 126, 255, 0.12);
  color: var(--blue);
}

.badge-backlog {
  background: rgba(162, 162, 162, 0.12);
  color: var(--text-muted);
}

.badge-review {
  background: rgba(233, 190, 18, 0.12);
  color: var(--yellow);
}

.badge-done {
  background: rgba(23, 206, 105, 0.12);
  color: var(--green);
}

/* 20. Buttons */
.btn-primary {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition);
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.btn-secondary:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-danger:hover {
  background: rgba(239, 68, 62, 0.1);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* 21. Toasts */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
  color: var(--text-primary);
  animation: slideIn 0.3s ease;
  min-width: 200px;
  max-width: 360px;
}

.toast-success {
  border-left: 3px solid var(--green);
}

.toast-error {
  border-left: 3px solid var(--red);
}

.toast-info {
  border-left: 3px solid var(--blue);
}

/* 22. Charts */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.chart-container h3 {
  margin-bottom: var(--space-md);
}

.chart-container canvas {
  width: 100%;
  display: block;
}

/* 23. Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.w-full { width: 100%; }
.text-right { text-align: right; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-md);
}

.dashboard-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* 24. Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-dot-online,
.status-dot-working {
  animation: pulse 2s ease-in-out infinite;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 25. Responsive — Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .client-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
  .cost-charts { grid-template-columns: 1fr; }
  .client-detail-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* 26. Responsive — Mobile (max-width: 768px) */
@media (max-width: 768px) {
  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .drawer-backdrop.open {
    display: block;
  }
  .main-wrap { margin-left: 0; }
  .mobile-menu-btn { display: flex; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 6px 4px;
    border: none;
    background: none;
    font-family: inherit;
    min-width: 48px;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item.active {
    color: var(--purple);
  }

  #app {
    padding: var(--space-md);
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .kanban-board {
    flex-direction: column;
  }

  .kanban-column {
    max-width: none;
    min-width: 0;
  }

  .client-grid { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: 1fr; }

  .modal {
    max-width: none;
    margin: var(--space-md);
    max-height: calc(100vh - 32px);
  }

  .cost-summary-stats {
    flex-direction: column;
    gap: var(--space-md);
  }
}

/* 27. Responsive — Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-card-value { font-size: 22px; }

  .header {
    padding: 0 var(--space-md);
  }

  .pipeline-name { min-width: 100px; }
  .pipeline-progress-bar { width: 80px; }
}
