:root {
  --brand: #003c5b;
  --brand-dark: #002a41;
  --active: #2563eb;
  --active-soft: #e7f0ff;
  --surface: #ffffff;
  --surface-muted: #f6f8fb;
  --surface-subtle: #eef4f8;
  --text: #111827;
  --text-soft: #4b5563;
  --text-muted: #6b7280;
  --border: #d9e1e8;
  --border-strong: #b8c5d1;
  --accent-green: #13795b;
  --accent-green-light: #2fbf71;
  --accent-blue: #1d4ed8;
  --accent-blue-soft: #dbeafe;
  --accent-gold: #9a6700;
  --accent-rose: #b42318;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--surface-muted);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 800;
}

.eyebrow,
.section-label {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.1;
}

h1,
h2,
p,
dd {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.header-link {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

main {
  min-height: calc(100vh - 76px);
}

.control-band {
  padding: 22px clamp(16px, 4vw, 40px) 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.instruction-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #c8daf6;
  border-radius: 8px;
  background: #f5f9ff;
  padding: 16px;
}

.instruction-panel h2 {
  margin: 4px 0 0;
  color: var(--brand);
  font-size: 26px;
  line-height: 1.15;
}

.instruction-panel p {
  max-width: 640px;
  margin: 0;
  color: var(--text-soft);
}

.resource-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.field {
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  padding: 9px 11px;
}

input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-with-icon input {
  padding-left: 38px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button-primary {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
}

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

.button-secondary {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--active);
  color: var(--active);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.preset {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

.preset.active {
  border-color: var(--active);
  background: var(--active-soft);
  color: var(--active);
}

.summary-band {
  display: block;
  padding: 16px clamp(16px, 4vw, 40px);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.summary-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.summary-copy {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.score-badge {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

.score-badge-f {
  border-color: #f2aaa4;
  background: #fff1f0;
  color: var(--accent-rose);
}

.score-badge-a {
  border-color: #a7d9c8;
  background: #ecfdf5;
  color: var(--accent-green);
}

.score-badge-b {
  border-color: #a7f3d0;
  background: #f0fdf4;
  color: #15803d;
}

.score-badge-c {
  border-color: #e8d17c;
  background: #fff8e1;
  color: var(--accent-gold);
}

.score-badge-d {
  border-color: #f4bf8f;
  background: #fff7ed;
  color: #9a3412;
}

.score-badge-waiting {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text-soft);
}

.workspace-shell {
  display: grid;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 40px) 36px;
}

.overview-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: start;
}

.score-panel,
.record-card,
.json-panel,
.empty-state {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
}

.score-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
  border-top: 5px solid var(--accent-blue);
}

.score-panel > .panel-heading,
.score-panel > .score-meter,
.score-panel > .score-stats {
  grid-column: 1;
}

.panel-heading,
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-label {
  color: var(--accent-green);
}

.panel-heading h2,
.record-card h2,
.score-fields h2 {
  margin: 4px 0 0;
  color: var(--brand);
  font-size: 24px;
  line-height: 1.2;
}

.score-meter {
  height: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
}

.score-meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--text-muted);
  transition: width 220ms ease;
}

.score-meter-a {
  background: var(--accent-green);
}

.score-meter-b {
  background: var(--accent-green-light);
}

.score-meter-c {
  background: var(--accent-gold);
}

.score-meter-d {
  background: #c2410c;
}

.score-meter-f {
  background: var(--accent-rose);
}

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

.score-stats div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 10px;
}

.score-stats .score-stat-large {
  grid-column: 1 / -1;
  background: #ffffff;
}

.score-stats dt {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-stats dd {
  margin: 0;
  color: var(--brand);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.score-stat-large dd {
  font-size: 52px;
  letter-spacing: 0;
}

.group-panel {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.group-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.score-fields {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
}

.score-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.group-item,
.score-item,
.score-item-missing {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.group-item {
  padding: 10px;
}

.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
}

.group-heading span {
  color: var(--brand);
  font-weight: 900;
}

.group-meter {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-subtle);
}

.group-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-blue);
}

.group-item p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.score-item,
.score-item-missing {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
}

.score-item {
  min-height: 128px;
}

.score-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.score-icon svg {
  width: 17px;
  height: 17px;
}

.score-item-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.score-item-header strong,
.score-item-header span,
.score-item-meta,
.score-item-value {
  display: block;
}

.score-item-header strong {
  color: var(--text);
  font-size: 14px;
}

.score-item-header span {
  color: var(--brand);
  font-size: 14px;
  font-weight: 900;
}

.score-item-meta,
.score-item-value {
  color: var(--text-soft);
  font-size: 13px;
}

.score-item-meta {
  margin-top: 2px;
  font-weight: 700;
}

.score-item-value {
  margin-top: 3px;
}

.score-item-present {
  border-color: #b8ddcf;
}

.score-item-present .score-icon {
  background: #ecfdf5;
  color: var(--accent-green);
}

.score-item-missing {
  border-color: #f0c0ba;
}

.score-item-missing .score-icon {
  background: #fff1f0;
  color: var(--accent-rose);
}

.score-item-invalid {
  border-color: #e8ca84;
}

.score-item-invalid .score-icon {
  background: #fff8e6;
  color: #9a6700;
}

.score-item-required {
  box-shadow: inset 4px 0 0 var(--accent-gold);
}

.record-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--brand);
}

.empty-icon svg {
  width: 30px;
  height: 30px;
}

.empty-state p {
  margin: 0;
  color: var(--text-soft);
  font-weight: 700;
}

.record-card {
  padding: 18px;
}

.description {
  margin: 8px 0 0;
  color: var(--text-soft);
}

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

.metadata-grid div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 10px;
}

.metadata-grid dt {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metadata-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1050px) {
  .instruction-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-shell,
  .score-panel {
    grid-template-columns: 1fr;
  }

  .group-panel {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .instruction-panel h2 {
    font-size: 22px;
  }

  .resource-form {
    grid-template-columns: 1fr;
  }

  .button-primary {
    width: 100%;
  }

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

  .score-stats {
    grid-template-columns: 1fr;
  }

  .score-stat-large dd {
    font-size: 42px;
  }
}
