:root {
  --paper: #f7f8fb;
  --ink: #24272b;
  --muted: #66707a;
  --line: #dfe4e8;
  --surface: #ffffff;
  --teal: #087c72;
  --teal-soft: #e3f4f1;
  --coral: #dd5649;
  --coral-soft: #fde8e5;
  --green: #2d8a57;
  --green-soft: #e5f4eb;
  --blue: #2c73c9;
  --blue-soft: #e6f0fb;
  --yellow: #d49a00;
  --yellow-soft: #fff4ce;
  --shadow: 0 16px 40px rgba(36, 39, 43, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 28px 22px;
  color: #ffffff;
  background: #24272b;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  font-size: 22px;
  font-weight: 800;
}

.brand-block h1,
.topbar h2,
.section-heading h2,
.focus-panel h2 {
  margin: 0;
}

.brand-block h1 {
  max-width: 176px;
  font-size: 20px;
  line-height: 1.25;
}

.credit-line {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 750;
}

.eyebrow {
  margin: 0 0 6px;
  color: currentColor;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  opacity: 0.72;
  text-transform: uppercase;
}

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

.nav-item {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #ffffff;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
}

.nav-item.is-active,
.nav-item:hover {
  color: var(--ink);
  background: #ffffff;
}

.focus-panel {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

.focus-panel img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.focus-panel p:last-child {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.7;
}

.workspace {
  display: grid;
  gap: 22px;
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar h2 {
  max-width: 760px;
  font-size: 30px;
  line-height: 1.22;
}

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

.primary-action,
.secondary-action {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 750;
}

.primary-action {
  border: 1px solid var(--teal);
  color: #ffffff;
  background: var(--teal);
}

.secondary-action {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.metric-item {
  min-height: 122px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.metric-item.urgent {
  border-left-color: var(--coral);
}

.metric-item.good {
  border-left-color: var(--green);
}

.metric-item span,
.metric-item em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.metric-item strong {
  display: block;
  margin: 8px 0;
  font-size: 32px;
  line-height: 1;
}

.metric-item:hover,
.metric-item:focus-visible,
.insight-item:hover,
.insight-item:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(160px, 0.6fr));
  gap: 12px;
  align-items: end;
}

.control-strip label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.control-strip input,
.control-strip select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  padding: 0 12px;
}

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

.insight-item {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
  text-align: left;
  transition:
    outline-color 160ms ease,
    transform 160ms ease;
}

.insight-item.danger {
  background: var(--coral-soft);
}

.insight-item.calm {
  background: var(--green-soft);
}

.insight-item strong,
.insight-item span {
  display: block;
}

.insight-item span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 14px;
  align-items: start;
  min-height: 420px;
}

.kanban-column {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.column-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 36px;
}

.column-heading h3 {
  margin: 0;
  font-size: 16px;
}

.column-heading span {
  min-width: 32px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
  padding: 5px 8px;
  font-weight: 800;
}

.card-stack {
  display: grid;
  gap: 10px;
}

.application-card {
  display: grid;
  gap: 12px;
  width: 100%;
  min-height: 194px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  text-align: left;
  box-shadow: 0 8px 22px rgba(36, 39, 43, 0.06);
}

.application-card:hover,
.application-card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.company-logo {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 850;
}

.company-main {
  min-width: 0;
  flex: 1;
}

.company-main strong,
.company-main span {
  display: block;
}

.company-main strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.company-main span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.risk-tag {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--muted);
  background: #edf1f4;
  font-size: 12px;
  font-weight: 800;
}

.risk-tag.urgent {
  color: #9d251a;
  background: var(--coral-soft);
}

.risk-tag.safe {
  color: #14623a;
  background: var(--green-soft);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-meta span {
  border-radius: 8px;
  color: var(--muted);
  background: #f1f4f6;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.progress-line {
  display: grid;
  gap: 8px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 8px;
  background: #edf1f4;
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--teal);
}

.next-step {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
  text-align: center;
  padding: 18px;
}

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

.timeline-panel,
.material-panel,
.interview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.jump-section {
  scroll-margin-top: 28px;
}

.jump-section:focus {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

.jump-section.is-attention,
.board.is-attention {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
}

.section-heading {
  margin-bottom: 14px;
}

.split-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.compact-action {
  min-height: 36px;
  padding: 7px 10px;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px;
}

.expandable-item {
  cursor: pointer;
}

.expandable-item:hover,
.expandable-item:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  background: #f8fafb;
}

.expand-hint {
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
}

.timeline time {
  border-radius: 8px;
  color: var(--teal);
  background: var(--teal-soft);
  text-align: center;
  padding: 6px 8px;
  font-weight: 800;
}

.timeline span {
  color: var(--muted);
  line-height: 1.7;
}

.timeline-item-body {
  display: grid;
  gap: 8px;
}

.timeline-actions {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.is-expanded .timeline-actions {
  display: flex;
}

.timeline-actions button {
  min-height: 32px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  color: var(--teal);
  background: #ffffff;
  padding: 5px 9px;
  font-weight: 800;
}

.timeline-actions .danger-action {
  border-color: var(--coral);
  color: #9d251a;
  background: var(--coral-soft);
}

.material-list {
  display: grid;
  gap: 13px;
}

.material-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 68px;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 6px;
  text-align: left;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.material-row span,
.material-row strong {
  font-size: 14px;
}

.material-row span {
  color: var(--muted);
}

.material-row strong {
  text-align: right;
}

.material-row:hover,
.material-row:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  background: #f8fafb;
}

.material-actions {
  grid-column: 1 / -1;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.is-expanded .material-actions {
  display: flex;
}

.material-actions button {
  min-height: 32px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  color: var(--teal);
  background: #ffffff;
  padding: 5px 9px;
  font-weight: 800;
}

.material-actions .danger-action {
  border-color: var(--coral);
  color: #9d251a;
  background: var(--coral-soft);
}

meter {
  width: 100%;
  height: 10px;
}

meter::-webkit-meter-bar {
  border: 0;
  border-radius: 8px;
  background: #edf1f4;
}

meter::-webkit-meter-optimum-value {
  border-radius: 8px;
  background: var(--teal);
}

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

.review-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  padding: 12px;
}

.review-item strong,
.review-item span {
  overflow-wrap: anywhere;
}

.review-item span {
  color: var(--muted);
  line-height: 1.55;
}

.review-item button {
  width: fit-content;
  min-height: 34px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  color: var(--teal);
  background: #ffffff;
  padding: 6px 10px;
  font-weight: 800;
}

.review-actions {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.is-expanded .review-actions {
  display: flex;
}

.review-actions .danger-action {
  min-height: 34px;
  padding: 6px 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 12;
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(8, 124, 114, 0.22);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(36, 39, 43, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  transform: translate(-50%, 12px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 9;
  border: 0;
  background: rgba(36, 39, 43, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.drawer-open {
  overflow: hidden;
}

.detail-drawer {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 11;
  display: grid;
  gap: 14px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
  transform: translateX(calc(100% + 40px));
  transition: transform 180ms ease;
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  width: 82px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  font-size: 15px;
  font-weight: 850;
  line-height: 1;
  padding: 0 12px;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.drawer-close span {
  display: block;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
}

.drawer-close:hover,
.drawer-close:focus-visible,
.review-item button:hover,
.review-item button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.detail-drawer h2 {
  margin: 18px 0 0;
}

.detail-drawer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.drawer-section {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.drawer-actions {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.danger-action {
  min-height: 42px;
  border: 1px solid var(--coral);
  border-radius: 8px;
  color: #9d251a;
  background: var(--coral-soft);
  padding: 10px 14px;
  font-weight: 850;
}

.danger-action:hover,
.danger-action:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.application-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0;
}

.application-dialog::backdrop {
  background: rgba(36, 39, 43, 0.44);
}

.application-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.form-heading h2 {
  margin: 0;
}

.form-close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
}

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

.application-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.application-form input,
.application-form select,
.application-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 10px 12px;
}

.application-form input,
.application-form select {
  min-height: 42px;
}

.application-form textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .focus-panel {
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    margin-top: 0;
  }

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

  .bottom-grid {
    grid-auto-columns: minmax(300px, 1fr);
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
  }

  .timeline-panel,
  .material-panel,
  .interview-panel {
    scroll-snap-align: start;
  }
}

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .workspace {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

  .topbar {
    display: grid;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .top-actions,
  .top-actions button {
    width: 100%;
  }

  .metrics-grid,
  .control-strip,
  .insight-row,
  .board,
  .focus-panel {
    grid-template-columns: 1fr;
  }

  .bottom-grid {
    grid-auto-columns: minmax(300px, calc(100vw - 36px));
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
  }

  .focus-panel img {
    max-height: 170px;
  }

  .material-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .material-row strong {
    grid-column: 2;
    text-align: left;
  }

  .review-item button {
    width: 100%;
  }

  .split-heading {
    display: grid;
  }

  .is-expanded .review-actions,
  .is-expanded .timeline-actions,
  .is-expanded .material-actions {
    display: grid;
  }

  .compact-action,
  .review-actions button,
  .timeline-actions button,
  .material-actions button {
    width: 100%;
  }

  .detail-drawer {
    top: 16px;
    right: 16px;
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
  }

  .form-grid,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }

  .form-actions button {
    width: 100%;
  }
}
