@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-var.woff2") format("woff2");
}

:root {
  --ink: #12161c;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --paper: #f4f6f9;
  --card: #ffffff;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --green: #027a48;
  --green-soft: #ecfdf3;
  --red: #b42318;
  --red-soft: #fef3f2;
  --lab: #0b0d10;
  --lab-fg: #f4f1e8;
  --orange: #f24700;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ul {
  margin: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 200;
  background: #111;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 8px;
}
.skip-link:focus {
  top: 0.7rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- lab bar / footer ---------- */

.lab-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 48px;
  padding: 0 1.25rem;
  background: var(--lab);
  color: var(--lab-fg);
  border-bottom: 1px solid #1d2228;
}

.lab-brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}
.lab-brand span {
  color: var(--orange);
}
.lab-brand em {
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: rgba(244, 241, 232, 0.5);
  margin-left: 0.35rem;
  vertical-align: 2px;
}

.lab-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lab-demo {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--orange);
  color: #141210;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  white-space: nowrap;
}

.lab-back {
  font-size: 0.78rem;
  color: rgba(244, 241, 232, 0.7);
  text-decoration: none;
  white-space: nowrap;
}
.lab-back:hover {
  color: var(--lab-fg);
}

.lab-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  padding: 0.9rem 1.25rem;
  background: #fff;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}
.lab-foot a {
  color: var(--ink-2);
}

/* ---------- app shell ---------- */

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: calc(100vh - 48px);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.1rem 0.9rem;
  background: #101418;
  color: #e7e9ee;
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.deck-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}
.side-brand em {
  font-style: normal;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  color: rgba(231, 233, 238, 0.45);
  margin-left: 0.3rem;
  vertical-align: 2px;
}

.side-nav {
  display: grid;
  gap: 0.2rem;
}

.nav-item {
  text-align: left;
  background: none;
  border: 0;
  color: rgba(231, 233, 238, 0.62);
  padding: 0.55rem 0.6rem;
  border-radius: 9px;
  font-size: 0.86rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav-item.is-active {
  background: rgba(79, 70, 229, 0.18);
  color: #dfe2ff;
}

.side-foot {
  margin-top: auto;
  display: grid;
  gap: 0.7rem;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.side-user span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.side-user strong {
  font-size: 0.78rem;
  font-weight: 600;
}
.side-user small {
  font-size: 0.66rem;
  color: rgba(231, 233, 238, 0.5);
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2a3038;
  color: #dfe2ff;
  font-size: 0.66rem;
  font-weight: 600;
  flex: none;
}
.reset {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(231, 233, 238, 0.6);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
}
.reset:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.main {
  min-width: 0;
  padding: 1.6rem clamp(1rem, 2.2vw, 2.2rem) 2.5rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.page-head h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 2.4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}
.page-head .sub {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.page-head .sub strong {
  color: var(--ink);
  font-weight: 600;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.search input {
  width: min(280px, 42vw);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 0.82rem;
  outline-offset: 2px;
}
.search input:focus {
  border-color: var(--accent);
}
.search input::placeholder {
  color: #98a2b3;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #4338ca;
}
.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover {
  border-color: #98a2b3;
  background: #f9fafb;
}

/* ---------- KPIs ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.4rem;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-value {
  margin-top: 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 1.8vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-value small {
  font-family: var(--font);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 0.15rem;
}
.kpi-delta {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
}
.kpi-delta.up {
  color: var(--green);
}
.kpi-delta.down {
  color: var(--green);
}

/* ---------- board ---------- */

.board-wrap {
  margin-top: 1.2rem;
}
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 0.8rem;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}
.col {
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
  min-height: 120px;
}
.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.35rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.col-head span {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.7rem;
}
.col-list {
  display: grid;
  gap: 0.5rem;
  min-height: 56px;
}
.col.is-over {
  background: #e3e7f7;
  border-color: #b9c0ee;
}
.deal-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  cursor: grab;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.deal-card:hover {
  border-color: #b9c0ee;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}
.deal-card:active {
  cursor: grabbing;
}
.deal-card.is-dragging {
  opacity: 0.5;
}
.deal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.deal-company {
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: -0.01em;
}
.deal-amount {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.deal-person {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.deal-tags {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.16rem 0.42rem;
  background: var(--accent-soft);
  color: #4338ca;
}
.tag.green {
  background: var(--green-soft);
  color: var(--green);
}
.tag.amber {
  background: #fffaeb;
  color: #b54708;
}
.board-hint {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- contacts ---------- */

.contacts {
  margin-top: 1.8rem;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.section-head .sub {
  margin-top: 0.25rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.table-wrap {
  margin-top: 0.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
thead th {
  text-align: left;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f9fafb;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #f2f4f7;
  color: var(--ink-2);
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #fafbfc;
}
td.person {
  color: var(--ink);
  font-weight: 500;
}
td.mono {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 1.2rem;
}

/* ---------- drawer ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(16, 24, 40, 0.32);
  backdrop-filter: blur(2px);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  width: min(390px, 92vw);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(16, 24, 40, 0.12);
  transform: translateX(104%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
}
.drawer.is-open {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.icon-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--muted);
  line-height: 1;
  flex: none;
}
.icon-btn:hover {
  color: var(--ink);
  border-color: #98a2b3;
}
.drawer-body {
  padding: 1.1rem 1.25rem 1.5rem;
  overflow-y: auto;
  display: grid;
  gap: 1.1rem;
}
.deal-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.deal-facts dt {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.deal-facts dd {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}
.stage-control {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.stage-control button {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.7rem;
  color: var(--ink-2);
}
.stage-control button.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}
.drawer-block {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.block-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.drawer-block p:last-child {
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.55;
}

/* ---------- modals ---------- */

.modal {
  position: fixed;
  z-index: 130;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.22);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.modal-form {
  display: grid;
  gap: 0.75rem;
  padding: 1.1rem 1.2rem 1.2rem;
}
.modal-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal-form input,
.modal-form select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: #fff;
}
.modal-form input:focus,
.modal-form select:focus {
  border-color: var(--accent);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.toast {
  position: fixed;
  z-index: 140;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: #101418;
  color: #f4f1e8;
  font-size: 0.8rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.25);
  max-width: 90vw;
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .board {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem;
    gap: 0.8rem;
  }
  .side-nav {
    display: flex;
    overflow-x: auto;
  }
  .nav-item {
    white-space: nowrap;
    padding: 0.4rem 0.55rem;
  }
  .side-foot {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }
  .side-user {
    border-top: 0;
    padding: 0;
  }
  .side-user span:last-child,
  .side-brand em {
    display: none;
  }
  .main {
    padding: 1.1rem 0.9rem 2rem;
  }
  .board {
    grid-template-columns: repeat(4, 220px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .col {
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  .page-head {
    align-items: flex-start;
  }
  .head-actions {
    width: 100%;
  }
  .search {
    flex: 1;
  }
  .search input {
    width: 100%;
  }
  .lab-bar {
    padding: 0 0.8rem;
    gap: 0.5rem;
  }
  .lab-demo {
    display: none;
  }
  .lab-back {
    font-size: 0.72rem;
  }
  .kpis {
    gap: 0.6rem;
  }
  .table-wrap {
    overflow-x: auto;
  }
  table {
    min-width: 520px;
  }
  .deal-facts {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .lab-foot {
    padding: 0.8rem;
  }
  .side-nav {
    display: none;
  }
}
