:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef4f1;
  --surface-blue: #edf3fa;
  --surface-warm: #fff6e8;
  --ink: #17212b;
  --muted: #5d6a75;
  --line: #d6dde2;
  --line-strong: #aeb9c2;
  --green: #286b57;
  --green-dark: #174b3b;
  --blue: #2e5f90;
  --plum: #7a4763;
  --amber: #b46b12;
  --rose: #a33a4b;
  --shadow: 0 14px 34px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(46, 95, 144, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(40, 107, 87, 0.045) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 0 12px;
}

.identity {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 900px;
  margin-bottom: 10px;
  color: #101922;
  font-size: clamp(2.15rem, 4.5vw, 4.65rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.1vw, 2rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.lead {
  max-width: 850px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.top-actions,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-actions {
  justify-content: flex-end;
  max-width: 560px;
}

.instagram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(122, 71, 99, 0.28);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--plum);
  font-weight: 820;
  text-decoration: none;
  box-shadow: 0 9px 22px rgba(23, 33, 43, 0.06);
}

.instagram-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(23, 33, 43, 0.12);
}

.notice {
  border: 1px solid #e1bd75;
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--surface-warm);
  color: #50381b;
  line-height: 1.48;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.score-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 25px rgba(23, 33, 43, 0.06);
}

.score-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-dark);
  font-size: 1.5rem;
  line-height: 1.05;
}

.score-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
  line-height: 1.35;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
  backdrop-filter: blur(12px);
}

.tab,
.primary-button,
.quiet-button,
.danger-button,
.file-button {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.tab {
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 820;
}

.tab.is-active,
.tab:hover {
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(40, 107, 87, 0.24);
}

.primary-button,
.quiet-button,
.danger-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  font-weight: 780;
  white-space: nowrap;
}

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

.quiet-button,
.file-button {
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  border-color: rgba(163, 58, 75, 0.3);
  background: #fff1f3;
  color: var(--rose);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 14px;
}

.section-note {
  max-width: 450px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

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

label {
  display: grid;
  gap: 7px;
  color: #26323d;
  font-size: 0.86rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46, 95, 144, 0.12);
}

input[readonly] {
  background: #edf1f4;
  color: var(--muted);
}

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

.rules-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.rule-card,
.panel,
.table-panel,
.result-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(23, 33, 43, 0.06);
}

.rule-card {
  min-height: 96px;
  padding: 13px;
}

.rule-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-dark);
  font-size: 1rem;
}

.rule-card span,
.rule-card small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.rule-card.is-warning {
  border-color: rgba(180, 107, 18, 0.38);
  background: #fff9ef;
}

.rule-card.is-error {
  border-color: rgba(163, 58, 75, 0.32);
  background: #fff4f6;
}

.table-panel {
  overflow: hidden;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #edf2f5;
  color: #26323d;
  font-size: 0.78rem;
  font-weight: 840;
  text-align: left;
  text-transform: uppercase;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.score-table {
  min-width: 980px;
}

.score-table input[type="number"] {
  width: 92px;
  padding: 8px 9px;
}

.score-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.score-table .domain-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 8px;
  background: var(--surface-blue);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
}

.optional-mark {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

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

.result-card {
  min-height: 150px;
  padding: 15px;
}

.result-card h3 {
  margin-bottom: 10px;
}

.result-card .score {
  margin-bottom: 4px;
  color: var(--green-dark);
  font-size: 2rem;
  font-weight: 880;
  line-height: 1;
}

.result-card dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.result-card div,
.mini-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
}

.two-column {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  padding: 14px;
}

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

.compact-table {
  min-width: 720px;
}

.compact-table td,
.compact-table th {
  padding: 9px;
  font-size: 0.86rem;
}

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

.mini-card {
  min-height: 112px;
  padding: 12px;
  background: #fbfcfd;
  box-shadow: none;
}

.mini-card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--green-dark);
}

.status-ok {
  color: var(--green-dark);
  font-weight: 840;
}

.status-warn {
  color: var(--amber);
  font-weight: 840;
}

.status-error {
  color: var(--rose);
  font-weight: 840;
}

.report-output {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  line-height: 1.62;
}

.report-output h3 {
  margin: 22px 0 8px;
  color: var(--green-dark);
}

.report-output h3:first-child {
  margin-top: 0;
}

.report-output table {
  margin: 12px 0 16px;
}

.report-output th,
.report-output td {
  padding: 8px;
  font-size: 0.88rem;
}

.report-output ul {
  padding-left: 22px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  background: #17212b;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .topbar {
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
    max-width: none;
  }

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

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

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

  .two-column {
    grid-template-columns: 1fr;
  }
}

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

  h1 {
    font-size: 2.45rem;
  }

  .score-strip,
  .result-grid,
  .rules-grid,
  .form-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

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

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-output {
    padding: 18px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .notice,
  .score-strip,
  .tabbar,
  .section-heading,
  .toast,
  #caseView,
  #scoresView,
  #resultsView {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  #reportView,
  #reportView.view {
    display: block !important;
  }

  .report-output {
    min-height: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
