:root {
  --ink: #181715;
  --muted: #77736b;
  --soft: #f8f5ed;
  --paper: rgba(255, 253, 247, 0.72);
  --paper-strong: rgba(255, 254, 250, 0.86);
  --line: rgba(174, 145, 82, 0.28);
  --line-soft: rgba(174, 145, 82, 0.16);
  --gold: #c7a452;
  --gold-dark: #806327;
  --gold-soft: rgba(199, 164, 82, 0.16);
  --green: #3f8750;
  --red: #8f2d2d;
  --shadow: 0 34px 100px rgba(72, 57, 28, 0.16);
  --soft-shadow: 0 18px 60px rgba(72, 57, 28, 0.1);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 16%, rgba(188, 165, 106, 0.2), transparent 21%),
    radial-gradient(circle at 84% 16%, rgba(188, 165, 106, 0.16), transparent 24%),
    radial-gradient(circle at 54% 86%, rgba(155, 123, 52, 0.14), transparent 28%),
    linear-gradient(180deg, #fffefd 0%, #fbf8f0 48%, #eee8d8 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.72)),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.76), transparent 20%),
    radial-gradient(circle at 72% 20%, rgba(255, 255, 255, 0.66), transparent 18%);
  backdrop-filter: blur(12px);
}

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

button,
input,
select {
  font: inherit;
}

button,
.app-tile {
  border-radius: 999px;
}

button {
  min-height: 54px;
  border: 1px solid rgba(122, 94, 39, 0.34);
  background:
    linear-gradient(90deg, rgba(131, 96, 29, 0.98), rgba(221, 185, 92, 0.98), rgba(128, 99, 39, 0.98));
  color: #fffaf0;
  cursor: pointer;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -8px 18px rgba(82, 56, 12, 0.22),
    0 14px 34px rgba(88, 67, 25, 0.18);
}

button:hover {
  filter: brightness(1.03);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  filter: grayscale(0.18);
}

input,
select {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(133, 105, 48, 0.36);
  border-radius: 999px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.46);
  color: var(--ink);
  font-weight: 600;
  box-shadow:
    inset 0 1px 2px rgba(80, 64, 30, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.78);
}

input::placeholder {
  color: rgba(94, 90, 82, 0.52);
}

input:focus,
select:focus {
  border-color: rgba(128, 99, 39, 0.68);
  outline: 3px solid rgba(199, 164, 82, 0.18);
}

label {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.intro {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: clamp(30px, 5vw, 86px);
}

.intro::after,
.apps-shell::after,
.workspace-shell::after,
.registry-shell::after {
  content: "";
  position: absolute;
  inset: 14px;
  pointer-events: none;
  border: 1px solid rgba(214, 184, 112, 0.18);
  border-radius: calc(var(--radius-xl) - 8px);
}

.brand,
.apps-brand,
.workspace-brand {
  display: block;
  color: inherit;
  text-decoration: none;
}

.brand img,
.apps-brand img,
.workspace-brand img {
  display: block;
  height: auto;
  filter: drop-shadow(0 20px 32px rgba(82, 68, 37, 0.16));
}

.brand img {
  width: min(310px, 58vw);
}

.hero-copy {
  margin: 0 auto;
  text-align: center;
}

h1,
.panel-heading h2 {
  margin-bottom: 0;
  color: rgba(137, 109, 50, 0.78);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(54px, 4.6vw, 96px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.95;
  white-space: nowrap;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.82),
    0 10px 28px rgba(126, 97, 39, 0.15);
}

.login-panel {
  width: min(420px, 100%);
  margin-top: clamp(30px, 4vw, 44px);
}

.login-form {
  display: grid;
  gap: 14px;
}

.intro .login-panel {
  position: relative;
  display: grid;
  width: min(620px, 100%);
  margin-top: 0;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: clamp(22px, 3vw, 34px);
  padding: clamp(34px, 5vw, 58px) clamp(24px, 4vw, 46px);
  border: 2px solid rgba(158, 128, 63, 0.46);
  border-radius: clamp(30px, 4vw, 48px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.38), rgba(255, 253, 247, 0.68)),
    rgba(255, 255, 255, 0.56);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.intro .brand {
  z-index: 1;
  margin: 0;
  justify-self: center;
}

.intro .hero-copy {
  z-index: 1;
  width: 100%;
  min-width: 0;
  justify-self: center;
  margin-top: 0;
  overflow: hidden;
}

.intro h1 {
  font-size: clamp(52px, 7vw, 82px);
}

.intro .login-form {
  z-index: 1;
  width: min(430px, 100%);
  max-width: none;
  margin: 0 auto;
  justify-self: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.form-note {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.apps-view,
.workspace-view,
.registry-view {
  min-height: 100vh;
  padding: clamp(18px, 3.5vw, 54px);
}

.apps-shell,
.workspace-shell,
.registry-shell {
  position: relative;
  width: min(1500px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(158, 128, 63, 0.32);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.42), rgba(255, 253, 248, 0.68)),
    var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.apps-shell {
  width: min(1220px, 100%);
  padding: clamp(28px, 5vw, 60px);
}

.workspace-shell,
.registry-shell {
  padding: clamp(18px, 2.4vw, 34px);
}

.panel-heading {
  display: grid;
  justify-items: center;
  margin-bottom: clamp(28px, 5vw, 48px);
  text-align: center;
}

.apps-brand img {
  width: min(270px, 62vw);
  margin-bottom: 24px;
}

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

.app-tile {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 205px;
  padding: 26px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 253, 248, 0.48)),
    rgba(255, 255, 255, 0.42);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--soft-shadow);
}

.app-tile.active {
  border-color: rgba(158, 128, 63, 0.68);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(251, 240, 210, 0.52)),
    rgba(255, 253, 248, 0.7);
  box-shadow:
    0 24px 80px rgba(127, 97, 42, 0.2),
    inset 0 0 0 1px rgba(225, 198, 132, 0.4);
}

.app-tile.inactive {
  color: rgba(24, 23, 21, 0.48);
  filter: grayscale(1);
  opacity: 0.74;
}

.tile-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(158, 128, 63, 0.36);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  color: var(--gold-dark);
  font-weight: 900;
}

.app-tile em {
  justify-self: start;
  border: 1px solid rgba(158, 128, 63, 0.22);
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--gold-dark);
  background: rgba(199, 164, 82, 0.1);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-tile.inactive em {
  color: rgba(24, 23, 21, 0.42);
  background: rgba(24, 23, 21, 0.04);
}

.app-tile strong {
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.12;
}

.app-tile small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.secondary-button {
  display: block;
  width: min(360px, 100%);
  margin: 18px auto 0;
  border-color: rgba(158, 128, 63, 0.22);
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(72, 57, 28, 0.08);
}

.registry-entry-button {
  margin-top: 34px;
}

.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border-color: rgba(158, 128, 63, 0.22);
  background: rgba(255, 255, 255, 0.46);
  color: var(--ink);
  box-shadow: none;
}

.workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: clamp(18px, 2.4vw, 30px);
  padding: 12px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.46);
  box-shadow: 0 12px 40px rgba(72, 57, 28, 0.08);
}

.workspace-brand img {
  width: min(128px, 34vw);
}

.topbar-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-title {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  justify-items: center;
  align-items: center;
  margin-bottom: clamp(20px, 3vw, 34px);
  text-align: center;
}

.workspace-title p {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 0;
  place-items: center;
  border: 1px solid rgba(158, 128, 63, 0.26);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.52);
  color: var(--gold-dark);
  font-size: 15px;
  font-weight: 900;
}

.workspace-title h2 {
  margin-bottom: 0;
  font-size: clamp(48px, 6.6vw, 78px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
}

.engine-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(360px, 0.66fr);
  gap: 14px;
  margin-bottom: clamp(18px, 2.3vw, 28px);
}

.engine-strip,
.metric-strip,
.registry-summary,
.result-summary,
.upload-panel,
.results-panel,
.registry-gate,
.registry-table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(255, 253, 248, 0.46)),
    var(--paper);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(14px);
}

.engine-strip,
.metric-strip,
.registry-summary,
.result-summary {
  display: grid;
  overflow: hidden;
}

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

.engine-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  align-items: center;
  min-height: 86px;
  padding: 15px;
  border-left: 1px solid rgba(158, 128, 63, 0.11);
}

.engine-chip:first-child,
.engine-chip:nth-child(5) {
  border-left: 0;
}

.engine-chip i {
  grid-row: span 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b8b1a3;
  box-shadow: 0 0 0 6px rgba(153, 145, 129, 0.12);
}

.engine-chip.is-on i {
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(63, 135, 80, 0.13);
}

.engine-chip.is-off i {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(143, 45, 45, 0.12);
}

.engine-chip b,
.metric-strip small,
.registry-summary small,
.registry-table-wrap small,
.result-summary span,
th,
.progress-meta,
.case-badge small {
  letter-spacing: 0;
  text-transform: uppercase;
}

.engine-chip b {
  font-size: 13px;
  font-weight: 900;
}

.engine-chip small,
.metric-strip small,
.registry-summary small,
.registry-table-wrap small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.metric-strip,
.registry-summary,
.result-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.metric-strip span,
.registry-summary span,
.result-summary span {
  display: grid;
  gap: 5px;
  min-height: 76px;
  align-content: center;
  padding: 15px 18px;
  border-left: 1px solid rgba(158, 128, 63, 0.12);
}

.metric-strip span:first-child,
.registry-summary span:first-child,
.result-summary span:first-child {
  border-left: 0;
}

.metric-strip strong,
.registry-summary strong,
.result-summary strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.esis-layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}

.upload-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 14px;
  padding: 20px;
}

.file-drop {
  position: relative;
  display: grid;
  min-height: 158px;
  place-items: center;
  border: 1px dashed rgba(158, 128, 63, 0.36);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-drop span {
  max-width: 230px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.case-badge {
  display: grid;
  gap: 6px;
  padding: 15px;
  border: 1px solid rgba(158, 128, 63, 0.2);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.36);
}

.case-badge small {
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 900;
}

.case-badge strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.case-badge span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.progress-meta strong {
  color: var(--gold-dark);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(128, 99, 39, 0.12);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(141, 168, 132, 0.95), rgba(199, 164, 82, 0.95));
}

.status-note {
  max-height: 104px;
  overflow: auto;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.ai-panel {
  display: none !important;
}

.upload-panel .secondary-button {
  width: 100%;
  margin-top: 0;
}

.upload-panel button {
  min-height: 52px;
}

.results-panel {
  overflow: hidden;
}

.result-summary {
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
  background: rgba(255, 253, 247, 0.5);
}

.result-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

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

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

th,
td {
  padding: 17px 20px;
  border-bottom: 1px solid rgba(128, 99, 39, 0.12);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 253, 247, 0.96);
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 900;
}

td {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

td:first-child,
th:first-child {
  width: 72px;
  text-align: center;
}

td:nth-child(2),
th:nth-child(2) {
  width: 270px;
}

td:nth-child(3),
th:nth-child(3) {
  width: 470px;
}

td:nth-child(4),
th:nth-child(4) {
  width: 230px;
}

td:nth-child(4) {
  color: var(--muted);
}

.status-pill,
.verdict-pill {
  display: inline-grid;
  min-width: 86px;
  min-height: 30px;
  place-items: center;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.status-found,
.verdict-yes {
  border: 1px solid rgba(63, 135, 80, 0.22);
  background: rgba(63, 135, 80, 0.1);
  color: #336e3d;
}

.status-missing,
.verdict-missing {
  border: 1px solid rgba(143, 45, 45, 0.18);
  background: rgba(143, 45, 45, 0.08);
  color: var(--red);
}

.status-pending,
.verdict-unreadable {
  border: 1px solid rgba(158, 128, 63, 0.22);
  background: rgba(199, 164, 82, 0.1);
  color: var(--gold-dark);
}

.verdict-no {
  border: 1px solid rgba(24, 23, 21, 0.16);
  background: rgba(24, 23, 21, 0.06);
  color: #35332f;
}

.answer-text {
  margin-top: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.registry-gate {
  width: min(460px, 100%);
  margin: 34px auto 0;
  padding: 26px;
}

.registry-panel {
  display: grid;
  gap: 16px;
}

.registry-table-wrap {
  max-height: calc(100vh - 285px);
  overflow: auto;
}

.registry-table-wrap table {
  min-width: 1040px;
}

.valuation-select {
  min-height: 42px;
  padding: 0 14px;
  background: rgba(255, 253, 248, 0.72);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1060px) {
  .engine-panel,
  .esis-layout {
    grid-template-columns: 1fr;
  }

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

  .engine-chip:nth-child(4),
  .engine-chip:nth-child(7) {
    border-left: 0;
  }

  .engine-chip:nth-child(5) {
    border-left: 1px solid rgba(158, 128, 63, 0.11);
  }

  .upload-panel {
    position: relative;
    top: auto;
  }
}

@media (max-width: 900px) {
  .intro .login-panel {
    gap: 28px;
  }

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

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

  .table-wrap,
  .registry-table-wrap {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .intro,
  .apps-view,
  .workspace-view,
  .registry-view {
    padding: 16px;
  }

  .intro .login-panel {
    gap: 18px;
  }

  .brand img {
    width: min(260px, 72vw);
  }

  .intro .login-form {
    width: 100%;
  }

  h1,
  .panel-heading h2 {
    font-size: clamp(44px, 15vw, 64px);
  }

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

  .workspace-topbar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .workspace-title {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .workspace-title h2 {
    font-size: clamp(48px, 16vw, 70px);
  }

  .engine-strip,
  .engine-panel .metric-strip {
    grid-template-columns: 1fr;
  }

  .engine-chip,
  .engine-chip:nth-child(5),
  .engine-chip:nth-child(7) {
    border-left: 0;
    border-top: 1px solid rgba(158, 128, 63, 0.11);
  }

  .engine-chip:first-child {
    border-top: 0;
  }
}
