:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #dbe4ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34rem),
    linear-gradient(180deg, #eef5ff 0%, var(--bg) 22rem);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

button,
select,
.file-button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.auth-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

[hidden] {
  display: none !important;
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid rgba(219, 228, 239, 0.9);
  border-radius: var(--radius-xl);
  padding: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-card h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 8vw, 44px);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.link-button {
  width: fit-content;
  border: 0;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.auth-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.success {
  color: var(--success);
}

.auth-hint {
  margin-top: 18px;
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
  line-height: 1.6;
}

.auth-hint code {
  color: var(--text);
  font-weight: 800;
}

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

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

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.hero-copy {
  max-width: 580px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-actions,
.dialog-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.session-bar {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.session-bar span + span::before {
  content: "·";
  margin-right: 10px;
  color: #98a2b3;
}

.session-bar .sync-error {
  color: var(--danger);
}

.session-bar .sync-ok {
  color: var(--success);
}

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

.stat-card,
.panel {
  border: 1px solid rgba(219, 228, 239, 0.9);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.stat-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.stat-card.warning strong {
  color: var(--warning);
}

.panel {
  border-radius: var(--radius-xl);
  padding: 20px;
}

.controls-panel {
  margin-bottom: 16px;
}

.search-box {
  margin-bottom: 16px;
}

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

label span {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  resize: vertical;
}

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

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.application-list {
  display: grid;
  gap: 14px;
}

.group-section {
  display: grid;
  gap: 10px;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.group-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.application-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--panel);
}

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

.company-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.company-line strong {
  font-size: 20px;
  letter-spacing: -0.03em;
}

.position-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #344054;
  font-weight: 800;
}

.position-line a {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  color: #475467;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 800;
}

.pill.stage-active {
  color: #1d4ed8;
  background: var(--primary-soft);
}

.pill.stage-offer {
  color: var(--success);
  background: var(--success-soft);
}

.pill.stage-failed,
.pill.stage-closed {
  color: var(--danger);
  background: var(--danger-soft);
}

.pill.intent-high {
  color: #be123c;
  background: #ffe4e6;
}

.pill.intent-medium {
  color: #b45309;
  background: #fef3c7;
}

.pill.intent-low {
  color: #475569;
  background: #e2e8f0;
}

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

.card-notes {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.card-notes strong {
  color: var(--text);
}

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

.insights {
  display: grid;
  gap: 18px;
}

.insight-group h3 {
  margin: 0 0 10px;
  color: #344054;
  font-size: 14px;
}

.insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bar {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
}

.empty-state {
  border: 1px dashed #b7c5d8;
  border-radius: var(--radius-lg);
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-soft);
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  margin-bottom: 0;
}

.dialog {
  width: min(860px, calc(100% - 24px));
  max-height: calc(100vh - 36px);
  border: 0;
  border-radius: var(--radius-xl);
  padding: 0;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.dialog form {
  padding: 22px;
}

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

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: #eef2f7;
  font-size: 24px;
  line-height: 1;
}

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

.full-width {
  grid-column: 1 / -1;
}

.dialog-footer {
  justify-content: flex-end;
  margin-top: 22px;
}

@media (max-width: 900px) {
  .hero {
    align-items: stretch;
    flex-direction: column;
  }

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

  .control-grid,
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .insight-panel {
    order: -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-actions,
  .dialog-footer,
  .card-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn,
  .file-button {
    width: 100%;
  }

  .auth-card {
    padding: 20px;
  }

  .auth-actions,
  .session-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .session-bar {
    border-radius: var(--radius-md);
    padding: 10px;
  }

  .session-bar span + span::before {
    content: none;
  }

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

  .panel,
  .dialog form {
    padding: 16px;
  }

  .card-main {
    display: grid;
  }
}
