:root {
  --ink: #20201d;
  --muted: #77746b;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #ded8cb;
  --wine: #7d2e3d;
  --wine-deep: #55202c;
  --apricot: #f3b65c;
  --sage: #73866c;
  --shadow: 0 18px 50px rgba(57, 45, 31, 0.09);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  background: var(--wine-deep);
  color: #fff9ef;
  overflow: hidden;
}
.sidebar::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -120px;
  bottom: 120px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255,255,255,.03), 0 0 0 84px rgba(255,255,255,.02);
}
.brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--apricot);
  color: var(--wine-deep);
  font: 800 21px/1 Georgia, serif;
}
.brand strong, .brand small { display: block; }
.brand strong { font: 700 20px/1.1 Georgia, serif; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: #d9c8c4; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 6px; margin-top: 54px; position: relative; z-index: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  color: #d9c8c4;
  font-size: 14px;
  transition: .2s ease;
}
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.09); }
.nav-item.disabled { opacity: .55; }
.nav-icon { width: 18px; text-align: center; font-size: 18px; }
.soon { margin-left: auto; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 9px; }
.sidebar-foot { margin-top: auto; position: relative; z-index: 1; }
.environment { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; }
.environment small, .environment strong { display: block; }
.environment small { color: #c9b9b5; font-size: 10px; }
.environment strong { margin-top: 3px; font-size: 11px; font-weight: 650; }
.sidebar-foot > p { margin: 18px 0 0; color: #b8a6a2; font: 14px/1.65 Georgia, serif; }

main { min-width: 0; padding: 42px clamp(24px, 4vw, 64px) 30px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 9px; color: var(--wine); font-size: 10px; font-weight: 800; letter-spacing: .19em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 500 clamp(34px, 4vw, 54px)/1.03 Georgia, "Noto Serif KR", serif; letter-spacing: -.04em; }
h1 em { color: var(--wine); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.system-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.45);
  color: var(--muted);
  font-size: 12px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #b1aaa0; box-shadow: 0 0 0 4px rgba(177,170,160,.12); }
.status-dot.ok { background: #6f9565; box-shadow: 0 0 0 4px rgba(111,149,101,.16); }
.status-dot.warn { background: #d79a42; box-shadow: 0 0 0 4px rgba(215,154,66,.16); }
.button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--wine); box-shadow: 0 9px 22px rgba(125,46,61,.18); }
.button.primary:hover { background: #6b2734; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(170px, .62fr) minmax(170px, .62fr); gap: 18px; }
.hero-card, .metric-card, .panel {
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.hero-card {
  min-height: 286px;
  padding: 34px;
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #fffdf8 0%, #f3eadf 100%);
}
.phase-chip { display: inline-block; padding: 5px 9px; border-radius: 6px; background: #efe2d8; color: var(--wine); font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.hero-copy h2 { margin: 18px 0 14px; font: 500 clamp(25px, 2.4vw, 37px)/1.12 Georgia, "Noto Serif KR", serif; letter-spacing: -.035em; }
.hero-copy p { max-width: 560px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.text-link { display: inline-flex; align-items: center; gap: 11px; margin-top: 10px; color: var(--wine); font-weight: 800; font-size: 13px; }
.text-link span { font-size: 18px; transition: transform .2s ease; }
.text-link:hover span { transform: translateX(4px); }
.orbit { position: relative; min-height: 210px; align-self: center; }
.orbit-ring { position: absolute; inset: 50% auto auto 50%; border: 1px solid rgba(125,46,61,.22); border-radius: 50%; transform: translate(-50%,-50%); }
.ring-one { width: 160px; height: 160px; }
.ring-two { width: 235px; height: 235px; border-style: dashed; opacity: .58; }
.orbit-core { position: absolute; inset: 50% auto auto 50%; width: 76px; height: 76px; display: grid; place-items: center; transform: translate(-50%,-50%); border-radius: 24px; background: var(--wine); color: white; font: 700 22px Georgia, serif; box-shadow: 0 17px 35px rgba(125,46,61,.24); }
.orbit-tag { position: absolute; padding: 7px 10px; border: 1px solid #eaded3; border-radius: 9px; background: rgba(255,253,248,.92); color: var(--wine); font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.tag-url { top: 11%; left: 4%; }
.tag-md { top: 36%; right: -1%; }
.tag-post { bottom: 9%; left: 15%; }
.metric-card { min-height: 286px; padding: 25px; display: flex; flex-direction: column; }
.metric-card.accent { color: #fff; border-color: var(--wine); background: var(--wine); }
.metric-label { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .18em; }
.accent .metric-label { color: #dcbec4; }
.metric-card > strong { margin-top: auto; font: 500 56px/1 Georgia, serif; letter-spacing: -.05em; }
.metric-card > p { margin: 9px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.accent > p { color: #ead7db; }
.mini-line { height: 45px; display: flex; align-items: flex-end; gap: 5px; }
.mini-line i { flex: 1; border-radius: 4px 4px 1px 1px; background: #e7d9cb; }
.mini-line i:nth-child(1){height:30%}.mini-line i:nth-child(2){height:48%}.mini-line i:nth-child(3){height:41%}.mini-line i:nth-child(4){height:68%}.mini-line i:nth-child(5){height:61%}.mini-line i:nth-child(6){height:88%;background:var(--apricot)}
.progress-rail { height: 5px; margin-top: auto; border-radius: 5px; background: rgba(255,255,255,.16); overflow: hidden; }
.progress-rail span { display: block; height: 100%; border-radius: inherit; background: var(--apricot); }
.metric-card small { margin-top: 10px; color: #dcbec4; font-size: 10px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; margin-top: 18px; }
.panel { padding: 28px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-heading h2 { margin: 0; font: 500 25px/1.1 Georgia, "Noto Serif KR", serif; letter-spacing: -.025em; }
.step-number { color: #cabfb2; font: 500 30px/1 Georgia, serif; }
form { display: grid; gap: 17px; }
form > label:not(.file-field), fieldset { display: grid; gap: 8px; color: #5d5a53; font-size: 11px; font-weight: 750; }
input[type="text"], input[type="url"], input[name="name"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 14px;
  outline: none;
  background: #fffefa;
  color: var(--ink);
  transition: border .2s ease, box-shadow .2s ease;
}
input:focus { border-color: rgba(125,46,61,.65); box-shadow: 0 0 0 4px rgba(125,46,61,.08); }
.file-field {
  min-height: 80px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px dashed #c9bdaf;
  border-radius: 13px;
  cursor: pointer;
  background: #fbf7ef;
}
.file-field:hover { border-color: var(--wine); }
.file-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: #eaded3; color: var(--wine); font-size: 11px; font-weight: 900; }
.file-field strong, .file-field small { display: block; }
.file-field strong { font-size: 12px; }
.file-field small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; }
.file-action { padding: 8px 11px; border-radius: 8px; background: white; color: var(--wine); font-size: 10px; font-weight: 800; }
fieldset { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; }
legend { margin-bottom: 9px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fffefa; font-size: 11px; font-weight: 750; }
.choice input:checked + span { color: var(--wine); border-color: rgba(125,46,61,.45); background: #f4e9e5; }
.submit-button { width: 100%; min-height: 49px; margin-top: 2px; justify-content: space-between; padding: 0 17px; }
.form-note { margin: -6px 0 0; color: #8f8a80; font-size: 10px; line-height: 1.55; text-align: center; }
.pipeline-panel { background: #e8e1d5; }
.pipeline-list { list-style: none; display: grid; gap: 0; margin: 0; padding: 0; }
.pipeline-list li { position: relative; min-height: 61px; display: grid; grid-template-columns: 38px 1fr; gap: 13px; align-items: start; }
.pipeline-list li::before { content: ""; position: absolute; top: 27px; bottom: -2px; left: 14px; width: 1px; background: #c9bdaf; }
.pipeline-list li:last-child::before { display: none; }
.pipeline-list li > span { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #c9bdaf; border-radius: 50%; color: #8d877c; background: #eee8de; font-size: 8px; font-weight: 850; position: relative; z-index: 1; }
.pipeline-list li.done > span { color: white; border-color: var(--sage); background: var(--sage); }
.pipeline-list li.active > span { color: white; border-color: var(--wine); background: var(--wine); box-shadow: 0 0 0 5px rgba(125,46,61,.09); }
.pipeline-list strong, .pipeline-list small { display: block; }
.pipeline-list strong { font-size: 12px; }
.pipeline-list small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.projects-panel { margin-top: 18px; }
.icon-button { width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 10px; background: #fffefa; color: var(--wine); cursor: pointer; font-size: 19px; }
.project-list { display: grid; gap: 9px; }
.empty-state { padding: 38px 20px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.empty-state > span { margin-bottom: 11px; color: #c2b5a7; font-size: 27px; }
.empty-state strong { color: #5f5b53; font: 500 17px Georgia, "Noto Serif KR", serif; }
.empty-state p { margin: 7px 0 0; font-size: 11px; }
.project-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 1.25fr) auto auto auto;
  align-items: center;
  gap: 18px;
  padding: 15px 17px;
  border: 1px solid #e5ded3;
  border-radius: 13px;
  background: #fffefa;
}
.project-name strong, .project-name small { display: block; }
.project-name strong { font-size: 12px; }
.project-name small, .project-url { margin-top: 4px; color: var(--muted); font-size: 10px; }
.project-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-tags { display: flex; gap: 5px; }
.mode-tags span, .state-badge { padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.mode-tags span { background: #eee8de; color: #6d685f; }
.state-badge { min-width: 92px; text-align: center; color: #7f5d23; background: #f8e9c8; }
.state-badge.ready_for_analysis, .state-badge.succeeded { color: #4a6945; background: #dfeada; }
.state-badge.public_discovery_complete { color: #365f69; background: #dbe9ec; }
.state-badge.awaiting_login { color: #704423; background: #f1dfc9; }
.state-badge.analysis_queued, .state-badge.analyzing_public { color: #665b83; background: #e8e2f1; }
.state-badge.login_session_queued, .state-badge.login_session_starting, .state-badge.verifying_login { color: #665b83; background: #e8e2f1; }
.state-badge.login_session_ready { color: #704423; background: #f1dfc9; }
.state-badge.authenticated { color: #4a6945; background: #dfeada; }
.state-badge.failed, .state-badge.validation_failed, .state-badge.queue_failed, .state-badge.analysis_failed, .state-badge.login_session_failed, .state-badge.login_session_expired { color: #8b3946; background: #f2dce0; }
.project-actions { min-width: 112px; display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.mini-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(125,46,61,.28);
  border-radius: 9px;
  color: var(--wine);
  background: #fbf4ef;
  cursor: pointer;
  font-size: 9px;
  font-weight: 850;
}
.mini-button:hover:not(:disabled) { border-color: var(--wine); background: #f4e7e2; }
.mini-button:disabled { cursor: wait; opacity: .65; }
.mini-button.quiet { color: #4f686d; border-color: #c7d9dc; background: #edf4f5; }
.mini-button.login { color: #fff; border-color: var(--wine); background: var(--wine); }
.mini-button.complete { color: #4a6945; border-color: #bdd1b7; background: #dfeada; cursor: default; opacity: 1; }

.analysis-panel { margin-top: 18px; }
.analysis-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.analysis-summary-grid > div {
  padding: 15px;
  border: 1px solid #e4ddd2;
  border-radius: 12px;
  background: #fbf8f2;
}
.analysis-summary-grid small, .analysis-summary-grid strong { display: block; }
.analysis-summary-grid small { color: var(--muted); font-size: 9px; }
.analysis-summary-grid strong { margin-top: 6px; font-size: 13px; }
.observation-list { display: grid; gap: 8px; }
.observation-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid #e5ded3;
  border-radius: 12px;
  background: #fffefa;
}
.observation-index {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--wine);
  font-size: 8px;
  font-weight: 850;
}
.observation-card strong, .observation-card a, .observation-card small { display: block; }
.observation-card strong { font-size: 12px; }
.observation-card a {
  margin-top: 4px;
  color: var(--wine);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.observation-card small { margin-top: 7px; color: var(--muted); font-size: 9px; }
.observation-card .redirect-note { margin-top: 3px; color: #8b6751; }
.empty-copy { margin: 0; color: var(--muted); font-size: 11px; }

footer { display: flex; justify-content: space-between; margin-top: 24px; color: #9a9489; font-size: 9px; letter-spacing: .03em; }
.toast { position: fixed; right: 25px; bottom: 25px; max-width: 360px; padding: 14px 17px; border-radius: 12px; color: white; background: var(--ink); box-shadow: 0 17px 45px rgba(0,0,0,.2); font-size: 12px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .25s ease; z-index: 20; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #8b3946; }

@media (max-width: 1120px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-card { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px 22px; flex-direction: row; align-items: center; gap: 24px; }
  .sidebar nav { display: flex; margin: 0 0 0 auto; }
  .nav-item { min-height: 40px; padding: 0 10px; }
  .nav-item span:not(.nav-icon) { display: none; }
  .sidebar-foot { display: none; }
  main { padding-top: 30px; }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .topbar { display: grid; }
  .top-actions { width: 100%; justify-content: space-between; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: 1fr; }
  .orbit { display: none; }
  .metric-card { min-height: 205px; }
  .project-row { grid-template-columns: 1fr auto; }
  .project-url { grid-column: 1 / -1; grid-row: 2; }
  .mode-tags { display: none; }
  .project-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .analysis-summary-grid { grid-template-columns: 1fr; }
  footer { display: grid; gap: 7px; }
}
