:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --panel-2: #f0efe9;
  --ink: #1c2726;
  --muted: #66716f;
  --line: #d8d4ca;
  --line-strong: #bcb5a7;
  --accent: #bd6236;
  --accent-dark: #8f4122;
  --teal: #173b3d;
  --teal-2: #25585a;
  --green: #357a55;
  --amber: #ad7625;
  --red: #a94442;
  --blue: #2f6496;
  --shadow: 0 18px 50px rgba(33, 36, 33, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(23, 59, 61, 0.08), transparent 34%),
    linear-gradient(180deg, #fbfaf6 0%, var(--bg) 42%, #ece8df 100%);
  font-family: var(--font);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 18px;
  color: #f9f7f0;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 34%),
    var(--teal);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.09);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.15;
}

.brand small {
  display: block;
  max-width: 190px;
  margin-top: 5px;
  color: rgba(249, 247, 240, 0.68);
  font-size: 12px;
  line-height: 1.35;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.76);
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
}

.nav-item svg,
button svg,
.icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
}

.side-status {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.12);
}

.side-status p {
  margin: 0;
  color: rgba(249, 247, 240, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.side-status strong {
  display: block;
  margin-bottom: 7px;
  color: #fff;
  font-size: 13px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1220px;
  margin: 0 auto 18px;
}

.top-label {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.12;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.top-actions,
.row-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.primary-button,
.quiet-button,
.danger-button,
.ghost-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
}

.primary-button:disabled,
.quiet-button:disabled,
.danger-button:disabled,
.ghost-button:disabled,
.mini-button:disabled,
.field input:disabled,
.field textarea:disabled,
.field select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.quiet-button,
.ghost-button {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.quiet-button:hover,
.ghost-button:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.danger-button {
  color: #fff;
  background: var(--red);
}

.mini-button {
  min-height: 32px;
  padding: 7px 9px;
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
  font-size: 12px;
}

.view-container {
  max-width: 1220px;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
}

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

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

.panel,
.metric,
.upload-zone,
.modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel,
.metric {
  padding: 18px;
}

.panel.compact {
  padding: 14px;
}

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

.panel-header p,
.muted,
.metric span {
  color: var(--muted);
}

.panel-header p,
.muted {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.5;
}

.metric {
  display: grid;
  gap: 10px;
  min-height: 126px;
}

.metric span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 28px;
  line-height: 1;
}

.metric small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.paywall {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 16px;
  color: #fff;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.2), transparent 26%),
    linear-gradient(135deg, var(--teal), #102829);
  box-shadow: var(--shadow);
}

.paywall-copy {
  padding: 24px;
}

.paywall-copy h2 {
  max-width: 660px;
  font-size: clamp(24px, 4vw, 38px);
}

.paywall-copy p {
  max-width: 700px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.55;
}

.price-box {
  display: grid;
  gap: 12px;
  padding: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.13);
}

.price {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.price small {
  font-size: 15px;
  font-weight: 800;
}

.check-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  color: inherit;
  font-size: 13px;
  line-height: 1.4;
}

.check-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #344240;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: #fff;
}

.field input[type="file"] {
  padding: 7px;
}

.field input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 6px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  font-weight: 800;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(189, 98, 54, 0.15);
}

.checkbox-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.checkbox-row label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.lockable {
  position: relative;
}

.lockable.is-locked {
  filter: saturate(0.85);
}

.lockable.is-locked::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(28, 39, 38, 0.72);
  content: "Subscribe or add free review credits to create and send client links.";
  font-size: 14px;
  font-weight: 900;
}

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

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

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

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

td strong {
  display: block;
  margin-bottom: 3px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.status.active,
.status.covered {
  color: #17462d;
  background: rgba(53, 122, 85, 0.14);
}

.status.inactive,
.status.blocked {
  color: #74302f;
  background: rgba(169, 68, 66, 0.13);
}

.status.review,
.status.unclear {
  color: #70470b;
  background: rgba(173, 118, 37, 0.15);
}

.status.info {
  color: #174169;
  background: rgba(47, 100, 150, 0.14);
}

.status.saved {
  color: #17462d;
  background: rgba(53, 122, 85, 0.14);
}

.copy-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-link input {
  min-width: 0;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.upload-zone {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.72);
}

.upload-visual {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: var(--teal);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(189, 98, 54, 0.18), transparent),
    rgba(23, 59, 61, 0.08);
}

.upload-visual svg,
.boundary .icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.boundary .icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: 16px;
  align-items: start;
}

.snapshot-list {
  display: grid;
  gap: 10px;
}

.finding-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.finding-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.finding-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.clause {
  padding: 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel-2);
}

.clause strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.clause p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.summary-box {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.summary-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.boundary {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.boundary .icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--teal);
  border-radius: var(--radius);
  background: rgba(23, 59, 61, 0.08);
}

.boundary strong {
  font-size: 13px;
}

.boundary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.client-state {
  display: grid;
  max-width: 680px;
  gap: 16px;
  align-items: start;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(10, 18, 18, 0.54);
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: min(520px, 100%);
  padding: 22px;
}

.modal-card .price {
  color: var(--teal);
}

.admin-login {
  max-width: 520px;
  margin: 42px auto 0;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  color: #fff;
  border-radius: var(--radius);
  background: var(--teal);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
}

.toast.show {
  display: block;
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

.empty-state p {
  max-width: 440px;
  margin: 8px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.search-box {
  width: min(360px, 100%);
}

.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
  }

  .brand small,
  .side-status {
    display: none;
  }

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

  .nav-item {
    justify-content: center;
  }

  .grid.two,
  .analysis-layout,
  .paywall {
    grid-template-columns: 1fr;
  }

  .price-box {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
  }
}

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

  .topbar,
  .panel-header,
  .admin-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .button-row {
    width: 100%;
  }

  .top-actions button,
  .button-row button,
  .copy-link {
    width: 100%;
  }

  .copy-link {
    grid-template-columns: 1fr;
  }

  .grid.three,
  .grid.four,
  .form-grid.two,
  .boundary-strip {
    grid-template-columns: 1fr;
  }

  .nav-item {
    grid-template-columns: 1fr;
    gap: 4px;
    justify-items: center;
    padding: 9px 6px;
    font-size: 12px;
  }

  h1 {
    font-size: 28px;
    line-height: 1.05;
  }

  .toast {
    right: 16px;
    left: 16px;
    max-width: none;
  }
}
