/* ============================================
   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-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
}

.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);
}

.task-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.task-card-title .task-number {
  margin-top: 1px;
}

.modal-header h2 .task-number {
  margin-right: 8px;
  font-size: 13px;
}

.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-clienttimer {
  background: rgba(124, 92, 255, 0.16);
  color: #c4b5fd;
}

.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);
}

/* Size modifier. Lived only in the deleted invoices.css, but the Transcripts
   delete button uses it too -- so it belongs in the shared sheet. */
.btn-sm {
  font-size: 11px;
  padding: 4px 10px;
}

.btn-icon.btn-sm { padding: 4px; }

/* 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: 1326px) */
@media (max-width: 1326px) {
  .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; }

  html, body, .app-shell, .main-wrap {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .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 2px;
    border: none;
    background: none;
    font-family: inherit;
    min-width: 0;
    flex: 1;
    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));
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pipeline-row, .card, .stat-card {
    max-width: 100%;
    overflow: hidden;
  }

  table, .pipeline-table {
    width: 100%;
    table-layout: fixed;
    overflow-x: auto;
    display: block;
  }

  .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);
  }

  /* Issue 1: Agent status dot labels smaller on mobile */
  .agent-dot {
    font-size: 0.65rem;
  }
  .agent-name {
    max-width: none;
  }
  .header-agents {
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  /* Issue 2: Stat cards - 2 columns that fit, with text wrapping */
  .stat-cards {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }
  .stat-card {
    padding: var(--space-md);
    min-width: 0;
  }
  .stat-card-value {
    font-size: 20px;
  }
  .stat-card-label {
    font-size: 11px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Issue 3: Cost Center mobile optimization */
  .cost-summary {
    padding: var(--space-md);
  }
  .page-header {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  .page-header .btn-primary {
    flex-shrink: 0;
  }

  /* Issue 4: Header spacing - tighter on mobile */
  .header {
    padding: 0 var(--space-sm);
    gap: 8px;
    height: 48px;
  }
  .header-right {
    gap: 8px;
  }
  .header-right .btn-icon svg,
  .inbox-btn svg,
  .logout-btn svg {
    width: 20px;
    height: 20px;
  }
  .user-initial {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
  .user-menu {
    gap: 4px;
  }
}

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

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

  .pipeline-row {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: var(--space-sm) var(--space-md);
  }

  .pipeline-name {
    min-width: unset;
    width: 100%;
    font-size: 15px;
  }

  .pipeline-phase {
    font-size: 12px;
    width: 100%;
    order: 3;
  }

  .pipeline-progress-bar {
    width: 100%;
    order: 4;
  }
}

/* ============================================
   28. Invoices
   Built on the SAME tokens as every other view. No new palette, no new
   font family, no parallel design system. Reuses .card-flat, .page-header,
   .section-header, .data-table, .badge, .btn-*, .form-group, .modal,
   .toast and .empty-state -- only genuinely invoice-specific structure
   is declared here.
   ============================================ */

/* Tabular figures so money columns never jitter. Inter has real tnum. */
.mono,
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.01em;
}

/* -- status filter (matches .btn-secondary language) -- */
.inv-filter {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.inv-fbtn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-right: 1px solid var(--border);
  padding: 8px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.inv-fbtn:last-child { border-right: none; }

.inv-fbtn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.inv-fbtn.is-active {
  color: #fff;
  background: var(--purple);
}

/* -- header action cluster -- */
.inv-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.inv-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Editable invoice number on a NEW invoice. Must read as the h1 it replaces
   -- same size, weight and color -- so the header does not visibly change
   shape between creating and editing. It only reveals itself as a field on
   hover/focus, because the suggested number is right nearly every time and
   only needs correcting when an invoice was issued outside Orbus. */
.inv-number-input {
  font-family: inherit;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-heading);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  margin-left: -7px;
  /* 14ch, not 12ch: "2026-INV0038" is 12 characters and clipped its own
     value at 12ch (measured scrollWidth 197 vs clientWidth 188). Sized to
     the content plus the padding it actually has. */
  width: 14ch;
  transition: border-color var(--transition), background var(--transition);
}

.inv-number-input:hover {
  border-color: var(--border);
}

.inv-number-input:focus {
  outline: none;
  border-color: var(--purple);
  background: var(--bg-input);
}

/* -- money column + status pin inside .data-table -- */
.inv-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-heading);
}

.inv-number {
  font-variant-numeric: tabular-nums;
  color: var(--text-heading);
  font-weight: 500;
}

.inv-pin {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-offline);
}

.inv-pin-draft { background: var(--status-offline); }
.inv-pin-sent  { background: var(--yellow); }
.inv-pin-paid  { background: var(--green); }
.inv-pin-void  { background: var(--red); }

.inv-col-pin { width: 28px; }
.inv-col-pdf { width: 56px; text-align: center; }
.inv-col-act { width: 150px; text-align: right; }

/* -- invoice status badges: same shape as .badge-active etc. -- */
.badge-draft {
  background: rgba(162, 162, 162, 0.12);
  color: var(--text-muted);
}

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

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

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

/* -- editor two-column layout -- */
.inv-editor {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
}

/* Right column: Line items stacked over Payments, same width (2026-10-03) */
.inv-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
}

.inv-payments-card .data-table { width: 100%; }
.inv-payments-card .data-table td,
.inv-payments-card .data-table th { white-space: nowrap; }
.inv-payments-card .data-table td.text-muted { white-space: normal; width: 100%; }

/* -- line item table -- */
.inv-items {
  width: 100%;
  border-collapse: collapse;
}

.inv-items th {
  text-align: left;
  padding: 0 var(--space-sm) var(--space-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inv-items th.text-right { text-align: right; }
.inv-items td { padding: 4px var(--space-sm); }
.inv-items .col-sm { width: 90px; }
.inv-items .col-md { width: 140px; }
.inv-items .col-x  { width: 40px; }

/* -- totals block -- */
.inv-totals {
  margin-top: var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.inv-trow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-xs) var(--space-sm);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.inv-trow span:last-child {
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.inv-trow-total {
  border-top: 1px solid var(--border);
  margin-top: var(--space-xs);
  padding-top: var(--space-md);
}

.inv-trow-total span:last-child {
  font-size: 24px;
  font-weight: 600;
  color: var(--purple);
}

/* -- money summary shared by Invoices hub and Client detail -- */
.inv-money {
  display: flex;
  align-items: baseline;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.inv-money-item { display: flex; align-items: baseline; gap: var(--space-sm); }

.inv-money-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.inv-money-value {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-heading);
}

.inv-money-out .inv-money-value { color: var(--yellow); }
.inv-money-in  .inv-money-value { color: var(--green); }

/* -- derived-value hint (budget now computed from paid invoices) -- */
.inv-derived {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inv-drift {
  color: var(--yellow);
  font-size: 11px;
}

/* -- inline row action -- */
.btn-tiny {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn-tiny:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.btn-tiny-ok:hover {
  border-color: var(--green);
  color: var(--green);
}

.btn-tiny[disabled] {
  opacity: 0.4;
  cursor: default;
  border-color: var(--border);
  color: var(--text-muted);
}

/* -- responsive -- */
@media (max-width: 1100px) {
  .inv-editor { grid-template-columns: 1fr; }
}

@media (max-width: 1326px) {
  .inv-col-act { width: auto; }
  .inv-money { gap: var(--space-md); }
}

/* Work Log column widths (Phase 3) */
.inv-w-s { width: 100px; }
.inv-w-m { width: 140px; }

/* ============================================
   29. Work Log -- bulk selection + row alignment
   ============================================ */

/* Aaron: "I would vertically align the trash can icon and the Edit button in
   the rows, they look a bit off-center."  The cause was .data-table td having
   no vertical-align, so a 24px button and a 14px icon sat on different
   baselines. Middle-align every cell and center the action cluster. */
.wl-table td,
.wl-table th {
  vertical-align: middle;
}

.wl-c-act {
  width: 132px;
  white-space: nowrap;
  text-align: right;
}

.wl-c-act .btn-tiny,
.wl-c-act .btn-icon {
  vertical-align: middle;
}

.wl-c-act .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin-left: var(--space-xs);
}

.wl-c-check { width: 34px; }
.wl-c-date { width: 104px; white-space: nowrap; }
.wl-c-num { width: 86px; }
.wl-c-status { width: 112px; }
.wl-desc { color: var(--text-primary); }

/* Checkboxes: the browser default is a bright white box that fights the
   dark UI, so tint it with the app accent. */
.wl-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
  accent-color: var(--purple);
}

.wl-table tbody tr.is-selected td {
  background: rgba(141, 90, 249, 0.10);
}

/* Bulk action bar -- only rendered when a selection exists. */
.wl-bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  background: var(--bg-card-hover);
  border: 1px solid var(--purple);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
}

.wl-bulk-count {
  font-size: 13px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.wl-bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.btn-tiny.wl-danger:hover {
  border-color: var(--red);
  color: var(--red);
}

/* Confirm dialog sizing -- narrower than a form modal. */
#modal .modal-body > div:first-child {
  line-height: 1.6;
}

@media (max-width: 1326px) {
  .wl-bulkbar { align-items: flex-start; flex-direction: column; }
  .wl-c-date { width: auto; }
}

/* ============================================
   30. Time Tracker
   ============================================ */

.tt-dash { margin-bottom: var(--space-lg); }
.tt-dash-note { margin: 0 0 var(--space-md); }
.tt-card { margin-bottom: var(--space-lg); }

.tt-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.tt-total {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  margin-right: var(--space-sm);
}

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

.tt-week-center { text-align: center; }
.tt-week-label { font-weight: 600; color: var(--text-heading); }

.tt-weeknav button[disabled] {
  opacity: 0.4;
  cursor: default;
}

.tt-clients {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tt-client,
.tt-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  cursor: pointer;
}

.tt-client {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.tt-client:hover,
.tt-quick-btn:hover { border-color: var(--text-muted); }

.tt-client:focus-visible,
.tt-quick-btn:focus-visible {
  outline: 1px solid var(--teal);
  outline-offset: 2px;
}

.tt-client.is-running,
.tt-quick-btn.is-running {
  border-color: var(--green);
  color: var(--green);
  background: rgba(23, 206, 105, 0.08);
}

.tt-client-clock,
.tt-now .tnum { font-weight: 600; }

.tt-now { margin-top: var(--space-md); font-size: 13px; }

.tt-hint,
.tt-banner {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-sm);
  color: var(--yellow);
  font-size: 13px;
}

.tt-banner { margin-bottom: var(--space-md); }

.tt-subs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.tt-sub {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.tt-sub.is-zero { color: var(--text-muted); }
.tt-sub-all { border-color: var(--text-muted); color: var(--text-heading); }

.tt-table-wrap { overflow-x: auto; max-width: 100%; }
.tt-table { min-width: 640px; }
.tt-table td, .tt-table th { vertical-align: middle; }
.tt-row-actions { white-space: nowrap; text-align: right; }
.tt-review td { background: rgba(233, 190, 18, 0.08); }
.tt-foot { margin-top: var(--space-md); }
.tt-live-label { color: var(--green); }

.tt-quick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tt-quick-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.tt-quick-more { padding: 0 6px; }

.tt-pop {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  max-height: 70vh;
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  z-index: 80;
}

.tt-quick.is-open .tt-pop { display: flex; flex-direction: column; gap: var(--space-sm); }
.tt-pop-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tt-pop .tt-clients { flex-direction: column; }
.tt-pop .tt-client { width: 100%; justify-content: space-between; }

@media (max-width: 1326px) {
  .tt-quick-name { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tt-pop { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; }
  .tt-weeknav { gap: var(--space-sm); }
  .tt-weeknav .btn-secondary { padding: 8px 10px; }
}

@media (max-width: 420px) {
  .bottom-nav-item { font-size: 9px; padding: 6px 0; }
}

.task-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-sm);
}

.eppie-send {
  color: var(--teal);
  border-color: rgba(2, 208, 255, 0.35);
}

.eppie-send:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.eppie-send:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.modal-footer .eppie-footer-send {
  margin-right: auto;
}


/* Rate plan card (2026-10-31). Reuses Orbus vocabulary: card-flat, badge,
   budget-bar, client-card-row. Only layout and the two plan colors are new. */
.rate-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(240px, 1.4fr);
  gap: var(--space-lg);
  align-items: center;
  margin-top: var(--space-md);
}
.rate-now-value { font-size: 34px; font-weight: 700; color: var(--text-heading); line-height: 1; }
.rate-now-value span { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.rate-now-sub { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); font-size: 11px; }
.rate-badge-std { background: rgba(31, 126, 255, 0.12); color: var(--blue); }
.rate-badge-block { background: rgba(23, 206, 105, 0.12); color: var(--green); }
.budget-fill.rate-fill-warn { background: var(--yellow); }
.rate-history summary { cursor: pointer; color: var(--text-muted); }
.inv-block-toggle { display: flex; align-items: center; gap: var(--space-sm); font-size: 12px; color: var(--text-primary); }
.inv-block-toggle input { width: auto; }
#client-rate .section-header { flex-wrap: wrap; gap: var(--space-sm); }
@media (max-width: 900px) {
  .rate-grid { grid-template-columns: 1fr; gap: var(--space-md); }
}

/* Invoice payment link (#308). */
.client-paylink { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue); }
.inv-payurl-hint { margin-top: 4px; color: var(--text-muted); }

/* Block balance (2026-10-31): remaining is the loudest number. */
.rate-rem { display: flex; align-items: baseline; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-sm); }
.rate-rem-value { font-size: 26px; font-weight: 800; color: var(--green); line-height: 1; }
.rate-rem-low .rate-rem-value { color: var(--yellow); }
.rate-rem-out .rate-rem-value { color: var(--red, #ff5d5d); }
.rate-warn { margin-top: var(--space-sm); padding: 6px 10px; border-radius: 8px; font-size: 12px; background: rgba(245, 158, 11, 0.12); color: var(--yellow); }
.rb-sizes { display: flex; gap: 6px; margin-top: 6px; }

/* Invoice editor: block client / block statement banner (2026-10-31). */
.inv-block-banner { border-left: 3px solid var(--green); padding: 10px 12px; border-radius: 8px; background: rgba(23, 206, 105, 0.06); line-height: 1.5; }
.inv-block-left { color: var(--green); }
.inv-block-detail { margin: 6px 0 8px; color: var(--text-muted); }

/* Block statement: remaining balance is the loudest line in the totals (2026-10-31). */
.inv-trow-remaining { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border, #2a2b33); }
.inv-trow-remaining span:first-child { color: var(--green); }
.inv-totals .inv-trow.inv-trow-total.inv-trow-remaining .tnum { color: var(--green); font-size: 22px; font-weight: 800; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.inv-trow-remaining small { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-top: 2px; }
