:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #63706c;
  --line: #dbe2dc;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --field: #f2f6f4;
  --green: #1e6b4f;
  --green-dark: #164d3b;
  --gold: #b8872f;
  --clay: #a6533b;
  --blue: #2f5f8f;
  --shadow: 0 18px 50px rgba(31, 45, 39, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(30, 107, 79, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(184, 135, 47, 0.1), transparent 32%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

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

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

.brand-block p,
.eyebrow,
.table-toolbar p,
.detail-empty p,
.filter-panel span {
  color: var(--muted);
  font-size: 13px;
}

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

.nav-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.nav-tab.active {
  border-color: rgba(30, 107, 79, 0.18);
  background: #eef6f1;
}

.nav-tab strong {
  color: var(--green);
  font-size: 12px;
}

.filter-panel {
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

.filter-panel label {
  display: grid;
  gap: 6px;
}

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

input[type="search"],
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.range-row input {
  grid-column: 1 / -1;
  accent-color: var(--green);
}

.range-row output {
  min-width: 42px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.switch-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.main-panel {
  min-width: 0;
  padding: 26px;
}

.topbar,
.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 30px;
  letter-spacing: 0;
}

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

.signed-in-user {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.ghost-button,
.solid-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.solid-button {
  border: 1px solid var(--green-dark);
  background: var(--green);
  color: #fff;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.metric-strip article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-strip strong {
  display: block;
  margin-top: 6px;
  color: var(--green-dark);
  font-size: 25px;
}

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

.table-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.table-toolbar {
  min-height: 70px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar h3 {
  font-size: 18px;
}

.table-toolbar select {
  max-width: 210px;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 245px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f4;
  color: #44514d;
  font-size: 12px;
  font-weight: 800;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f2f7f4;
}

.score-pill,
.tax-pill,
.class-pill,
.watch-pill,
.target-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.score-pill {
  background: #e6f3ec;
  color: var(--green-dark);
}

.tax-pill {
  background: #fbece6;
  color: var(--clay);
}

.class-pill {
  background: #eef2f8;
  color: var(--blue);
}

.watch-pill {
  background: #f7eddc;
  color: #7d541a;
}

.target-pill {
  background: #e8f3ec;
  color: var(--green-dark);
}

.target-pill.unrealistic {
  background: #f3e7e4;
  color: var(--clay);
}

.detail-panel {
  position: sticky;
  top: 26px;
  min-height: 380px;
  padding: 18px;
}

.detail-empty {
  display: grid;
  align-content: center;
  min-height: 330px;
  gap: 8px;
  color: var(--muted);
}

.detail-content {
  display: grid;
  gap: 16px;
}

.detail-heading {
  display: grid;
  gap: 6px;
}

.detail-heading h3 {
  font-size: 20px;
  line-height: 1.2;
}

.detail-meta {
  color: var(--muted);
  font-size: 13px;
}

.detail-list {
  display: grid;
  gap: 9px;
}

.detail-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.detail-row span:first-child {
  color: var(--muted);
}

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

.watch-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.public-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  padding: 10px;
}

.detail-actions a,
.detail-actions button,
.watch-actions button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 14px;
  align-content: center;
  background: rgba(247, 244, 238, 0.94);
  color: var(--green-dark);
  z-index: 10;
}

.loading-overlay.hidden {
  display: none;
}

.loader {
  width: 46px;
  height: 46px;
  border: 4px solid #d7e4dc;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

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

  .detail-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .main-panel,
  .sidebar {
    padding: 16px;
  }

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

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

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