:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #151515;
  --panel-strong: #1d1d1d;
  --line: #2a2a2a;
  --muted: #a9a9a9;
  --text: #f4f4f1;
  --orange: #ff7a1a;
  --orange-dark: #b84d05;
  --green: #29c17e;
  --yellow: #f2c94c;
  --red: #ff5f57;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 360px;
  min-height: 100vh;
}

.sidebar,
.detail-pane {
  background: #101010;
  border-color: var(--line);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px;
}

.detail-pane {
  border-left: 1px solid var(--line);
  padding: 24px;
  overflow-y: auto;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--orange);
  color: #080808;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.privacy-note,
.eyebrow,
.panel-heading span,
.profile-card p,
.detail-meta {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.nav-item {
  text-align: left;
  padding: 0 12px;
}

.nav-item.active,
.secondary-button:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.privacy-note {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
}

.workspace {
  padding: 28px;
  overflow-y: auto;
}

.topbar,
.panel-heading,
.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--orange);
  color: #0b0b0b;
  font-weight: 800;
}

.primary-button:hover {
  background: #ff923f;
}

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

.stats-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

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

.hidden {
  display: none;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e0e0e;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
}

.profile-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.limit-control {
  display: flex;
  gap: 6px;
  align-items: center;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 14px;
  cursor: pointer;
}

.profile-card.active-profile {
  border-color: rgba(242, 201, 76, 0.95);
  background: #2a2412;
  box-shadow: inset 4px 0 0 var(--yellow);
}

.profile-card:hover,
.profile-card:focus-visible {
  border-color: var(--orange-dark);
}

.profile-card:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.profile-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.profile-card h3 {
  margin-bottom: 4px;
  font-size: 17px;
}

.profile-card p {
  margin-bottom: 12px;
}

.presence-banner {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 12px;
  border: 1px solid rgba(242, 201, 76, 0.55);
  border-radius: 8px;
  padding: 4px 9px;
  background: rgba(242, 201, 76, 0.14);
  color: #ffe28a;
  font-size: 12px;
  font-weight: 800;
}

.detail-presence {
  margin-top: 8px;
}

.badges,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: #d7d7d7;
  font-size: 12px;
}

.badge.available {
  color: var(--green);
  border-color: rgba(41, 193, 126, 0.45);
}

.badge.limited {
  color: var(--yellow);
  border-color: rgba(242, 201, 76, 0.45);
}

.badge.unavailable {
  color: var(--red);
  border-color: rgba(255, 95, 87, 0.45);
}

.score {
  color: var(--orange);
  font-weight: 900;
}

.tiny-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  padding: 0 10px;
}

.tiny-button:hover {
  border-color: var(--orange);
}

.tiny-button.active {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(242, 201, 76, 0.1);
}

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

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

.profile-analyzer {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #101010;
}

.profile-analyzer textarea {
  min-height: 130px;
}

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

.analysis-summary {
  color: var(--muted);
  font-size: 13px;
}

.form-actions {
  grid-column: 1 / -1;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.pipeline-column {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #101010;
}

.pipeline-column h3 {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

.detail-pane h2 {
  margin-bottom: 6px;
}

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

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--orange);
  color: var(--orange);
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
}

.detail-status {
  margin-top: 14px;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.interaction-form {
  display: grid;
  gap: 10px;
}

.interaction-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

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

.attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #151515;
}

.attachment-item a {
  color: var(--text);
}

.inline-upload {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #101010;
}

.interaction {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #151515;
}

.empty-detail,
.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

.auth-page {
  min-height: 100vh;
  background: var(--bg);
}

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

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 2px 0;
  text-align: left;
  font-size: 13px;
}

.link-button:hover,
.link-button:focus-visible {
  color: var(--orange);
}

.auth-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--green);
  font-size: 13px;
}

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

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .detail-pane {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  .shell {
    display: block;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats-grid,
  .filters,
  .profile-form,
  .attachment-fields,
  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions,
  .panel-heading,
  .result-controls {
    align-items: flex-start;
    flex-direction: column;
  }
}
