:root {
  color-scheme: light;
  --bg: #f5f8fb;
  --surface: #ffffff;
  --surface-soft: #eef5fa;
  --text: #1b2733;
  --muted: #627386;
  --line: #d8e2eb;
  --accent: #2e9fe6;
  --accent-strong: #0b75bd;
  --green: #2e9b6f;
  --amber: #c48a20;
  --coral: #d86458;
  --ink: #102234;
  --shadow: 0 18px 44px rgba(24, 45, 64, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root.dark {
  color-scheme: dark;
  --bg: #101820;
  --surface: #17222c;
  --surface-soft: #202e3a;
  --text: #edf5fb;
  --muted: #a6b5c4;
  --line: #314454;
  --accent: #57b7ee;
  --accent-strong: #8bd0f7;
  --green: #59c795;
  --amber: #dca94a;
  --coral: #ef8175;
  --ink: #f4f9fc;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form .primary-action {
  width: 100%;
}

.auth-message {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-message[data-tone="error"] {
  border-color: color-mix(in srgb, var(--coral) 40%, var(--line));
  color: var(--coral);
}

.auth-message[data-tone="success"] {
  border-color: color-mix(in srgb, var(--green) 40%, var(--line));
  color: var(--green);
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.1;
}

.brand h1 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.nav-item,
.theme-toggle,
.account-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

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

.nav-item:hover,
.theme-toggle:hover,
.account-button:hover,
.account-button.active,
.nav-item.active {
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.nav-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
}

.sidebar-footer {
  margin-top: auto;
}

.theme-toggle,
.account-button {
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
}

.account-button {
  margin-bottom: 8px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.topbar h2 {
  font-size: 30px;
}

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

.view-mode-toggle {
  display: flex;
  gap: 8px;
}

.search {
  display: flex;
  align-items: center;
  min-width: min(360px, 40vw);
  height: 42px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.primary-action,
.ghost-button,
.chip,
.table-title {
  min-height: 40px;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-action {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  padding: 0 16px;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.ghost-button,
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
}

.ghost-button:hover,
.chip:hover,
.chip.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

.metric strong {
  display: block;
  margin: 14px 0 4px;
  font-size: 32px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.content-grid,
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

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

.panel.wide {
  min-height: 420px;
}

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

.panel-header.compact {
  margin-bottom: 10px;
}

.ranked-list,
.queue-list,
.dev-grid,
.skill-list,
.feedback-list,
.side-stack {
  display: grid;
  gap: 12px;
}

.request-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rank {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.request-main {
  min-width: 0;
}

.request-main h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.request-main p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tag.high,
.tag.needed {
  color: var(--coral);
}

.tag.medium,
.tag.testing {
  color: var(--amber);
}

.tag.low,
.tag.good {
  color: var(--green);
}

.request-actions {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: end;
}

.vote-button,
.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.vote-button {
  min-width: 54px;
  min-height: 40px;
  font-weight: 900;
}

.vote-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.icon-button {
  width: 36px;
  height: 36px;
}

.matrix {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  min-height: 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.matrix-quadrant {
  position: relative;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.matrix-quadrant:nth-child(2n) {
  border-right: 0;
}

.matrix-quadrant:nth-child(n + 3) {
  border-bottom: 0;
}

.matrix-dot {
  position: absolute;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--shadow);
  transform: translate(-50%, 50%);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  line-height: 1.45;
}

.intake-form,
.sandbox-frame {
  min-height: 620px;
}

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

label,
fieldset {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

.segmented-field {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0;
  border: 0;
}

.segmented-field legend {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.segmented-field label {
  margin: 0;
}

.segmented-field input {
  position: absolute;
  opacity: 0;
}

.segmented-field span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
}

.segmented-field input:checked + span {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.template-block {
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.template-questions {
  display: grid;
  gap: 10px;
}

.template-questions label {
  margin: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ai-preview {
  color: var(--muted);
  line-height: 1.5;
}

.ai-preview h4 {
  margin: 16px 0 6px;
  color: var(--text);
}

.score-ring {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 58%, transparent 59%),
    conic-gradient(var(--accent) calc(var(--score) * 1%), var(--line) 0);
  color: var(--accent-strong);
  font-size: 24px;
  font-weight: 900;
}

.queue-toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-panel .panel-header {
  margin: 0;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

.project-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.project-table th,
.project-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.project-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-table td {
  color: var(--text);
  font-weight: 700;
}

.project-table select,
.project-table input {
  min-width: 150px;
}

.table-title {
  display: grid;
  min-width: 260px;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.table-title span {
  color: var(--muted);
  font-size: 12px;
}

.compact-vote {
  min-width: 48px;
}

.dev-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.dev-admin-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dev-admin-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dev-admin-main h4,
.account-profile h4 {
  margin: 0 0 5px;
}

.dev-admin-main p,
.account-profile p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

input[type="range"] {
  accent-color: var(--accent);
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.avatar.large {
  width: 58px;
  height: 58px;
  font-size: 18px;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

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

.dev-card h4 {
  margin: 0 0 8px;
}

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

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

.capacity-bar span.warn {
  background: var(--amber);
}

.capacity-bar span.danger {
  background: var(--coral);
}

.skill-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skill-item strong {
  display: block;
  margin-bottom: 6px;
}

.skill-item span {
  color: var(--muted);
  font-size: 13px;
}

.mock-app {
  overflow: hidden;
  min-height: 500px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.empty-sandbox {
  min-height: 500px;
}

.mock-toolbar {
  display: flex;
  gap: 7px;
  height: 42px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mock-toolbar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.mock-dashboard {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  min-height: 458px;
  padding: 18px;
}

.mock-chart {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, transparent 0 78%, color-mix(in srgb, var(--accent) 24%, transparent) 78%),
    repeating-linear-gradient(90deg, transparent 0 15%, color-mix(in srgb, var(--accent) 38%, transparent) 15% 24%);
}

.mock-chart.tall {
  grid-row: 1 / 3;
  background:
    linear-gradient(180deg, transparent 0 34%, color-mix(in srgb, var(--green) 28%, transparent) 34%),
    repeating-linear-gradient(0deg, transparent 0 44px, color-mix(in srgb, var(--line) 62%, transparent) 44px 46px);
}

.mock-chart.accent {
  background:
    radial-gradient(circle at 30% 40%, color-mix(in srgb, var(--coral) 30%, transparent), transparent 28%),
    radial-gradient(circle at 70% 54%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 24%);
}

.comment-pin {
  position: absolute;
  top: 38%;
  left: 44%;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  font-weight: 900;
}

.comment-pin.second {
  top: 66%;
  left: 72%;
  background: var(--accent);
}

.feedback-item,
.release-notes p {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  line-height: 1.45;
}

.feedback-form {
  margin-top: 12px;
}

.release-notes {
  display: grid;
  gap: 10px;
}

.sign-out-button {
  width: 100%;
  margin-top: 16px;
}

dialog {
  width: min(780px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(6, 18, 28, 0.45);
}

.dialog-content {
  position: relative;
  padding: 20px;
}

.close-dialog {
  position: absolute;
  top: 14px;
  right: 14px;
}

.dialog-content h3 {
  margin: 0 44px 12px 0;
}

.dialog-content h4 {
  margin: 18px 0 8px;
}

.dialog-content p,
.dialog-content li {
  color: var(--muted);
  line-height: 1.5;
}

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

  .brand div:not(.brand-mark),
  .nav-item:not(.active)::after,
  .nav-item,
  .account-button {
    font-size: 0;
  }

  .nav-item,
  .theme-toggle,
  .account-button {
    justify-content: center;
  }

  .theme-toggle span,
  .account-button span {
    display: none;
  }

  .content-grid,
  .split-layout,
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .brand div:not(.brand-mark) {
    display: block;
  }

  .nav-list {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 42px;
    gap: 10px;
    padding: 0 12px;
    font-size: 13px;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .account-button {
    justify-content: center;
  }

  .nav-icon {
    width: 28px;
    height: 28px;
  }

  .theme-toggle {
    margin-top: 10px;
  }

  .theme-toggle span {
    display: inline;
  }

  .account-button span {
    display: inline;
  }

  .workspace {
    padding: 18px 14px 24px;
  }

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

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

  .view-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search {
    min-width: 0;
    width: 100%;
  }

  .metric-grid,
  .form-grid,
  .dev-manager-grid {
    grid-template-columns: 1fr;
  }

  .request-card {
    grid-template-columns: 1fr;
  }

  .request-actions {
    grid-template-columns: auto auto;
    justify-content: start;
    justify-items: start;
  }

  .form-actions {
    flex-direction: column;
  }

  .mock-dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 150px);
  }

  .mock-chart.tall {
    grid-row: auto;
  }
}
