:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f8;
  color: #18181b;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-soft: #fafafb;
  --ink: #18181b;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --primary: #0f6b5f;
  --primary-dark: #0a5148;
  --amber: #b7791f;
  --blue: #2563eb;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
.app-frame { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 760; color: var(--ink); }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.nav { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 14px; }
.nav a { color: var(--muted); font-weight: 700; }
.user-chip {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff;
}

.page { max-width: 1240px; margin: 0 auto; padding: 34px 28px 70px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.08; letter-spacing: 0; }
h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: 0; }
p { line-height: 1.55; }
.muted { color: var(--muted); margin: 0; }
.lede { color: #475467; font-size: 18px; line-height: 1.55; max-width: 590px; }
.screen-label, .eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  padding: 8px 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 760;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(16, 24, 40, .08); }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel, .mini-card, .queue, .stat, .copy-block, .empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.panel { overflow: hidden; }
.panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-body { padding: 18px; }
.mini-card { padding: 16px; }
.form-stack { display: grid; gap: 16px; }
label { display: block; margin-bottom: 7px; color: #344054; font-size: 13px; font-weight: 740; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15, 107, 95, .12); }
textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
.article-editor { min-height: 520px; font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.62; }
input[type="file"] { border-style: dashed; background: var(--surface-soft); }

.auth-layout {
  min-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px;
  align-items: center;
}
.auth-copy h1 { max-width: 680px; font-size: 52px; }
.auth-card { padding: 24px; }
.narrow { max-width: 520px; margin: 52px auto; }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px; box-shadow: 0 10px 28px rgba(16, 24, 40, .04); }
.stat strong { display: block; font-size: 24px; margin-bottom: 4px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 650; }
.queue { overflow: hidden; }
.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 118px 110px 116px 116px;
  gap: 18px;
  align-items: center;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover { background: var(--surface-soft); }
.queue-title strong { display: block; margin-bottom: 4px; }
.queue-title span, .meta { color: var(--muted); font-size: 13px; }

.status-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 760;
  background: #f2f4f7;
  color: #344054;
}
.status-ready { background: #e6f4f1; color: var(--primary-dark); }
.status-extracted { background: #eff6ff; color: var(--blue); }
.status-uploaded { background: #fff7ed; color: var(--amber); }
.status-failed { background: #fef3f2; color: var(--red); }

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 650px) 320px;
  gap: 28px;
  align-items: start;
  justify-content: center;
}
.upload-panel { padding: 30px; }
.drop-zone {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: center;
}
.process-panel { display: grid; gap: 12px; }
.process-panel div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-weight: 750;
}
.process-panel span {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #e6f4f1;
  color: var(--primary-dark);
}

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.side-stack { display: grid; gap: 14px; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.switch-row input { width: auto; transform: scale(1.15); accent-color: var(--primary); }
.image-list { display: grid; gap: 7px; font-size: 13px; }
.image-list a { color: var(--primary); }
.platform-summary .metric {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.platform-summary .metric:last-child { border-bottom: 0; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 760;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 3px 12px rgba(16, 24, 40, .08); }
.platform-workspace.is-hidden { display: none; }
.block-list { display: grid; gap: 12px; }
.copy-block { overflow: hidden; box-shadow: none; }
.copy-block-highlight { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15, 107, 95, .14); }
.copy-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.copy-block-head strong { font-size: 14px; }
.copy-block-head span { color: var(--muted); font-size: 12px; font-weight: 720; }
.copy-block textarea {
  min-height: 150px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.copy-actions { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }

.messages { display: grid; gap: 10px; margin-bottom: 18px; }
.message { padding: 12px 14px; border-radius: 9px; border: 1px solid #bbdacf; background: #eef8f4; color: var(--primary-dark); }
.message.error { border-color: #fecdca; background: #fff1f0; color: var(--red); }
.errorlist { color: var(--red); margin: 0; }

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 54px 24px;
  text-align: center;
}
.empty-state p { color: var(--muted); margin: 0 0 10px; }
.empty-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

@media (max-width: 900px) {
  .auth-layout, .upload-layout, .workspace, .stat-strip, .queue-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .auth-copy h1 { font-size: 38px; }
  .user-chip { display: none; }
  .topbar { padding: 0 16px; }
  .page { padding: 24px 14px 44px; }
  h1 { font-size: 29px; }
}
