:root {
  --bg: #eef3f6;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #687384;
  --line: #dfe7ed;
  --blue: #1769e0;
  --green: #17875d;
  --amber: #c67813;
  --red: #c74b45;
  --soft-blue: #eaf2ff;
  --soft-green: #eaf7f1;
  --shadow: 0 18px 46px rgba(28, 47, 73, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  max-width: 1420px;
  margin: 0 auto;
}

.side-panel,
.main-panel,
.metric-card,
.profile-block,
.result-card,
.score-panel {
  background: var(--panel);
  border: 1px solid rgba(132, 150, 170, 0.22);
  box-shadow: var(--shadow);
}

.side-panel {
  position: sticky;
  display: flex;
  flex-direction: column;
  top: 22px;
  height: calc(100vh - 44px);
  padding: 22px;
  border-radius: 8px;
  overflow: auto;
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.account-identity {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.account-identity span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.account-identity small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.account-button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.admin-entry {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.admin-entry[hidden] {
  display: none;
}

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

.quota-item {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.quota-item span {
  color: var(--muted);
  font-size: 12px;
}

.quota-item strong {
  color: var(--ink);
  font-size: 20px;
}

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

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: #182536;
  color: #ffffff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-stack {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-radius: 8px;
  box-shadow: none;
}

.metric-card span {
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  font-size: 24px;
}

.profile-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  box-shadow: none;
}

.contact-card {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 15px 16px;
  border: 1px solid #f0d6a9;
  border-radius: 8px;
  background: #fff8ea;
  color: #8b570f;
  text-decoration: none;
}

.contact-card span {
  font-size: 12px;
  font-weight: 700;
}

.contact-card strong {
  font-size: 18px;
}

.block-title {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.mode-list {
  display: grid;
  gap: 8px;
}

.mode-button {
  height: 42px;
  border-radius: 8px;
  background: #f3f6f9;
  color: #3c495a;
  font-weight: 700;
}

.mode-button.active {
  background: var(--blue);
  color: #ffffff;
}

.main-panel {
  min-height: calc(100vh - 44px);
  padding: 24px;
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h2 {
  margin: 6px 0 0;
  font-size: 28px;
  letter-spacing: 0;
}

.ghost-button,
.primary-button,
.secondary-button {
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.primary-button {
  background: var(--blue);
  color: #ffffff;
}

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

.field,
.editor-block {
  display: grid;
  gap: 8px;
}

.field span,
.editor-block span {
  color: #435166;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fbfcfe;
  color: var(--ink);
}

input {
  height: 44px;
  padding: 0 14px;
}

textarea {
  min-height: 260px;
  padding: 14px;
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: rgba(23, 105, 224, 0.72);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.input-flow {
  display: grid;
  gap: 14px;
}

.jd-input {
  min-height: 180px;
}

.jd-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px 108px;
  gap: 10px;
}

.jd-url-row .secondary-button {
  width: 100%;
  padding: 0 12px;
}

.jd-ocr-button {
  position: relative;
  display: inline-grid;
  width: 100%;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.jd-ocr-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.jd-ocr-button.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.jd-url-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.jd-url-status.success {
  color: #176446;
}

.jd-url-status.error {
  color: var(--red);
}

.jd-url-status.loading {
  color: var(--blue);
}

.resume-source-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(132, 150, 170, 0.22);
  border-radius: 8px;
  background: #ffffff;
}

.source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.source-step {
  display: block;
  color: #435166;
  font-size: 14px;
  font-weight: 800;
}

.upload-button {
  position: relative;
  display: inline-grid;
  min-width: 116px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-status {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.upload-status.success {
  background: var(--soft-green);
  color: #176446;
}

.upload-status.error {
  background: #fff0ef;
  color: var(--red);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.action-row {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}

.result-layout {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.score-panel,
.result-card {
  border-radius: 8px;
  padding: 18px;
}

.score-panel {
  display: grid;
  gap: 20px;
  grid-column: span 2;
  min-height: 330px;
}

.score-ring {
  width: 190px;
  height: 190px;
  margin: 8px auto 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 59%),
    conic-gradient(var(--green) calc(var(--score, 0) * 1%), #dfe7ed 0);
}

.score-ring span {
  display: block;
  margin-top: 18px;
  font-size: 44px;
  font-weight: 900;
}

.score-ring small {
  display: block;
  margin-top: -38px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-item span {
  color: var(--muted);
}

.bar-item div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.bar-item i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.35s ease;
}

.bar-item b {
  text-align: right;
}

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

.insight-card {
  min-height: 330px;
  border-top: 4px solid var(--green);
  box-shadow: none;
}

.keyword-card,
.suggestion-card {
  grid-column: span 2;
}

.suggestion-card {
  border-top-color: var(--amber);
}

.detail-card {
  grid-column: span 3;
  min-height: 460px;
  border-top: 4px solid var(--blue);
}

.optimized-card {
  border-top-color: var(--green);
}

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

.result-head h3 {
  margin: 0;
  font-size: 18px;
}

.result-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #253146;
  font-size: 14px;
  line-height: 1.72;
}

.keyword-section + .keyword-section {
  margin-top: 14px;
}

.sub-title {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--soft-green);
  color: #176446;
  font-size: 13px;
  font-weight: 700;
}

.missing .chip {
  background: #fff2df;
  color: var(--amber);
}

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

.suggestion-list li {
  padding: 12px 14px;
  border-radius: 8px;
  background: #f7f9fb;
  color: #334055;
  font-size: 14px;
  line-height: 1.55;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 23, 36, 0.58);
  backdrop-filter: blur(8px);
}

.auth-dialog {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(10, 24, 42, 0.28);
}

.auth-heading {
  margin-bottom: 22px;
}

.auth-heading > span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.auth-heading h2 {
  margin: 7px 0 8px;
  font-size: 25px;
}

.auth-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.auth-field span {
  color: #435166;
  font-size: 13px;
  font-weight: 800;
}

.auth-error {
  min-height: 22px;
  padding-top: 8px;
  color: var(--red);
  font-size: 13px;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.auth-contact {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 12px;
  }

  .workspace,
  .editor-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    height: auto;
  }

  .contact-card {
    margin-top: 18px;
  }

  .score-panel {
    grid-column: auto;
  }

  .keyword-card,
  .suggestion-card,
  .detail-card {
    grid-column: auto;
  }

  .detail-card {
    min-height: 320px;
  }

  .insight-card {
    min-height: 0;
  }

  .mode-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .topbar,
  .action-row,
  .source-head,
  .jd-url-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .upload-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  h2 {
    font-size: 22px;
  }

  .mode-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-stack {
    grid-template-columns: 1fr;
  }

  .bar-item {
    grid-template-columns: 70px minmax(0, 1fr) 34px;
  }

  .auth-dialog {
    padding: 22px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }
}
