:root {
  /* Dark Theme Colors based on the screenshot */
  --bg: #111827;           /* Main dark background */
  --bg-accent: #1f2937;    /* Card background */
  --paper: #1f2937;        /* Main panel background */
  --paper-strong: #374151; /* Nested cards */
  --line: #374151;         /* Subtle borders */
  --line-strong: #4b5563;  /* Stronger borders */
  --text: #f9fafb;         /* Bright white text */
  --muted: #9ca3af;        /* Gray muted text */
  --accent: #4ade80;       /* Bright green from screenshot */
  --accent-strong: #22c55e;/* Slightly darker green */
  --accent-soft: rgba(74, 222, 128, 0.15); /* Transparent green for hovers */
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, 0.15);
  --gold: #fbbf24;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
}

h1, h2, h3, h4 {
  margin: 0;
}

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

button {
  border: 0;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  background: var(--accent-strong);
  color: #111827;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: var(--bg);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

textarea {
  resize: vertical;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 20px auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
}

.card {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 26px;
  position: sticky;
  top: 20px;
  height: fit-content;
}

/* Updated Brand Layout */
.brand-block {
  display: flex;
  flex-direction: column; /* Stacks the logo and text */
  align-items: center;
  text-align: center;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-logo {
  width: 180px; /* Makes the logo larger */
  background: #ffffff; /* White background so black text is visible */
  padding: 12px 16px;
  border-radius: 10px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.6rem;
  margin-top: 4px;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
}

.sidebar-copy, .hero-copy, .muted-copy, .sidebar-panel li, .activity-item p, .task-item p, .lead-primary span, .lead-primary small {
  color: var(--muted);
  line-height: 1.55;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin: 26px 0;
}

.nav-list a {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.14s ease;
}

.nav-list a:hover, .nav-list a.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(74, 222, 128, 0.2);
}

.sidebar-panel {
  padding: 18px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.sidebar-panel ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 10px;
}

.panel-label {
  margin: 0 0 14px;
  font-weight: 700;
}

.main-layout {
  display: grid;
  gap: 18px;
}

.view-root {
  display: grid;
}

.hero {
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  background: var(--paper);
}

.hero h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
  max-width: 22ch;
}

.hero-copy {
  max-width: 65ch;
  margin-top: 10px;
  font-size: 0.9rem;
}

.hero-badge {
  min-width: 180px;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.hero-badge span, .metric-card p, .deal-meta span, .activity-type, .pipeline-head span, .task-item p, .lead-primary small {
  font-size: 0.85rem;
}

.hero-badge strong {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.3rem;
}

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

.metric-card {
  padding: 22px;
}

.metric-card strong {
  display: block;
  margin: 0.45rem 0 0.4rem;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  color: var(--accent);
}

.metric-card span {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.summary-card, .compact-item {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.summary-card {
  display: grid;
  gap: 8px;
}

.summary-card span {
  color: var(--muted);
  text-transform: capitalize;
}

.summary-card strong {
  font-size: 1.8rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.compact-list {
  display: grid;
  gap: 12px;
}

.compact-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.compact-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.left-stack, .right-stack {
  display: grid;
  gap: 18px;
}

.section-card {
  padding: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-head h3 {
  font-size: 1.7rem;
}

.section-controls {
  display: flex;
  gap: 10px;
  width: min(100%, 460px);
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.lead-primary {
  display: grid;
  gap: 3px;
}

.inline-select {
  min-width: 124px;
  padding: 0.65rem 0.8rem;
  text-transform: capitalize;
}

.empty-row, .empty-panel {
  color: var(--muted);
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  text-align: center;
}

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

.mini-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.mini-form h4 {
  font-size: 1.25rem;
}

.import-form {
  gap: 14px;
}

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

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.pipeline-column {
  padding: 14px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.pipeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pipeline-head h4 {
  font-size: 1rem;
}

.pipeline-list {
  display: grid;
  gap: 10px;
}

.deal-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.deal-topline, .deal-footer, .deal-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.deal-card p {
  margin: 0.5rem 0;
  color: var(--muted);
}

.deal-meta {
  margin-bottom: 0.8rem;
}

.split-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.inner-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.inner-card:first-child {
  border-right: 1px solid var(--line);
}

.task-list, .activity-feed {
  display: grid;
  gap: 12px;
}

.task-item, .activity-item {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.task-item.done strong, .task-item.done p {
  text-decoration: line-through;
  opacity: 0.65;
}

.activity-type {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
}

.activity-item strong {
  display: block;
  margin-bottom: 0.4rem;
}

.activity-item p {
  margin: 0 0 0.6rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  background: #000000;
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(0,0,0,0.5);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #ef4444;
}

@media (max-width: 1180px) {
  .page-shell, .content-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stats-grid, .forms-grid, .split-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-block { flex-direction: row; text-align: left; }
  .brand-logo { width: 100px; }
}

@media (max-width: 760px) {
  .page-shell { width: min(100% - 18px, 100%); margin: 10px auto 22px; }
  .hero, .section-head, .section-controls, .field-row, .stats-grid, .forms-grid, .pipeline-board, .split-card { grid-template-columns: 1fr; display: grid; }
  .hero { gap: 16px; }
  .hero h2 { max-width: 100%; }
  .section-controls { width: 100%; }
  .sidebar, .section-card, .hero { padding: 18px; border-radius: 16px; }
}

/* Activity Pagination Controls */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.btn-page {
  background: var(--paper-strong);
  color: var(--text);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 8px;
  box-shadow: none;
  font-weight: 500;
}

.btn-page:hover:not(:disabled) {
  background: var(--line-strong);
  transform: none;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.page-info {
  font-size: 0.85rem;
  color: var(--muted);
}

/* --- NEW UI ELEMENTS --- */
.action-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-small {
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  background: var(--paper-strong);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.btn-small:hover {
  background: var(--line-strong);
}

.btn-close {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 1.2rem;
  padding: 0;
}

.btn-close:hover {
  background: transparent;
  color: #ef4444;
  transform: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  position: relative;
}

/* ========================================== */
/* CUSTOM KANBAN SCROLLBARS                   */
/* ========================================== */

/* Targets the horizontal board and the vertical columns */
.scrollable-board::-webkit-scrollbar, 
.scrollable-list::-webkit-scrollbar {
    width: 6px;  /* Thin vertical scrollbar */
    height: 8px; /* Thin horizontal scrollbar */
}

/* The track (background) of the scrollbar */
.scrollable-board::-webkit-scrollbar-track, 
.scrollable-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* The draggable thumb */
.scrollable-board::-webkit-scrollbar-thumb, 
.scrollable-list::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}

/* Hover effect on the thumb */
.scrollable-board::-webkit-scrollbar-thumb:hover, 
.scrollable-list::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}