:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #152033;
  --muted: #64748b;
  --border: #e2e8f0;
  --soft: #f8fafc;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 22px;
  --blue: #2563eb;
  --purple: #7c3aed;
  --orange: #f59e0b;
  --green: #16a34a;
  --red: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.11), transparent 30rem),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.page-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 54px);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-text {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.filter-btn,
.small-btn,
.danger-btn {
  border: 0;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.primary-btn {
  padding: 13px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.25);
  font-weight: 800;
  white-space: nowrap;
}

.primary-btn:hover,
.ghost-btn:hover,
.filter-btn:hover,
.small-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  padding: 12px 17px;
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--border);
  font-weight: 700;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(226, 232, 240, 0.78);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.05);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 340px;
  min-width: 220px;
  color: var(--muted);
  font-weight: 700;
}

.search-wrap input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: 0;
  background: #fff;
}

.search-wrap input:focus,
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus,
.stage-card-form input:focus,
.stage-card-form textarea:focus {
  border-color: rgba(37, 99, 235, 0.62);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-btn {
  padding: 10px 14px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  font-weight: 800;
}

.filter-btn.active {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(226, 232, 240, 0.82);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.summary-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-card strong {
  font-size: 30px;
  line-height: 1;
}

.table-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table-scroll {
  overflow-x: auto;
  max-height: calc(100vh - 280px);
  min-height: 380px;
}

.company-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

.company-table th,
.company-table td {
  padding: 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.company-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #475569;
  background: rgba(248, 250, 252, 0.96);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.company-table tbody tr:hover > td {
  background: #fbfdff;
}

.sticky-col {
  position: sticky !important;
  left: 0;
  z-index: 4 !important;
  min-width: 190px;
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 12px 0 20px rgba(15, 23, 42, 0.04);
}

.company-table th.sticky-col {
  background: rgba(248, 250, 252, 0.98) !important;
}

.status-col {
  min-width: 420px;
}

.actions-col {
  width: 146px;
}

.company-name {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.company-name strong {
  font-size: 16px;
}

.company-name span {
  color: var(--muted);
  font-size: 13px;
}

.status-cell {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 360px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.status-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  background: var(--soft);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status-blue { color: var(--blue); }
.status-purple { color: var(--purple); }
.status-orange { color: var(--orange); }
.status-green { color: var(--green); }
.status-red { color: var(--red); }

.chevron {
  color: var(--muted);
  font-size: 18px;
  transition: transform 0.2s ease;
}

.status-cell[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.progress-track {
  position: relative;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, currentColor, currentColor) 0 0 / var(--progress, 0%) 100% no-repeat,
    #e5e7eb;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.25s ease;
}

.progress-fill.status-blue { background: var(--blue); }
.progress-fill.status-purple { background: var(--purple); }
.progress-fill.status-orange { background: var(--orange); }
.progress-fill.status-green { background: var(--green); }
.progress-fill.status-red { background: var(--red); }

.mini-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mini-step {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #fff;
  background: #cbd5e1;
  font-size: 11px;
  line-height: 1;
}

.mini-step.done .mini-dot { background: var(--green); }
.mini-step.current .mini-dot { background: var(--orange); }
.mini-step.rejected .mini-dot { background: var(--red); }

.expanded-row td {
  padding: 0 !important;
  background: #f8fafc !important;
}

.expanded-panel {
  margin: 0;
  padding: 22px 24px 24px 220px;
  border-bottom: 1px solid var(--border);
}

.expanded-inner {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.06);
}

.expanded-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.expanded-header h3 {
  margin-bottom: 4px;
  font-size: 22px;
}

.expanded-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 26px 0 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 28px;
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
}

.timeline-stage {
  position: relative;
  z-index: 1;
  min-height: 156px;
}

.timeline-marker {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  border: 8px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #cbd5e1;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  font-weight: 900;
}

.timeline-stage.done .timeline-marker { background: var(--green); }
.timeline-stage.current .timeline-marker { background: var(--orange); }
.timeline-stage.rejected .timeline-marker { background: var(--red); }

.timeline-stage h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.stage-date {
  margin-bottom: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.stage-comment {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-item {
  padding: 12px;
  border-radius: 16px;
  background: var(--soft);
  border: 1px solid var(--border);
}

.detail-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-item strong {
  font-size: 14px;
}

.row-actions,
.expanded-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.small-btn,
.danger-btn {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 900;
}

.small-btn {
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--border);
}

.danger-btn {
  color: var(--red);
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.empty-state {
  padding: 54px 20px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.modal {
  width: min(980px, calc(100% - 30px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(5px);
}

.modal-card {
  overflow: auto;
  max-height: min(860px, calc(100vh - 32px));
  padding: 24px;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--border);
  font-size: 28px;
  line-height: 1;
}

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

label {
  display: grid;
  gap: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}

.form-grid input,
.form-grid textarea,
.form-grid select,
.stage-card-form input,
.stage-card-form textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--text);
  background: #fff;
  outline: 0;
  font-weight: 600;
}

textarea {
  resize: vertical;
}

.wide-field {
  grid-column: 1 / -1;
}

.section-title {
  margin: 22px 0 12px;
}

.stage-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stage-card-form {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--soft);
}

.stage-card-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.check-label input {
  width: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .expanded-panel {
    padding-left: 24px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 24px, 1440px);
    padding-top: 20px;
  }

  .hero,
  .toolbar,
  .expanded-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .form-grid,
  .stage-form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .timeline {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

  .timeline::before {
    top: 0;
    bottom: 0;
    left: 29px;
    right: auto;
    width: 4px;
    height: auto;
  }

  .timeline-stage {
    display: grid;
    grid-template-columns: 74px 1fr;
    min-height: 0;
  }

  .timeline-marker {
    margin-bottom: 0;
  }
}
