:root {
  --ink: #17231e;
  --muted: #68766f;
  --line: #dce5e0;
  --paper: #f3f7f4;
  --panel: #ffffff;
  --green: #176d52;
  --green-dark: #104b3b;
  --green-soft: #e9f5ef;
  --blue: #3d6685;
  --blue-soft: #edf4f9;
  --amber: #9a6515;
  --amber-soft: #fff6df;
  --red: #9e493d;
  --red-soft: #fff0ed;
  --shadow: 0 20px 60px rgba(19, 48, 37, 0.1);
  color-scheme: light;
  font-family:
    Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(88, 176, 134, 0.12), transparent 28rem),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.is-hidden {
  display: none !important;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at 16% 18%, rgba(176, 222, 198, 0.25), transparent 24rem),
    linear-gradient(145deg, #103f33 0%, #0f5b44 60%, #183f35 100%);
}

.login-card {
  width: min(480px, 100%);
  padding: 38px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0, 20, 14, 0.3);
}

.login-brand,
.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
}

.login-brand {
  margin-bottom: 38px;
}

.login-brand > span,
.brand > span {
  display: grid;
  width: 38px;
  height: 38px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  background: var(--green);
  border-radius: 11px;
  place-items: center;
}

.login-brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 7vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.login-copy {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
  word-break: keep-all;
}

label {
  display: grid;
  gap: 7px;
  color: #425149;
  font-size: 0.76rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #ced9d3;
  border-radius: 9px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 109, 82, 0.12);
}

.key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.key-row input {
  min-height: 48px;
}

.key-row button,
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 750;
  cursor: pointer;
  border-radius: 9px;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.key-row button,
.button.primary {
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
}

.key-row button:hover,
.button.primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.button.secondary {
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid #cce3d7;
}

.button.ghost {
  color: #4a5951;
  background: #fff;
  border: 1px solid var(--line);
}

.button.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.75rem;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(19, 48, 37, 0.1);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.form-error {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 650;
}

.login-card > small {
  display: block;
  margin-top: 8px;
  color: #87918c;
  font-size: 0.68rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100% - 1320px) / 2));
  background: rgba(255, 255, 255, 0.91);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand strong,
.brand small {
  display: block;
}

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

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.live-indicator {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 750;
}

.live-indicator i {
  width: 7px;
  height: 7px;
  background: #2da374;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(45, 163, 116, 0.13);
}

main {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 90px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4.6vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.055em;
}

.page-heading p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stats-grid article {
  position: relative;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(24, 54, 43, 0.04);
}

.stats-grid article::after {
  position: absolute;
  right: -30px;
  bottom: -55px;
  width: 120px;
  height: 120px;
  content: "";
  background: var(--green-soft);
  border-radius: 50%;
}

.stats-grid span,
.stats-grid strong,
.stats-grid small {
  position: relative;
  z-index: 1;
  display: block;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.stats-grid strong {
  margin-top: 12px;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.stats-grid small {
  margin-top: 9px;
  color: #8b9690;
  font-size: 0.66rem;
}

.archive-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.archive-header {
  display: flex;
  gap: 28px;
  align-items: end;
  justify-content: space-between;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.archive-header h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.archive-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

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

.filters label {
  display: block;
}

.filters input,
.filters select {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 0.74rem;
}

.search-field {
  width: min(280px, 24vw);
}

.table-wrap {
  position: relative;
  min-height: 270px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.77rem;
}

th {
  padding: 12px 14px;
  color: #77837d;
  font-size: 0.66rem;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 15px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #edf1ef;
}

tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #f8fbf9;
}

.submission-cell {
  min-width: 250px;
}

.submission-cell > div {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.type-icon {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: var(--green);
  font-size: 0.62rem;
  font-weight: 850;
  background: var(--green-soft);
  border-radius: 9px;
  place-items: center;
}

.submission-cell strong,
.submission-cell small {
  display: block;
}

.submission-cell strong {
  max-width: 330px;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submission-cell small {
  max-width: 330px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-cell {
  min-width: 150px;
}

.scope-cell strong,
.scope-cell small {
  display: block;
}

.scope-cell strong {
  font-size: 0.72rem;
}

.scope-cell small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.64rem;
}

.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  font-size: 0.64rem;
  font-weight: 800;
  white-space: nowrap;
  border-radius: 999px;
}

.status-completed,
.feedback-approved {
  color: var(--green);
  background: var(--green-soft);
}

.status-processing,
.feedback-pending {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-failed,
.feedback-rejected {
  color: var(--red);
  background: var(--red-soft);
}

.feedback-needs_revision {
  color: var(--amber);
  background: var(--amber-soft);
}

.time-cell {
  min-width: 116px;
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.row-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 750;
  cursor: pointer;
  background: #fff;
  border: 1px solid #cfe0d7;
  border-radius: 7px;
}

.loading-state,
.empty-state {
  display: grid;
  min-height: 230px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  place-content: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.empty-state p {
  margin: 7px 0 0;
}

.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.pagination span {
  color: var(--muted);
  font-size: 0.7rem;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(13, 25, 20, 0.38);
  backdrop-filter: blur(2px);
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: flex;
  width: min(720px, 94vw);
  height: 100vh;
  flex-direction: column;
  background: #f7faf8;
  box-shadow: -24px 0 70px rgba(9, 30, 22, 0.22);
  animation: slide-in 180ms ease both;
}

.detail-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 0 0 7px;
  font-size: 1.45rem;
  letter-spacing: -0.035em;
}

.detail-header code {
  color: var(--muted);
  font-size: 0.67rem;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  color: #617068;
  font-size: 1.45rem;
  cursor: pointer;
  background: #f5f8f6;
  border: 1px solid var(--line);
  border-radius: 10px;
  place-items: center;
}

.detail-body {
  flex: 1 1 auto;
  padding: 18px;
  overflow-y: auto;
}

.detail-section {
  padding: 20px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.detail-section h3 {
  margin: 0 0 13px;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.detail-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}

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

.metadata-grid div {
  min-width: 0;
}

.metadata-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
}

.metadata-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.74rem;
  font-weight: 650;
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.section-title-row > span {
  color: var(--muted);
  font-size: 0.67rem;
}

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

.file-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.file-card strong,
.file-card small {
  display: block;
}

.file-card strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.62rem;
}

.file-card button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 750;
  cursor: pointer;
  background: #fff;
  border: 1px solid #cbded4;
  border-radius: 7px;
}

.request-copy {
  padding: 13px;
  margin: 0 0 12px;
  overflow: auto;
  color: #2d3b34;
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background: #f6f9f7;
  border: 1px solid var(--line);
  border-radius: 9px;
}

details {
  margin-top: 10px;
  border-top: 1px solid #edf1ef;
}

summary {
  padding: 11px 0 0;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 750;
  cursor: pointer;
}

.json-block {
  max-height: 340px;
  padding: 13px;
  overflow: auto;
  color: #d7e8df;
  font-size: 0.66rem;
  line-height: 1.52;
  white-space: pre-wrap;
  background: #14231d;
  border-radius: 9px;
}

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

.issue-card {
  padding: 12px;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-left: 3px solid #d2ddd7;
  border-radius: 8px;
}

.issue-card.severity-required,
.issue-card.severity-must_fix {
  border-left-color: var(--red);
}

.issue-card.severity-manual_review {
  border-left-color: var(--amber);
}

.issue-card strong {
  display: block;
  font-size: 0.72rem;
}

.issue-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.no-result {
  padding: 14px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
  background: #f8faf9;
  border-radius: 8px;
}

.feedback-section {
  border-color: #cfe2d8;
  box-shadow: 0 12px 34px rgba(23, 109, 82, 0.07);
}

.feedback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#feedbackForm {
  display: grid;
  gap: 12px;
}

.feedback-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feedback-action-row .form-error {
  margin: 0;
}

.feedback-history {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.feedback-history h4 {
  margin: 16px 0 9px;
  font-size: 0.76rem;
}

.history-item {
  padding: 11px 0;
  border-bottom: 1px solid #edf1ef;
}

.history-item:last-child {
  border-bottom: 0;
}

.history-item header {
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-item time {
  color: var(--muted);
  font-size: 0.62rem;
}

.history-item p,
.history-item pre {
  margin: 7px 0 0;
  color: #4f5d55;
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.history-item pre {
  padding: 9px;
  background: #f5f8f6;
  border-radius: 7px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: 360px;
  padding: 12px 16px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--green-dark);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(9, 31, 23, 0.26);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

@media (max-width: 1080px) {
  .archive-header {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    flex-wrap: wrap;
  }

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

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

  .live-indicator {
    display: none;
  }

  main {
    width: min(100% - 24px, 1320px);
    padding-top: 30px;
  }

  .page-heading {
    gap: 18px;
    align-items: flex-start;
  }

  .page-heading p:not(.eyebrow) {
    display: none;
  }

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

  .stats-grid article {
    min-height: 120px;
    padding: 16px;
  }

  .stats-grid strong {
    font-size: 1.75rem;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
    width: 100%;
  }

  .filters .button {
    width: 100%;
  }

  .detail-panel {
    width: 100vw;
  }

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

@media (max-width: 480px) {
  .login-view {
    padding: 14px;
  }

  .login-card {
    padding: 28px 20px;
    border-radius: 17px;
  }

  .login-brand {
    margin-bottom: 28px;
  }

  .key-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    min-height: 62px;
  }

  .brand small {
    display: none;
  }

  .page-heading h1 {
    font-size: 2rem;
  }

  .page-heading .button {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.7rem;
  }

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

  .search-field {
    grid-column: auto;
  }

  .archive-header {
    padding: 17px;
  }

  .detail-header,
  .detail-section {
    padding: 16px;
  }

  .detail-body {
    padding: 10px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
