/* ================================================================
   MEXICONNECT Owner Dashboard — Admin Styles
   ================================================================ */

/* 1. Reset & Variables
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:      #009A44;
  --red:        #CE1126;
  --blue:       #002868;
  --gold:       #C9A84C;
  --dark:       #0f172a;
  --dark-mid:   #1e293b;
  --dark-card:  #243044;
  --light:      #f1f5f9;
  --lighter:    #f8fafc;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --muted:      #64748b;
  --radius:     8px;
  --sidebar-w:  240px;

  /* Status colors */
  --s-new:       #3b82f6;
  --s-contacted: #8b5cf6;
  --s-qualified: #f59e0b;
  --s-converted: #10b981;
  --s-closed:    #10b981;
  --s-cancelled: #ef4444;
  --s-lead:      #64748b;
  --s-intro:     #3b82f6;
  --s-negotiating: #f59e0b;
  --s-terms:     #8b5cf6;
  --s-collected: #10b981;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--lighter);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* 2. Layout
   ================================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem;
  max-width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
}

/* 3. Sidebar
   ================================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sb-wm {
  font-family: 'Barlow Condensed', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.3rem;
  -webkit-text-stroke: 1px rgba(150,150,150,0.5);
  paint-order: stroke fill;
}

.wm-green    { color: #009A44; font-style: normal; }
.wm-white-sb { color: #fff;    font-style: normal; }
.wm-red      { color: #CE1126; font-style: italic; }
.wm-blue     { color: #6b9fff; font-style: italic; }

.sb-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item--active { background: rgba(0,154,68,0.2); color: var(--green); }

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

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sb-user {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  width: 100%;
  transition: all 0.15s;
}
.sb-logout:hover { border-color: var(--red); color: var(--red); }

/* 4. Page Header
   ================================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.page-title { font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.page-subtitle { font-size: 0.88rem; color: var(--muted); margin-top: 0.15rem; }

/* 5. Cards
   ================================================================ */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* 6. Stat Cards (Dashboard)
   ================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.stat-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.4rem; }
.stat-value {
  font-family: 'Barlow Condensed', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: var(--dark);
}
.stat-value--green  { color: var(--green); }
.stat-value--blue   { color: var(--blue); }
.stat-value--gold   { color: var(--gold); }
.stat-value--red    { color: var(--red); }

/* 7. Buttons
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  transition: all 0.15s;
}

.btn-primary   { background: var(--green); color: #fff; }
.btn-primary:hover { background: #007a36; }

.btn-secondary { background: var(--light); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger    { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-ghost     { background: none; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--lighter); }

.td-name    { font-weight: 600; color: var(--dark); }
.td-sub     { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.td-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

/* 9. Status Badges
   ================================================================ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-new        { background: #dbeafe; color: #1d4ed8; }
.badge-contacted  { background: #ede9fe; color: #6d28d9; }
.badge-qualified  { background: #fef3c7; color: #92400e; }
.badge-converted  { background: #d1fae5; color: #065f46; }
.badge-unqualified{ background: #fee2e2; color: #991b1b; }
.badge-active     { background: #d1fae5; color: #065f46; }
.badge-inactive   { background: #f1f5f9; color: #64748b; }
.badge-prospect   { background: #dbeafe; color: #1d4ed8; }
.badge-vetted     { background: #d1fae5; color: #065f46; }
.badge-unvetted   { background: #fef3c7; color: #92400e; }
.badge-lead       { background: #f1f5f9; color: #475569; }
.badge-intro_made { background: #dbeafe; color: #1d4ed8; }
.badge-negotiating{ background: #fef3c7; color: #92400e; }
.badge-terms_agreed { background: #ede9fe; color: #6d28d9; }
.badge-closed     { background: #d1fae5; color: #065f46; }
.badge-commission_collected { background: #dcfce7; color: #14532d; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }
.badge-us         { background: #dbeafe; color: #1d4ed8; }
.badge-mx         { background: #d1fae5; color: #065f46; }
.badge-open       { background: #f1f5f9; color: #64748b; }
.badge-buyer      { background: #dbeafe; color: #1d4ed8; }
.badge-seller     { background: #d1fae5; color: #065f46; }
.badge-both       { background: #ede9fe; color: #6d28d9; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-approved   { background: #d1fae5; color: #065f46; }
.badge-denied     { background: #fee2e2; color: #991b1b; }
.badge-warning    { background: #fff7ed; color: #9a3412; }

/* 10. Filters Bar
   ================================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text);
  background: #fff;
}

.search-input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text);
  background: #fff;
  min-width: 220px;
}

.search-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0,154,68,0.1);
}

.toggle-vetted {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  user-select: none;
  transition: all 0.15s;
}
.toggle-vetted.active { border-color: var(--green); background: #f0fdf4; color: var(--green); }

/* 11. Forms (Modals/Sheets)
   ================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.modal-panel {
  background: #fff;
  width: 480px;
  max-width: 95vw;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  line-height: 1;
  padding: 0.25rem;
}
.modal-close:hover { color: var(--text); }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }

.form-input, .form-select, .form-textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--text);
  background: #fff;
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0,154,68,0.1);
}

.form-textarea { resize: vertical; min-height: 80px; }
.form-actions  { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }

/* 12. Deal Detail — Side-by-Side Threads
   ================================================================ */
.deal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.deal-meta-item { }
.deal-meta-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 0.25rem; }
.deal-meta-value { font-size: 0.95rem; font-weight: 600; color: var(--dark); }
.deal-meta-sub   { font-size: 0.78rem; color: var(--muted); }

.deal-value-display {
  font-family: 'Barlow Condensed', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--green);
}
.deal-commission-display {
  font-family: 'Barlow Condensed', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--gold);
}

.threads-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.thread-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 480px;
}

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

.thread-title { font-weight: 700; font-size: 0.9rem; }
.thread-party-buyer  { border-top: 3px solid var(--blue); }
.thread-party-seller { border-top: 3px solid var(--green); }

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-bubble {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.message-bubble--out {
  background: var(--dark);
  color: #fff;
  align-self: flex-end;
}

.message-bubble--in {
  background: var(--light);
  color: var(--text);
  align-self: flex-start;
}

.message-meta {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  margin-top: 0.25rem;
  text-align: right;
}

.message-meta--in {
  color: var(--muted);
  text-align: left;
}

.thread-compose {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.thread-compose textarea {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  resize: none;
  font-family: inherit;
  color: var(--text);
}

.thread-compose textarea:focus {
  outline: none;
  border-color: var(--green);
}

/* 13. Notes Panel (encrypted)
   ================================================================ */
.notes-panel {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
}

.notes-panel .card-title { color: rgba(255,255,255,0.5); }

.notes-textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: #fff;
  padding: 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}
.notes-textarea:focus { outline: none; border-color: var(--green); }
.notes-encryption-tag {
  font-size: 0.72rem;
  color: var(--green);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* 14. Commission Breakdown
   ================================================================ */
.commission-tiers {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.9;
}
.commission-tiers .tier-total {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

/* 15. Pipeline Stage Tabs
   ================================================================ */
.stage-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.stage-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--light);
  color: var(--muted);
  border: none;
  transition: all 0.15s;
}
.stage-tab:hover { background: var(--border); color: var(--text); }
.stage-tab.active { background: var(--dark); color: #fff; }

/* 16. Login Page
   ================================================================ */
.login-page {
  min-height: 100vh;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}

.login-wordmark {
  font-family: 'Barlow Condensed', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  text-align: center;
  margin-bottom: 0.4rem;
  -webkit-text-stroke: 1.5px #aaa;
  paint-order: stroke fill;
}

.login-sub {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.login-error {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}
.login-error.visible { display: block; }

/* 17. Utility
   ================================================================ */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.text-green  { color: var(--green); }
.text-gold   { color: var(--gold); }
.text-blue   { color: var(--blue); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--muted); }
.text-right  { text-align: right; }
.fw-bold     { font-weight: 700; }
.fs-sm       { font-size: 0.82rem; }

.spinner {
  display: inline-block;
  width: 1.2rem; height: 1.2rem;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 18. Responsive
   ================================================================ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .deal-meta-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; max-width: 100vw; padding: 1rem; }
  .threads-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* 19. Accounting Module — Tabs
   ================================================================ */
.acct-tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.acct-tab {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  background: none;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s;
  position: relative;
  bottom: -2px;
}
.acct-tab:hover { color: var(--text); background: var(--light); }
.acct-tab--active {
  background: #fff;
  color: var(--dark);
  border-color: var(--border);
  border-bottom-color: #fff;
}

/* 20. Accounting Module — Journal Entry Form
   ================================================================ */
.je-slide-panel {
  position: fixed;
  top: 0; right: 0;
  width: 700px;
  max-width: 95vw;
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.je-slide-panel.open { transform: translateX(0); }

.je-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.je-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.je-panel-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* Lines table */
.je-lines-header {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr 1fr auto;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 0 0 0.4rem;
  border-bottom: 1px solid var(--border);
}

.je-line-row {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

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

.je-line-row select,
.je-line-row input[type="text"] {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
}

.je-line-row input[type="number"] {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
  text-align: right;
}

.je-line-row select:focus,
.je-line-row input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0,154,68,0.1);
}

.je-line-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius);
  transition: all 0.12s;
}
.je-line-remove:hover { color: var(--red); background: #fee2e2; }

/* Totals row */
.je-totals {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr 1fr auto;
  gap: 0.5rem;
  padding: 0.5rem 0 0;
  border-top: 2px solid var(--border);
  font-weight: 700;
  font-size: 0.88rem;
}

/* Balance indicator */
.je-balance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.je-balance--ok  { background: #d1fae5; color: #065f46; }
.je-balance--err { background: #fee2e2; color: #991b1b; }
.je-balance-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.je-balance--ok  .je-balance-dot  { background: #065f46; }
.je-balance--err .je-balance-dot  { background: #991b1b; }

/* 21. Accounting Module — COA Toggle Switches
   ================================================================ */
.acct-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.acct-toggle input { opacity: 0; width: 0; height: 0; }
.acct-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1;
  border-radius: 20px;
  transition: 0.2s;
}
.acct-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.acct-toggle input:checked + .acct-toggle-slider { background: var(--green); }
.acct-toggle input:checked + .acct-toggle-slider::before { transform: translateX(16px); }

/* COA table rows */
.coa-row--inactive td { opacity: 0.45; }
.coa-row--inactive td:first-child { opacity: 1; }

/* Account type badge variants */
.badge-asset         { background: #dbeafe; color: #1d4ed8; }
.badge-liability     { background: #fee2e2; color: #991b1b; }
.badge-equity        { background: #ede9fe; color: #6d28d9; }
.badge-revenue       { background: #d1fae5; color: #065f46; }
.badge-cogs          { background: #fef3c7; color: #92400e; }
.badge-expense       { background: #f1f5f9; color: #475569; }
.badge-other_income  { background: #d1fae5; color: #065f46; }
.badge-other_expense { background: #fee2e2; color: #991b1b; }
.badge-is            { background: #dbeafe; color: #1d4ed8; }
.badge-cf            { background: #ede9fe; color: #6d28d9; }

/* 22. Reports — Document Styles
   ================================================================ */
.report-doc {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  max-width: 780px;
  font-size: 0.9rem;
}

.report-doc--modal {
  border: none;
  padding: 0;
  max-width: 100%;
}

.report-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--dark);
}

.report-co {
  font-family: 'Barlow Condensed', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--dark);
  letter-spacing: 0.05em;
}

.report-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0.25rem 0;
}

.report-period {
  font-size: 0.85rem;
  color: var(--muted);
}

.report-section {
  margin-bottom: 1.5rem;
}

.report-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.4rem;
}

.report-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
}
.report-line:hover { background: var(--lighter); }

.report-line-name { color: var(--text); }

.report-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  font-weight: 600;
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

.report-total {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  margin: 0.5rem 0 1.25rem;
  border-radius: var(--radius);
}

.report-gross    { background: var(--light); color: var(--dark); }
.report-operating { background: #eff6ff; color: var(--blue); }
.report-net      { background: var(--dark); color: #fff; font-size: 1.05rem; }

.report-footnote {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.report-notes {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--lighter);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text);
}

/* Void/draft status badges */
.badge-posted { background: #d1fae5; color: #065f46; }
.badge-draft  { background: #fef3c7; color: #92400e; }

/* ── Notification preferences ─────────────────────────────────── */
.notif-row-admin {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.notif-row-admin:last-child { border-bottom: none; }

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle input:checked + .toggle-track { background: var(--accent, #1a3c5e); }
.toggle input:checked + .toggle-track::before { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent, #1a3c5e); outline-offset: 2px; }
.badge-void   { background: #fee2e2; color: #991b1b; text-decoration: line-through; }

/* ── Deal scope panel ─────────────────────────────────────────── */
#scopeCounterWrap .btn + .btn { margin-left: 0; }

/* ── Delivery stage stepper (admin) ──────────────────────────── */
.admin-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.admin-stepper-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem 0.5rem;
  min-width: 5rem;
  border-radius: 8px;
  transition: background 0.15s;
}
.admin-stepper-step:hover { background: rgba(0,0,0,0.04); }
.admin-stepper-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1.1rem;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}
.admin-stepper-step.completed:not(:last-child)::after { background: var(--accent, #1a3c5e); }
.admin-stepper-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  position: relative;
  z-index: 1;
  transition: border-color 0.15s, background 0.15s;
}
.admin-stepper-step.completed .admin-stepper-icon {
  background: var(--accent, #1a3c5e);
  border-color: var(--accent, #1a3c5e);
}
.admin-stepper-step.current .admin-stepper-icon {
  border-color: var(--accent, #1a3c5e);
  box-shadow: 0 0 0 3px rgba(26,60,94,0.15);
}
.admin-stepper-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  margin-top: 0.4rem;
  line-height: 1.3;
}
.admin-stepper-step.completed .admin-stepper-label,
.admin-stepper-step.current   .admin-stepper-label { color: var(--text, #0f172a); }

/* ── Deal files ──────────────────────────────────────────────── */
.file-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--bg, #f8fafc);
}
.file-icon { font-size: 1.2rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 0.72rem; color: var(--text-muted, #64748b); margin-top: 0.1rem; }
.file-delete-btn { opacity: 0.35; transition: opacity 0.15s; }
.file-row:hover .file-delete-btn { opacity: 1; }

/* ── Deal suppliers panel ────────────────────────────────────── */
.ds-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 0.45rem;
  background: var(--bg, #f8fafc);
}
.ds-row-info { flex: 1; min-width: 0; }
.ds-row-name { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-row-sub  { font-size: 0.72rem; color: var(--text-muted, #64748b); margin-top: 0.1rem; }
.badge-primary-tag { background: #dbeafe; color: #1e40af; font-size: 0.7rem; }
.ds-remove-btn { opacity: 0.3; transition: opacity 0.15s; flex-shrink: 0; }
.ds-row:hover .ds-remove-btn { opacity: 1; }
.ds-search-result {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.12s;
}
.ds-search-result:hover { background: #e0f2fe; }
