:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #14213d;
  --muted: #69778c;
  --line: #d9e2ec;
  --blue: #355dff;
  --blue-soft: #edf2ff;
  --teal: #14a38b;
  --teal-soft: #e4f7f2;
  --amber: #d48912;
  --amber-soft: #fff3d9;
  --rose: #d8465f;
  --rose-soft: #fff0f3;
  --shadow: 0 22px 60px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Malgun Gothic",
    "Apple SD Gothic Neo",
    "Segoe UI",
    system-ui,
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

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

button,
input,
select {
  font: inherit;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px 36px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #b5f5e8;
  font-size: 0.82rem;
}

.mock-login {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mock-login label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.mock-login select,
.lookup-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

.small-button,
.primary-button,
.clear-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.small-button {
  min-height: 42px;
  padding: 0 14px;
  background: var(--ink);
  color: #ffffff;
}

.home {
  display: grid;
  justify-items: center;
  width: min(100% - 32px, 940px);
  margin: 0 auto;
  padding: 54px 0 80px;
}

.hero {
  max-width: 720px;
  margin-bottom: 22px;
  text-align: center;
}

.eyebrow {
  display: block;
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: 3.7rem;
  line-height: 1.08;
}

.hero p {
  margin: 16px 0 0;
  color: var(--muted);
}

.user-summary,
.scan-card,
.result-card,
.usage-card,
.admin-panel {
  width: min(100%, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
}

.user-summary div,
.result-grid div,
.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.user-summary span,
.result-grid span,
.metric-grid span,
.status-row span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.user-summary strong,
.result-grid strong,
.metric-grid strong,
.status-row strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.service-workspace {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
}

.service-workspace[hidden],
.admin-panel[hidden],
.result-card[hidden],
.usage-card[hidden],
.selected-file[hidden],
.panel[hidden],
.failure-message[hidden] {
  display: none;
}

.scan-card {
  padding: 0 34px 30px;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 42px;
  border-bottom: 1px solid var(--line);
  margin: 0 -34px 28px;
}

.tab {
  position: relative;
  border: 0;
  padding: 20px 4px 17px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: transparent;
}

.tab.active {
  color: var(--blue);
}

.tab.active::after {
  background: var(--blue);
}

.panel {
  display: grid;
  justify-items: center;
}

.upload-target {
  display: grid;
  justify-items: center;
  width: 100%;
  min-height: 220px;
  border: 1px dashed #b9c7d8;
  border-radius: 8px;
  padding: 34px 20px;
  background: #fbfdff;
  cursor: pointer;
  text-align: center;
}

.upload-target:hover,
.upload-target.is-dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.upload-target input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 16px;
  background: var(--blue-soft);
  color: var(--blue);
}

.upload-target strong {
  font-size: 1.28rem;
}

.upload-target small,
.notice,
.quota-line {
  color: var(--muted);
}

.selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfdff;
}

.selected-file strong,
.selected-file span {
  display: block;
}

.selected-file span {
  color: var(--muted);
  font-size: 0.86rem;
}

.clear-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.quota-line {
  margin-top: 16px;
  font-weight: 800;
  text-align: center;
}

.primary-button {
  width: min(100%, 260px);
  min-height: 48px;
  margin-top: 18px;
  background: var(--blue);
  color: #ffffff;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.notice {
  max-width: 560px;
  margin: 16px 0 0;
  font-size: 0.9rem;
  text-align: center;
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  width: 100%;
}

.lookup-form .primary-button {
  width: 100%;
  margin: 0;
}

.result-card,
.usage-card,
.admin-panel {
  padding: 24px;
}

.result-heading,
.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.result-heading h2,
.section-heading h2 {
  margin: 0;
}

.request-id {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

#status-value[data-status="SUCCESS"] {
  color: var(--teal);
}

#status-value[data-status="FAILED"] {
  color: var(--rose);
}

.result-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

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

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

.failure-message {
  border-radius: 8px;
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--rose-soft);
  color: #9f2138;
  font-weight: 800;
}

.failure-list {
  margin-top: 18px;
}

.failure-list h3 {
  margin: 0 0 10px;
}

.failure-list ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.failure-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.failure-list li span {
  display: inline-flex;
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.failure-list li p {
  margin: 4px 0 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(20, 33, 61, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

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

@media (max-width: 840px) {
  .site-header,
  .mock-login {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    padding: 18px;
  }

  .mock-login,
  .mock-login select,
  .small-button {
    width: 100%;
  }

  .home {
    padding: 38px 0 64px;
  }

  .hero h1 {
    font-size: 2.45rem;
  }

  .user-summary,
  .result-grid,
  .metric-grid,
  .admin-grid,
  .lookup-form {
    grid-template-columns: 1fr;
  }

  .scan-card {
    padding: 0 18px 24px;
  }

  .tabs {
    margin-right: -18px;
    margin-left: -18px;
    gap: 24px;
  }

  .result-heading,
  .section-heading {
    flex-direction: column;
  }
}
