:root {
  color-scheme: light;
  --blue-950: #08152c;
  --blue-900: #102448;
  --blue-700: #2472d0;
  --blue-100: #dcecff;
  --blue-50: #eef6ff;
  --green-600: #198754;
  --green-50: #e9f8f1;
  --orange-600: #d97706;
  --orange-50: #fff4df;
  --red-600: #c73636;
  --red-50: #fff0f0;
  --ink: #101828;
  --muted: #64748b;
  --line: #dbe4f0;
  --soft: #f7f9fc;
  --white: #ffffff;
  --shadow: 0 18px 55px rgba(36, 114, 208, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (min-width: 980px) and (min-height: 680px) {
  .workspace {
    gap: 20px;
  }

  .finder-form {
    max-height: calc(100vh - 112px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    gap: 12px;
    padding: 18px;
  }

  .field-grid,
  .metric-grid {
    gap: 10px;
  }

  input,
  select {
    min-height: 42px;
    padding-inline: 12px;
  }

  textarea {
    height: 68px;
    min-height: 68px;
    padding: 10px 12px;
  }

  .option-box {
    gap: 8px;
    padding: 11px;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0, #f5f9ff 520px, #ffffff 100%);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

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

h1,
h2,
h3 {
  color: var(--blue-950);
  letter-spacing: 0;
  line-height: 1.12;
}

h1 {
  margin-top: 4px;
  font-size: 2.35rem;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1rem;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(219, 228, 240, 0.95);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(36, 114, 208, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--blue-950);
  font-weight: 850;
}

.brand img {
  display: block;
  width: min(210px, 42vw);
  height: auto;
}

.brand span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-left: 1px solid var(--line);
  padding-left: 12px;
  color: var(--blue-700);
  white-space: nowrap;
}

.top-actions,
.form-actions,
.panel-heading,
.summary-main,
.summary-actions,
.plan-actions,
.method-card-head,
.tag-row,
.score-line,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 11px;
  color: #40516a;
  background: var(--white);
  font-size: 0.88rem;
  font-weight: 750;
  white-space: nowrap;
}

.shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 68px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.workspace > *,
.result-stack,
.panel {
  min-width: 0;
}

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

.finder-form {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
  padding: 20px;
}

.result-stack {
  display: grid;
  gap: 18px;
}

.section-head {
  display: grid;
  gap: 8px;
}

.section-head p:last-child,
.summary-text {
  color: #50627d;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-700);
  font-size: 0.85rem;
  font-weight: 850;
}

.eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-600);
  content: "";
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

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

.field span,
.data-box legend {
  color: #172033;
  font-size: 0.9rem;
  font-weight: 780;
}

.field strong {
  color: var(--red-600);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  color: var(--blue-950);
  background: var(--white);
  box-shadow: inset 0 1px 0 rgba(8, 21, 44, 0.02), 0 2px 8px rgba(8, 21, 44, 0.03);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(36, 114, 208, 0.14);
}

.data-box {
  display: grid;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--soft);
}

.data-box legend {
  padding: 0 6px;
}

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

.check-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border: 1px solid #cfdced;
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--white);
  color: #2d3a50;
  font-size: 0.9rem;
  font-weight: 720;
}

.check-item input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--blue-700);
}

.primary-button,
.secondary-button,
.copy-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 820;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  flex: 1 1 220px;
  color: var(--white);
  background: var(--blue-700);
  box-shadow: 0 14px 28px rgba(36, 114, 208, 0.24);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(36, 114, 208, 0.24);
}

.secondary-button,
.copy-button,
.icon-button {
  color: var(--blue-700);
  border-color: #bfd3ee;
  background: var(--white);
}

.secondary-button:hover,
.copy-button:hover,
.icon-button:hover {
  border-color: var(--blue-700);
  background: var(--blue-50);
}

.copy-button.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.summary-panel,
.methods-panel,
.table-panel,
.plan-panel {
  padding: 20px;
}

.summary-main {
  align-items: flex-start;
}

.score-badge {
  display: grid;
  flex: 0 0 104px;
  min-height: 104px;
  place-items: center;
  border: 1px solid rgba(25, 135, 84, 0.24);
  border-radius: var(--radius);
  background: var(--green-50);
  color: #10663f;
  text-align: center;
}

.score-badge strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1;
}

.score-badge span {
  color: #44705c;
  font-size: 0.82rem;
  font-weight: 760;
}

.score-badge.tight {
  border-color: rgba(217, 119, 6, 0.28);
  background: var(--orange-50);
  color: #a15604;
}

.score-badge.critical {
  border-color: rgba(199, 54, 54, 0.28);
  background: var(--red-50);
  color: #9b2727;
}

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

.metric-tile {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--soft);
}

.metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
}

.metric-tile strong {
  display: block;
  margin-top: 6px;
  color: var(--blue-950);
  font-size: 1.05rem;
  line-height: 1.2;
}

.advice-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.advice-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: var(--white);
  color: #35465e;
}

.advice-dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--blue-700);
}

.advice-item.good .advice-dot {
  background: var(--green-600);
}

.advice-item.warning .advice-dot {
  background: var(--orange-600);
}

.advice-item.critical .advice-dot {
  background: var(--red-600);
}

.summary-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 16px;
}

.form-error {
  border: 1px solid rgba(199, 54, 54, 0.32);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--red-50);
  color: var(--red-600);
  font-weight: 750;
}

.panel-heading {
  margin-bottom: 16px;
  align-items: flex-start;
}

.empty-state {
  display: grid;
  gap: 6px;
  border: 1px dashed #bfd3ee;
  border-radius: var(--radius);
  padding: 18px;
  background: var(--blue-50);
  color: #50627d;
}

.empty-state strong {
  color: var(--blue-950);
}

.method-list {
  display: grid;
  gap: 12px;
}

.method-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--white);
}

.method-card.best {
  border-color: rgba(36, 114, 208, 0.34);
  background: linear-gradient(180deg, #eef6ff, #ffffff);
}

.method-card-head {
  align-items: flex-start;
}

.method-title {
  display: grid;
  gap: 6px;
}

.method-title h3 {
  font-size: 1.08rem;
}

.tag-row {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #cfdced;
  border-radius: var(--radius);
  padding: 4px 8px;
  color: #40516a;
  background: var(--soft);
  font-size: 0.78rem;
  font-weight: 780;
}

.tag.good {
  border-color: rgba(25, 135, 84, 0.28);
  color: #10663f;
  background: var(--green-50);
}

.tag.warning {
  border-color: rgba(217, 119, 6, 0.3);
  color: #9a5605;
  background: var(--orange-50);
}

.tag.critical {
  border-color: rgba(199, 54, 54, 0.3);
  color: #9b2727;
  background: var(--red-50);
}

.mini-score {
  display: grid;
  flex: 0 0 92px;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  text-align: center;
}

.mini-score strong {
  color: var(--blue-950);
  font-size: 1.35rem;
  line-height: 1;
}

.mini-score span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.score-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e5edf7;
}

.score-fill {
  height: 100%;
  width: var(--score);
  border-radius: 999px;
  background: var(--score-color, var(--blue-700));
}

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

.info-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--soft);
}

.info-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-950);
  font-size: 0.9rem;
}

.info-box ul,
.plan-content ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-box li,
.plan-content li {
  color: #35465e;
  font-size: 0.92rem;
}

.info-box li::before,
.plan-content li::before {
  color: var(--blue-700);
  content: "• ";
}

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

.reason-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 9px;
  color: #35465e;
  font-size: 0.93rem;
}

.reason-list li::before {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--blue-700);
  content: "";
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--white);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #40516a;
  background: #f0f6ff;
  font-size: 0.82rem;
  font-weight: 850;
}

td {
  color: #26364d;
  font-size: 0.93rem;
}

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

.method-name {
  display: grid;
  gap: 4px;
}

.method-name strong {
  color: var(--blue-950);
}

.method-name span {
  color: #5f6f86;
  font-size: 0.84rem;
}

.plan-panel[hidden] {
  display: none;
}

.plan-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.plan-content {
  display: grid;
  gap: 12px;
}

.plan-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--soft);
}

.plan-section h3 {
  margin-bottom: 8px;
}

.plan-section p {
  color: #35465e;
}

.tool-footer {
  width: min(100% - 32px, 1380px);
  margin: 0 auto;
  padding: 18px 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #61708a;
  font-size: 0.92rem;
}

.tool-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
}

.tool-footer a {
  color: #234d83;
  text-decoration: none;
  font-weight: 750;
}

.tool-footer a:hover {
  color: var(--blue);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(18px);
  opacity: 0;
  border: 1px solid rgba(36, 114, 208, 0.22);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--blue-950);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px rgba(8, 21, 44, 0.16);
  font-weight: 760;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .finder-form {
    position: static;
  }

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

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .brand {
    width: 100%;
  }

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

  .brand span {
    font-size: 0.92rem;
  }

  .top-actions,
  .form-actions,
  .summary-main,
  .panel-heading,
  .summary-actions,
  .plan-actions,
  .method-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .form-actions,
  .summary-actions,
  .plan-actions {
    width: 100%;
  }

  .shell {
    width: min(100% - 20px, 1380px);
    padding-top: 16px;
  }

  .finder-form,
  .summary-panel,
  .methods-panel,
  .table-panel,
  .plan-panel {
    padding: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .field-grid,
  .check-grid,
  .metric-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .score-badge,
  .mini-score {
    width: 100%;
    min-height: 76px;
  }

  .primary-button,
  .secondary-button,
  .copy-button {
    width: 100%;
  }

  .tool-footer {
    width: min(100% - 20px, 1380px);
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-footer nav {
    justify-content: flex-start;
  }
}

@media (min-width: 980px) and (min-height: 680px) {
  .workspace {
    gap: 20px;
  }

  .finder-form {
    max-height: calc(100vh - 112px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    gap: 12px;
    padding: 18px;
  }

  .field-grid,
  .metric-grid {
    gap: 10px;
  }

  input,
  select {
    min-height: 42px;
    padding-inline: 12px;
  }

  textarea {
    height: 68px;
    min-height: 68px;
    padding: 10px 12px;
  }

  .option-box {
    gap: 8px;
    padding: 11px;
  }
}
