:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #687383;
  --line: #d8dee8;
  --panel: #ffffff;
  --surface: #f6f7f9;
  --soft: #edf4f0;
  --accent: #147d64;
  --accent-strong: #0c5f4b;
  --warm: #c4682f;
  --dark: #273343;
  --blue: #376a9e;
  --shadow: 0 18px 50px rgba(24, 34, 48, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 24px;
  color: #f8fafc;
  background: #243142;
}

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: #e7f6ef;
  color: #0c5f4b;
  font-size: 18px;
  font-weight: 800;
}

.brand-block h1,
.brand-block p,
.topbar h2,
.section-heading h2,
.inspector-header h2,
.empty-state h3 {
  margin: 0;
}

.brand-block h1 {
  font-size: 20px;
}

.brand-block p {
  margin-top: 6px;
  color: rgba(248, 250, 252, 0.72);
  line-height: 1.45;
}

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

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 250, 252, 0.82);
  text-align: left;
}

.step-item span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 12px;
  font-weight: 800;
}

.step-item.active {
  border-color: rgba(231, 246, 239, 0.78);
  background: rgba(231, 246, 239, 0.12);
  color: #ffffff;
}

.side-panel {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.side-panel h2 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  margin: 12px 0;
  color: rgba(248, 250, 252, 0.76);
  line-height: 1.35;
}

.workspace {
  padding: 28px;
}

.topbar,
.section-heading,
.inspector-header {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 22px;
}

.topbar h2,
.section-heading h2 {
  font-size: 24px;
  line-height: 1.15;
}

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

.topbar-actions,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.dark-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 750;
}

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

.dark-btn {
  border: 1px solid var(--dark);
  background: var(--dark);
  color: #ffffff;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--dark);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  gap: 18px;
}

.media-panel,
.inspector,
.profile-editor,
.claim-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 520px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, rgba(31, 41, 51, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 41, 51, 0.08) 1px, transparent 1px), #eef2f5;
  background-size: 28px 28px;
}

.dropzone.media-loaded {
  min-height: 520px;
}

.dropzone.drag-over {
  outline: 3px solid rgba(20, 125, 100, 0.26);
  outline-offset: -3px;
}

.media-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.empty-state {
  z-index: 1;
  display: grid;
  width: min(720px, calc(100% - 40px));
  place-self: center;
  place-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.empty-state h3 {
  font-size: 22px;
}

.empty-state p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.capture-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.source-card {
  display: grid;
  min-height: 150px;
  gap: 8px;
  align-content: center;
  justify-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  text-align: center;
}

.source-card:hover,
.source-card:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(20, 125, 100, 0.16);
  outline-offset: 0;
}

.source-card strong {
  font-size: 16px;
}

.source-card small {
  max-width: 220px;
  color: var(--muted);
  line-height: 1.35;
}

.source-icon {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  border: 2px solid var(--dark);
  border-radius: 8px;
}

.camera-icon::before {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  content: "";
}

.camera-icon::after {
  position: absolute;
  top: -7px;
  left: 12px;
  width: 20px;
  height: 8px;
  border-radius: 5px 5px 0 0;
  background: var(--dark);
  content: "";
}

.library-icon {
  background:
    linear-gradient(135deg, transparent 48%, rgba(20, 125, 100, 0.28) 49%),
    #ffffff;
}

.library-icon::before {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--warm);
  content: "";
}

.upload-glyph {
  width: 64px;
  height: 64px;
  border: 2px solid #9aa8b7;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 50%, rgba(20, 125, 100, 0.28) 50%),
    #ffffff;
}

.media-stage {
  position: relative;
  min-height: inherit;
}

.media-stage img,
.media-stage video {
  display: none;
  width: 100%;
  height: 520px;
  object-fit: cover;
}

.media-stage.image-mode img,
.media-stage.video-mode video {
  display: block;
}

.hidden {
  display: none;
}

.face-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.face-box {
  position: absolute;
  min-width: 88px;
  min-height: 104px;
  border: 2px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.04);
}

.face-box button {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  min-height: 30px;
  padding: 0 9px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--dark);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
}

.face-box.matched {
  border-color: #3f86bd;
}

.face-box.placeholder {
  border-color: #d98143;
}

.face-box.claimed {
  border-color: #14a57f;
}

.analysis-bar {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.analysis-bar span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde4ec;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  margin: 0;
  background: var(--accent);
  transition: width 280ms ease;
}

.inspector {
  min-height: 600px;
  padding: 18px;
}

.inspector-header h2 {
  font-size: 20px;
}

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

select {
  width: auto;
  min-height: 38px;
  padding: 0 34px 0 11px;
}

.person-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.person-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.person-card.active {
  border-color: var(--accent);
  background: var(--soft);
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #e8eef4;
  color: var(--dark);
  font-weight: 850;
}

.person-card strong,
.person-card span {
  display: block;
}

.person-card strong {
  overflow-wrap: anywhere;
}

.person-card .sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.mini-status,
.status-pill {
  display: inline-grid;
  min-height: 25px;
  place-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.mini-status.matched,
.status-pill.matched {
  background: #e8f2fb;
  color: var(--blue);
}

.mini-status.placeholder,
.status-pill.placeholder {
  background: #fff0e6;
  color: var(--warm);
}

.mini-status.claimed,
.status-pill.claimed {
  background: #e7f6ef;
  color: var(--accent-strong);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.58fr);
  gap: 18px;
  margin-top: 18px;
}

.profile-editor,
.claim-panel {
  padding: 18px;
}

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

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

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

input,
textarea {
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 520;
}

textarea {
  resize: vertical;
}

.editor-actions {
  margin-top: 16px;
}

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

.timeline li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
}

.timeline li > span {
  position: relative;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  border: 2px solid #aab4c0;
  border-radius: 999px;
}

.timeline li.done > span {
  border-color: var(--accent);
  background: var(--accent);
}

.timeline p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 15px;
  border: 1px solid rgba(31, 41, 51, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

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

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

  .sidebar {
    min-height: auto;
  }

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

  .main-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

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

  .topbar,
  .section-heading,
  .inspector-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .step-list {
    grid-template-columns: 1fr 1fr;
  }

  .dropzone,
  .dropzone.media-loaded {
    min-height: 390px;
  }

  .media-stage img,
  .media-stage video {
    height: 390px;
  }

  .dropzone {
    min-height: 640px;
  }

  .capture-options {
    grid-template-columns: 1fr;
  }

  .source-card {
    min-height: 116px;
  }

  .analysis-bar {
    grid-template-columns: 1fr;
  }

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

  .person-card {
    grid-template-columns: 40px 1fr;
  }

  .person-card .mini-status {
    grid-column: 2;
    justify-self: start;
  }
}
