:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #1f2b45;
  --muted: #6d7b95;
  --line: #d7deeb;
  --line-soft: #e7ecf5;
  --accent: #0073ea;
  --good: #00c875;
  --warn: #fdab3d;
  --bad: #e2445c;
  --shadow-soft: 0 8px 22px rgba(21, 34, 58, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 110% -10%, #e3efff 0%, transparent 60%),
    radial-gradient(780px 350px at -12% 105%, #e8f8f3 0%, transparent 58%),
    var(--bg);
  line-height: 1.45;
  overflow: hidden;
}

.shell {
  width: min(1720px, calc(100vw - 16px));
  margin: 6px auto;
  height: calc(100vh - 12px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}

.top {
  border: none;
  border-radius: 20px;
  background: linear-gradient(125deg, #0d2f4f, #0672a8);
  color: #fff;
  box-shadow: 0 14px 30px rgba(13, 47, 79, 0.25);
  padding: 10px 12px;
}

.top-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: clamp(36px, 4.8vw, 50px);
  height: auto;
  flex: 0 0 auto;
}

.title {
  margin: 0;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(21px, 2.5vw, 30px);
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.sub {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn,
.btn-light {
  border-radius: 999px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}

.btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn:hover {
  background: #005fbe;
  border-color: #005fbe;
}

.btn-light {
  background: #fff;
  border-color: #cad5e8;
  color: #2f4260;
}

.btn-light:hover {
  background: #edf4ff;
}

.top-tabs {
  margin-top: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.top-tab {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  padding: 0 2px;
}

.top-tab.active {
  border-bottom-color: #fff;
  color: #fff;
}

.controls {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1.8fr 0.9fr 0.9fr auto auto;
  gap: 8px;
  align-items: end;
}

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

.control {
  width: 100%;
  border: 1px solid #cfd8e9;
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 9px;
}

.control:focus {
  outline: none;
  border-color: #94bcf2;
  box-shadow: 0 0 0 3px rgba(0, 115, 234, 0.16);
}

.toggle-wrap {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #334969;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #d0dbec;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  white-space: nowrap;
}

.toggle-wrap input { accent-color: var(--accent); }

.summary-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.summary-chip {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 6px 7px;
}

.summary-chip .label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.summary-chip .value {
  margin: 3px 0 0;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 17px;
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-weight: 800;
}

.summary-chip .value.good { color: #00a56e; }
.summary-chip .value.warn { color: #d98700; }

.board-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8faff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  min-height: 0;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  width: 100%;
  height: 100%;
  overflow: auto;
  align-content: start;
  align-items: stretch;
}

.lane {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  height: 100%;
}

.lane-head {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.lane-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.lane-title {
  margin: 0;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1f2f4f;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.lane-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.lane-count {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.lane-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lane-body {
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
}

.lane-body.is-drop {
  background: #eef5ff;
  outline: 2px dashed #8eb9f4;
  outline-offset: -6px;
  border-radius: 10px;
}

.deal-card {
  border: 1px solid #d8e1ef;
  border-radius: 11px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 5px 12px rgba(26, 40, 70, 0.08);
  display: grid;
  gap: 6px;
  cursor: grab;
}

.deal-card:active { cursor: grabbing; }

.deal-card.dragging {
  opacity: 0.58;
  transform: scale(0.98);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.company-link {
  color: #1e3152;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.company-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-sub {
  margin-top: -3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #d3deee;
  background: #f7f9fd;
  color: #334a6b;
}

.chip.priority-high {
  background: #635bff;
  border-color: #635bff;
  color: #fff;
}

.chip.priority-medium {
  background: #8ec70c;
  border-color: #8ec70c;
  color: #fff;
}

.chip.priority-low {
  background: #4da8da;
  border-color: #4da8da;
  color: #fff;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: #536886;
  font-weight: 700;
}

.next-row {
  font-size: 12px;
  color: #3b516f;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-row.overdue {
  color: #b33b4d;
}

.note {
  margin: 0;
  font-size: 12px;
  color: #5f7390;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 31px;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mini-link {
  color: #1d63c6;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}

.mini-link:hover {
  text-decoration: underline;
}

.edit-btn {
  border: 1px solid #ccd8ea;
  border-radius: 999px;
  background: #fff;
  color: #2f4563;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.edit-btn:hover {
  background: #edf4ff;
}

.empty {
  border: 1px dashed #d4ddea;
  border-radius: 10px;
  background: #f9fbff;
  color: #6c7b94;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.modal-shell {
  position: fixed;
  inset: 0;
  background: rgba(18, 25, 38, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.modal-shell[hidden] { display: none; }

.modal {
  width: min(700px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 29, 52, 0.25);
  padding: 14px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.modal-title {
  margin: 0;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 22px;
  letter-spacing: -0.015em;
}

.modal-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.modal-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-grid .full {
  grid-column: 1 / -1;
}

.modal-foot {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.hint {
  margin: 0 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1150px) {
  .controls { grid-template-columns: 1.4fr 1fr 1fr auto auto; }
  .summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  body { overflow: auto; }
  .shell { height: auto; }
  .controls { grid-template-columns: 1fr 1fr 1fr; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board { min-height: 60vh; }
}

@media (max-width: 760px) {
  .shell { width: min(1720px, calc(100vw - 10px)); margin-top: 6px; }
  body { overflow: auto; }
  .shell { height: auto; display: block; }
  .top { padding: 10px; border-radius: 12px; }
  .brand-lockup { width: 100%; flex-direction: column; align-items: flex-start; gap: 8px; }
  .brand-logo { width: min(50px, 16vw); }
  .title { font-size: clamp(22px, 8vw, 30px); }
  .top-tab { font-size: 14px; }
  .controls { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .board { min-height: calc(100vh - 270px); padding: 9px; grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
}
