:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f4;
  --text: #1c2529;
  --muted: #6b7a80;
  --line: #d9e1e5;
  --accent: #0f7b6c;
  --accent-strong: #095e53;
  --warn: #b76119;
  --danger: #b83b3b;
  --shadow: 0 10px 24px rgba(22, 35, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: #18272d;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 6px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: #f2c36b;
  color: #18272d;
  border-radius: 6px;
  font-weight: 700;
}

.brand small {
  display: block;
  color: #b8c4c8;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #dce6e9;
  border-color: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  color: white;
}

.app {
  margin-left: 232px;
  min-height: 100vh;
  padding: 22px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

.topbar p {
  color: var(--muted);
  margin-top: 5px;
}

.topbar-actions {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 40px;
  gap: 8px;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.table-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.panel {
  padding: 16px;
}

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

.panel h2 {
  font-size: 16px;
}

.stage-bars {
  display: grid;
  gap: 10px;
}

.stage-line {
  display: grid;
  grid-template-columns: 110px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar select {
  max-width: 220px;
}

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

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.table-head {
  box-shadow: none;
  background: var(--surface-2);
  color: var(--muted);
  padding: 10px 14px;
}

.table-head strong {
  margin: 0;
  font-size: 13px;
}

.table-row.three {
  grid-template-columns: 1.2fr 1fr auto;
}

.table-row strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.badge.interview,
.badge.offer {
  background: #e1f2ee;
  color: var(--accent-strong);
}

.badge.terminated {
  background: #f8e6e4;
  color: var(--danger);
}

.badge.position-recruiting,
.badge.position-open {
  background: #e1f2ee;
  color: var(--accent-strong);
}

.badge.position-completed {
  background: #e9edf7;
  color: #31446f;
}

.badge.position-stopped,
.badge.position-closed,
.badge.position-draft {
  background: #f8e6e4;
  color: var(--danger);
}

.row-actions {
  display: flex;
  gap: 8px;
}

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(24, 39, 45, 0.42);
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-head {
  margin-bottom: 14px;
}

.duplicate-alert {
  border: 1px solid #ffc6c6;
  background: #fff4f4;
  color: #ff2f2f;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.duplicate-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.duplicate-list {
  display: grid;
  gap: 8px;
}

.duplicate-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: white;
  border: 1px solid #ffdada;
  color: var(--text);
}

.duplicate-card span {
  color: #ff2f2f;
  font-size: 12px;
}

.duplicate-card small {
  color: var(--muted);
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

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

.form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.form-grid label.wide {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  background: #18272d;
  color: white;
  border-radius: 6px;
  padding: 11px 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

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

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .app {
    margin-left: 0;
  }

  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .metrics,
  .content-grid,
  .table-row,
  .table-row.three,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
