:root {
  color-scheme: light;
  --bg: #f1f5f6;
  --bg-glow-1: rgba(20, 184, 166, 0.14);
  --bg-glow-2: rgba(59, 130, 246, 0.08);
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --field-bg: #f8fbfb;
  --ink: #0f1c24;
  --muted: #66737f;
  --line: #e3eaee;
  --line-strong: #cfdae0;
  --accent: #0d9488;
  --accent-2: #14b8a6;
  --accent-ink: #0b7a70;
  --accent-soft: #e6f6f3;
  --success: #2f8a57;
  --warning: #c07c14;
  --danger: #dc5b55;
  --danger-soft: #fdf0ef;
  --blue: #3b6db4;
  --shadow: 0 1px 2px rgba(15, 28, 36, 0.05), 0 12px 32px rgba(15, 28, 36, 0.07);
  --shadow-float: 0 8px 30px rgba(15, 28, 36, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1418;
  --bg-glow-1: rgba(20, 184, 166, 0.1);
  --bg-glow-2: rgba(59, 130, 246, 0.07);
  --surface: #171f25;
  --surface-2: #1c262d;
  --field-bg: #131b20;
  --ink: #e9eef2;
  --muted: #8b99a5;
  --line: #26323a;
  --line-strong: #33424c;
  --accent: #1db8a8;
  --accent-2: #2dd4bf;
  --accent-ink: #4adbc8;
  --accent-soft: rgba(29, 184, 168, 0.14);
  --danger-soft: rgba(220, 91, 85, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 0 0, var(--bg-glow-1), transparent 320px),
    radial-gradient(circle at 100% 0, var(--bg-glow-2), transparent 300px),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-y pinch-zoom;
}

button,
a,
label,
select {
  touch-action: manipulation;
}

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

button {
  border: 0;
  cursor: pointer;
  color: inherit;
  background: none;
  padding: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 12px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
}

/* ---------- shell ---------- */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  /* minmax(0, 1fr): auto column would grow to widest child's min-content
     (e.g. the chip row) and push the page past the viewport */
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.topbar,
.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  padding: 12px 16px 118px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent-ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.icon-button:active {
  transform: scale(0.92);
}

/* ---------- floating tab bar ---------- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
  width: min(460px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.tabbar:has(button[hidden]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tabbar button[hidden] {
  display: none;
}

.tabbar button {
  min-width: 0;
  min-height: 52px;
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  border-radius: 16px;
  font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease;
}

.tabbar button b {
  max-width: 100%;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar button.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ---------- layout blocks ---------- */

.stack {
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.candidate-layout {
  display: grid;
  gap: 12px;
}

@media (min-width: 720px) {
  .candidate-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
    align-items: start;
  }
}

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

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

.grid-2[hidden],
.grid-3[hidden] {
  display: none;
}

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

.section-head h2,
.section-head h3 {
  margin: 0;
}

/* ---------- hero ---------- */

.hero-panel,
.hero-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  border: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 255, 255, 0.18), transparent 140px),
    linear-gradient(135deg, #0d9488, #0f766e 55%, #155e75);
}

.hero-panel .eyebrow,
.hero-card .eyebrow {
  color: rgba(255, 255, 255, 0.75);
}

.hero-panel .muted,
.hero-card .muted {
  color: rgba(255, 255, 255, 0.78);
}

.hero-panel h2,
.hero-card h2 {
  max-width: 460px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.hero-panel .button {
  margin-top: 4px;
}

.consent-panel {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--accent-soft);
}

/* ---------- forms ---------- */

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  /* 16px minimum: smaller font-size makes iOS WebView auto-zoom on focus */
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

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

.choice-hint {
  width: 100%;
  margin: 0;
  padding: 11px 13px;
  color: var(--muted);
  background: var(--field-bg);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.choice-invalid .choice-row {
  padding: 6px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
}

.field[hidden] {
  display: none;
}

.choice-row label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.choice-row input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-row label:has(input:checked) {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.details-block {
  border-top: 1px solid var(--line);
}

.details-block summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  list-style: none;
  font-weight: 800;
  cursor: pointer;
}

.details-block summary::-webkit-details-marker {
  display: none;
}

.details-block summary::after {
  content: "+";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 18px;
}

.details-block[open] summary::after {
  content: "−";
}

.details-content {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

/* ---------- buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  font-size: 14.5px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.button:active {
  transform: scale(0.97);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
}

.button.secondary {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.warning {
  background: var(--warning);
  box-shadow: none;
}

.button.danger {
  background: var(--danger);
  box-shadow: none;
}

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

.button.ghost {
  color: var(--accent-ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.button.full {
  width: 100%;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.segmented button {
  min-height: 42px;
  color: var(--muted);
  border-radius: 12px;
  font-weight: 800;
  transition: color 0.2s ease, background 0.2s ease;
}

.segmented button.active {
  color: var(--accent-ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- manager subnav (fixed grid, mirrors the tabbar) ---------- */

.subnav {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  padding: 4px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.subnav button {
  min-width: 0;
  min-height: 52px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 7px 2px;
  color: var(--muted);
  border-radius: 12px;
  transition: color 0.2s ease, background 0.2s ease;
}

.subnav button b {
  max-width: 100%;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subnav button.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.chip {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 15px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 800;
  transition: color 0.15s ease, background 0.15s ease;
}

.chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* ---------- welcome ---------- */

.welcome-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 18, 24, 0.56);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.welcome-backdrop[hidden] {
  display: none;
}

.welcome-dialog {
  width: min(390px, 100%);
  padding: 26px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-float);
  animation: welcome-in 0.22s ease-out;
}

.welcome-dialog .eyebrow {
  margin-bottom: 8px;
}

.welcome-dialog h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: var(--accent-soft);
  border-radius: 20px;
  font-size: 32px;
}

@keyframes welcome-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.broadcast-preview {
  margin: 0;
  padding: 10px 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.broadcast-item > p:last-child {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

/* ---------- job card ---------- */

.job-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.job-visual {
  display: grid;
  gap: 10px;
  padding: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 90% -10%, rgba(255, 255, 255, 0.2), transparent 160px),
    linear-gradient(135deg, #0d9488, #0f766e 50%, #1e3a5f);
}

.job-visual .eyebrow {
  color: rgba(255, 255, 255, 0.75);
}

.job-visual-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.job-visual h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.score {
  --p: 0;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, 0.25) 0);
}

.score b {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 60, 66, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.job-body {
  padding: 16px 18px 18px;
}

.job-body p {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ---------- swipe actions ---------- */

.swipe-actions {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 6px 0 2px;
}

.swipe-btn {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.swipe-btn b {
  font-weight: 700;
}

.swipe-btn span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 22px;
  transition: transform 0.15s ease;
}

.swipe-btn:active span {
  transform: scale(0.88);
}

.swipe-btn.skip span {
  color: var(--danger);
}

.swipe-btn.star span {
  color: var(--warning);
}

.swipe-btn.like span {
  width: 66px;
  height: 66px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 40%, transparent);
  font-size: 26px;
}

/* ---------- meta / pills ---------- */

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 11px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.green {
  color: #1f6f43;
  background: #e7f4eb;
  border-color: transparent;
}

.pill.amber {
  color: #80510d;
  background: #fff2d8;
  border-color: transparent;
}

.pill.blue {
  color: #2d568d;
  background: #e8f0fb;
  border-color: transparent;
}

:root[data-theme="dark"] .pill.green {
  color: #7fd8a3;
  background: rgba(47, 138, 87, 0.18);
}

:root[data-theme="dark"] .pill.amber {
  color: #ecc27c;
  background: rgba(192, 124, 20, 0.16);
}

:root[data-theme="dark"] .pill.blue {
  color: #93b8e8;
  background: rgba(59, 109, 180, 0.18);
}

.pill.glass {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ---------- profile ---------- */

.profile-summary {
  display: grid;
  gap: 12px;
}

.profile-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 20px;
  font-weight: 800;
}

/* ---------- lists / manager ---------- */

.item {
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

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

.item-title {
  margin: 0 0 3px;
  font-weight: 800;
}

.item p:last-child {
  margin-bottom: 0;
}

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

.metric {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.metric span {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.metric b {
  display: block;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 130px) 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}

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

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}

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

.status-select {
  min-height: 38px;
  max-width: 150px;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  /* 16px minimum: smaller font-size makes iOS WebView auto-zoom on focus */
  font-size: 16px;
}

/* ---------- notices / toasts ---------- */

.notice {
  padding: 13px 15px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius-sm);
}

.error {
  color: #b03a36;
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

:root[data-theme="dark"] .error {
  color: #f1938f;
}

.toasts {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

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

.toast.error {
  color: #b03a36;
  background: var(--danger-soft);
}

/* ---------- states ---------- */

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

.small {
  font-size: 12.5px;
}

.loading-state,
.empty-state {
  min-height: 200px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 34px;
}

.empty-title {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  h1 {
    font-size: 23px;
  }

  .content {
    padding: 10px 12px 112px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .metric {
    padding: 9px 10px;
  }

  .metric b {
    font-size: 19px;
  }

  .actions .button {
    flex: 1 1 130px;
  }
}

@media (max-width: 430px) {
  .panel {
    padding: 15px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
  }

  .swipe-actions {
    gap: 16px;
  }
}
