@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

:root {
  --blue: #1769ff;
  --ink: #101114;
  --text: #24262b;
  --muted: #6b7280;
  --soft: #f5f5f6;
  --line: #e6e7ea;
  --surface: #ffffff;
  --page: #f7f7f8;
  --green: #067647;
  --amber: #b54708;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(16, 17, 20, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--page);
  overflow-x: hidden;
  word-break: keep-all;
  overflow-wrap: break-word;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 14px;
  z-index: 50;
  padding: 10px 14px;
  background: var(--ink);
  color: #ffffff;
  text-decoration: none;
}

.skip-link:focus {
  left: 14px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.34)),
    repeating-linear-gradient(90deg, rgba(16, 17, 20, 0.05) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(16, 17, 20, 0.04) 0 1px, transparent 1px 80px),
    #eceef2;
}

.login-shell {
  width: min(100%, 920px);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1fr 420px;
  align-items: center;
  gap: 36px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand img {
  width: 62px;
  height: 62px;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 28px;
  font-weight: 700;
}

.login-brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.login-card {
  min-height: 430px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: 0 30px 80px rgba(16, 17, 20, 0.18);
  backdrop-filter: blur(22px);
}

.login-kicker {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 30px;
  font-size: 42px;
  line-height: 1.15;
  font-weight: 700;
}

.login-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.login-card label span {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.login-card input {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(16, 17, 20, 0.14);
  border-radius: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  outline: 0;
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 255, 0.14);
}

.login-submit {
  width: 100%;
  margin-top: 8px;
}

.app-shell[hidden],
.login-page[hidden] {
  display: none;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.brand-text {
  min-width: 0;
}

.brand-text strong,
.brand-text span {
  display: block;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 700;
}

.brand-text span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.nav-tab {
  min-height: 34px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.nav-tab.active {
  border-bottom-color: var(--blue);
  color: var(--ink);
}

.nav-status {
  min-width: 78px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}

.nav-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  margin-bottom: 28px;
}

.page-head.split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(36px, 5.4vw, 62px);
  line-height: 1.12;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel,
.result-panel {
  min-width: 0;
  padding: 30px;
}

.input-panel {
  border-right: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.section-title span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.section-title h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.upload-zone {
  min-height: 300px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed #c7c9cf;
  border-radius: 10px;
  background: #fafafa;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone:hover,
.upload-zone.drag {
  border-color: var(--ink);
  background: #f2f2f3;
}

.upload-zone input {
  display: none;
}

.upload-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--blue);
  color: #ffffff;
  font-size: 30px;
  font-weight: 300;
}

.upload-zone strong {
  font-size: 18px;
  font-weight: 700;
}

.upload-zone small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
}

.camera-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.camera-panel video {
  width: 100%;
  max-height: 260px;
  display: block;
  border-radius: 8px;
  background: #050506;
  object-fit: cover;
}

.camera-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.camera-actions .secondary {
  flex: 1;
}

.camera-state {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.preview {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.preview img {
  width: 100%;
  max-height: 300px;
  display: block;
  object-fit: contain;
  background: #f8f8f9;
}

.preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.preview-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.button-row.small {
  margin-top: 14px;
}

.primary,
.secondary {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary {
  flex: 1;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.primary:hover {
  background: #0f55d8;
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-weight: 500;
}

.secondary:hover {
  border-color: #bfc2c8;
  background: #f7f7f8;
}

.primary:disabled,
.secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.gateway-status {
  display: grid;
  gap: 8px;
  margin-bottom: 26px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.gateway-status span {
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.gateway-status strong {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

.gateway-status p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.gateway-status.pass {
  border-color: rgba(6, 118, 71, 0.24);
}

.gateway-status.pass span {
  background: rgba(6, 118, 71, 0.1);
  color: var(--green);
}

.gateway-status.intervene {
  border-color: rgba(180, 35, 24, 0.24);
}

.gateway-status.intervene span,
.gateway-status.error span {
  background: rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.gateway-status.error {
  border-color: rgba(180, 35, 24, 0.24);
}

.result-block {
  min-width: 0;
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.block-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.block-head strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.region-list {
  display: grid;
  gap: 0;
}

.region {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.region:first-child {
  padding-top: 0;
}

.region:last-child {
  border-bottom: 0;
}

.region header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.region h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 700;
}

.region p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  font-weight: 400;
}

.risk-chip {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.risk-chip.low {
  color: var(--green);
}

.risk-chip.medium {
  color: var(--amber);
}

.risk-chip.high {
  color: var(--red);
}

.factor-row {
  display: grid;
  grid-template-columns: 104px minmax(90px, 1fr) 34px;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.factor-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eeeeef;
}

.factor-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.factor-row strong {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
}

.final-output {
  min-height: 168px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
  font-weight: 400;
}

.extracted-output {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
}

.extracted-output p,
.final-output p {
  margin: 0;
}

.extracted-output ul,
.final-output ul,
.log-detail ul {
  margin: 12px 0 0;
  padding-left: 19px;
  color: var(--muted);
}

.extracted-output li,
.final-output li,
.log-detail li {
  margin-top: 6px;
}

.final-output .notice {
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--ink);
  color: var(--text);
  font-weight: 500;
}

.removed-list {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.removed-list strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.placeholder {
  margin: 0;
  color: var(--muted);
  font-weight: 400;
}

.log-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.38fr) minmax(0, 0.62fr);
  gap: 22px;
}

.log-list,
.log-detail {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.log-list {
  padding: 10px;
}

.log-item {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 15px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

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

.log-item.active {
  border-radius: 8px;
  background: var(--soft);
}

.log-item strong {
  font-size: 14px;
  font-weight: 700;
}

.log-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.log-detail {
  padding: 26px;
}

.log-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.log-detail-head strong {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

.log-detail h2 {
  margin: 10px 0 24px;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
}

.log-detail section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.log-detail h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.log-detail p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 22px;
  padding: 22px 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.metric {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 0 22px;
  border-right: 1px solid var(--line);
}

.metric:first-child {
  padding-left: 0;
}

.metric:last-child {
  padding-right: 0;
  border-right: 0;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.metric strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .login-shell,
  .workspace,
  .metrics,
  .log-layout {
    grid-template-columns: 1fr;
  }

  .login-shell {
    gap: 28px;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric {
    min-height: 58px;
    padding: 14px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:first-child {
    padding-top: 0;
  }

  .metric:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  .login-page {
    padding: 18px;
  }

  .login-card {
    padding: 26px;
  }

  .login-card h1 {
    font-size: 36px;
  }

  .navbar {
    height: auto;
    align-items: flex-start;
    padding: 14px 18px;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .page {
    width: 100%;
    max-width: none;
    padding: 34px 11px 42px;
  }

  .page-head,
  .workspace,
  .metrics,
  .log-layout {
    width: calc(100vw - 22px);
    max-width: calc(100vw - 22px);
  }

  .page-head.split {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head h1 {
    font-size: 34px;
  }

  .input-panel,
  .result-panel {
    padding: 20px;
  }

  .button-row {
    flex-direction: column;
  }

  .camera-actions {
    flex-direction: column;
  }

  .factor-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .factor-row strong {
    text-align: left;
  }
}
