/* Polaris Developer Portal — vanilla CSS, no external fonts/CDN */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #677589;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.boot { padding: 64px; text-align: center; color: var(--muted); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

header.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
}
.spacer { flex: 1; }

.lang-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.lang-toggle button {
  border: 0; background: var(--panel); color: var(--muted);
  padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.lang-toggle button.active { background: var(--primary); color: #fff; }

.user-email { color: var(--muted); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.body-wrap { flex: 1; display: flex; max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px; gap: 24px; }

nav.sidebar {
  width: 220px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 4px;
}
nav.sidebar button {
  text-align: left; border: 0; background: transparent; color: var(--text);
  padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
}
nav.sidebar button:hover { background: #eef2f7; }
nav.sidebar button.active { background: #e0e9ff; color: var(--primary); font-weight: 600; }

main.content { flex: 1; min-width: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.section-head .sub { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn:hover { background: #f0f3f8; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Table ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.tbl td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: #334155; }
.notes-cell { color: var(--muted); max-width: 280px; }

.empty { text-align: center; padding: 40px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.badge.pending  { background: #eef1f5; color: #475569; }
.badge.scanned  { background: #dbeafe; color: #1d4ed8; }
.badge.approved { background: #dcfce7; color: #15803d; }
.badge.rejected { background: #fee2e2; color: #b91c1c; }
.badge.unknown  { background: #f1f5f9; color: #64748b; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed #c3cdd9; border-radius: var(--radius);
  padding: 40px 20px; text-align: center; color: var(--muted);
  background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--primary); background: #eff4ff; }
.dropzone .big { font-size: 15px; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.dropzone .file-name { margin-top: 12px; font-weight: 600; color: var(--primary); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 40px; max-width: 420px; width: 100%; text-align: center; }
.login-card .logo-lg { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px; background: linear-gradient(135deg, #2563eb, #7c3aed); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 24px; }
.login-card h1 { font-size: 22px; margin: 0 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card .lang-toggle { margin-top: 20px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { background: #1f2733; color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.18); font-size: 14px; max-width: 340px; animation: slidein .2s ease; }
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 20px; }
.modal { background: var(--panel); border-radius: 14px; padding: 24px; max-width: 460px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal textarea { width: 100%; min-height: 90px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: inherit; font-size: 14px; resize: vertical; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- Filter / misc ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
select.filter { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 14px; background: var(--panel); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Guide ---------- */
.guide h3 { margin-top: 24px; font-size: 16px; }
.guide h3:first-child { margin-top: 0; }
.guide p, .guide li { color: #374151; }
.guide pre { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 10px; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
.guide code.inline { background: #eef2f7; padding: 1px 6px; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.guide ul { padding-left: 20px; }
.guide .danger-list li { color: #b91c1c; }
.scan-pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; font-size: 12px; overflow-x: auto; margin-top: 10px; }

/* ====================================================================== */
/* Public site (landing + docs)                                           */
/* ====================================================================== */
.pub-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Public top nav ---------- */
header.topbar.pub { gap: 22px; }
header.topbar a.brand { text-decoration: none; color: var(--text); }
header.topbar a.brand:hover { text-decoration: none; }
.pub-links { display: flex; gap: 6px; }
.pub-links a {
  color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
}
.pub-links a:hover { background: #eef2f7; text-decoration: none; }
.pub-links a.active { color: var(--primary); background: #e0e9ff; }
.pub-link-inline { color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.pub-link-inline:hover { background: #eef2f7; text-decoration: none; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn:hover { text-decoration: none; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.65); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.12); }

/* ---------- Landing ---------- */
.landing { flex: 1; }
.hero {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%);
  color: #fff; padding: 88px 24px 96px;
}
.hero-inner { max-width: 820px; margin: 0 auto; text-align: center; }
.hero h1 { font-size: 46px; line-height: 1.1; margin: 0 0 18px; font-weight: 800; letter-spacing: -0.02em; }
.hero-sub { font-size: 18px; line-height: 1.6; color: rgba(255,255,255,.92); margin: 0 auto 30px; max-width: 680px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn.primary { background: #fff; color: var(--primary); border-color: #fff; }
.hero-cta .btn.primary:hover { background: #f1f5ff; }

.section { max-width: 1080px; margin: 0 auto; padding: 64px 24px; }
.section.alt { background: #f7f9fc; max-width: none; }
.section.alt > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.sec-title { text-align: center; font-size: 28px; font-weight: 800; margin: 0 0 36px; letter-spacing: -0.01em; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feature-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 24px 22px;
}
.feature-card .ficon {
  width: 44px; height: 44px; border-radius: 11px; margin-bottom: 14px;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.steps.vert { grid-template-columns: 1fr; gap: 14px; max-width: 760px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: #e0e9ff; color: var(--primary); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.step h4 { margin: 2px 0 5px; font-size: 15px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.code-block {
  background: #0f172a; color: #e2e8f0; padding: 18px 20px; border-radius: 12px;
  overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; margin: 0;
}
.code-block.teaser { max-width: 760px; margin: 0 auto; }

/* ---------- Public footer ---------- */
.pub-footer { background: #0f172a; color: #cbd5e1; margin-top: auto; }
.foot-inner {
  max-width: 1080px; margin: 0 auto; padding: 44px 24px 28px;
  display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between;
}
.foot-brand { max-width: 320px; }
.foot-brand .logo { vertical-align: middle; }
.foot-brand strong { margin-left: 10px; font-size: 16px; color: #fff; }
.foot-brand p { margin: 12px 0 0; font-size: 14px; color: #94a3b8; }
.foot-links { display: flex; flex-direction: column; gap: 10px; }
.foot-links a { color: #cbd5e1; font-size: 14px; }
.foot-links a:hover { color: #fff; }
.foot-copy { border-top: 1px solid #1e293b; text-align: center; padding: 18px; font-size: 13px; color: #94a3b8; }

/* ---------- Docs ---------- */
.docs-wrap { flex: 1; display: flex; max-width: 1180px; width: 100%; margin: 0 auto; padding: 28px 24px; gap: 36px; align-items: flex-start; }
.docs-side {
  width: 230px; flex-shrink: 0; position: sticky; top: 84px;
  display: flex; flex-direction: column; gap: 2px;
}
.docs-side-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 12px 8px; }
.doc-link { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500; }
.doc-link:hover { background: #eef2f7; text-decoration: none; }
.doc-link.active { background: #e0e9ff; color: var(--primary); font-weight: 600; }

.docs-content { flex: 1; min-width: 0; max-width: 760px; }
.docs-content h1 { font-size: 30px; margin: 0 0 18px; letter-spacing: -0.01em; }
.docs-content h3 { font-size: 17px; margin: 28px 0 10px; }
.docs-content p { color: #374151; }
.docs-content .note { background: #f0f7ff; border-left: 3px solid var(--primary); padding: 10px 14px; border-radius: 6px; color: #334155; }

.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 14px 0; }
.doc-table th { text-align: left; background: #f1f5f9; color: var(--text); font-weight: 700; padding: 10px 12px; border: 1px solid var(--border); font-size: 13px; }
.doc-table td { padding: 10px 12px; border: 1px solid var(--border); vertical-align: top; color: #374151; }
.doc-table .code, .docs-content .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: #1d4ed8; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .body-wrap { flex-direction: column; padding: 14px; gap: 14px; }
  nav.sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  nav.sidebar button { white-space: nowrap; }
  .user-email { display: none; }
  header.topbar { padding: 0 14px; }
  table.tbl { font-size: 13px; }
  table.tbl th, table.tbl td { padding: 8px; }

  header.topbar.pub { gap: 12px; flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .pub-links { order: 3; width: 100%; }
  .pub-links a { padding: 6px 10px; }
  .pub-link-inline { display: none; }
  .hero { padding: 56px 18px 64px; }
  .hero h1 { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .section { padding: 44px 18px; }
  .sec-title { font-size: 23px; }
  .feature-grid, .steps { grid-template-columns: 1fr; }

  .docs-wrap { flex-direction: column; padding: 16px; gap: 16px; }
  .docs-side { width: 100%; position: static; flex-direction: row; overflow-x: auto; gap: 6px; }
  .docs-side-head { display: none; }
  .doc-link { white-space: nowrap; }
  .docs-content { max-width: none; }
}
