@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #000;
  --surface: #0c0c0c;
  --card: #121212;
  --card-2: #181818;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --muted: #9ca3af;
  --primary: #fff;
  --primary-fg: #000;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 100% 80% at 50% -40%, rgba(255,255,255,0.09), transparent 55%);
  pointer-events: none;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px calc(24px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(0,0,0,0.95) 70%, transparent);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}

.sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.nav-actions { display: flex; gap: 8px; flex-shrink: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
}

.card-accent {
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(180deg, var(--green-bg), var(--card));
}

.hint { color: var(--muted); font-size: 0.88rem; line-height: 1.55; margin: 0 0 14px; }

.hero { text-align: center; padding: 12px 0 28px; }
.hero-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(1.75rem, 7vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 0 0 12px;
}
.hero h1 span { color: var(--muted); display: block; font-size: 0.92em; margin-top: 4px; }
.hero-lead {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 420px;
  margin: 0 auto 20px;
}
.hero-cta { display: flex; flex-direction: column; gap: 10px; max-width: 100%; }

.features { display: grid; gap: 10px; margin-bottom: 16px; }
@media (min-width: 560px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.feature-icon { font-size: 1.4rem; margin-bottom: 6px; }
.feature h3 { margin: 0 0 4px; font-size: 0.92rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.8rem; }

.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
@media (min-width: 560px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: var(--primary-fg);
  font-weight: 700; font-size: 0.78rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
}
.step b { display: block; font-size: 0.82rem; }
.step span { color: var(--muted); font-size: 0.72rem; }

.faq { display: grid; gap: 8px; margin-bottom: 20px; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.faq-item p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.faq-item code { background: var(--surface); padding: 2px 6px; border-radius: 4px; font-size: 0.78rem; }

.progress-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.progress-bar::-webkit-scrollbar { display: none; }
.progress-step {
  flex: 0 0 auto;
  min-width: 130px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--muted);
}
.progress-step b { display: block; color: var(--text); font-size: 0.8rem; margin-bottom: 2px; }
.progress-step.active { border-color: var(--green); background: var(--green-bg); }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field input[type="search"], .field input[type="file"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
}
.field input:focus { outline: none; border-color: #555; }

.grid-add {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 480px) {
  .grid-add { grid-template-columns: 1fr auto; align-items: end; }
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s, opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 10px 16px; font-size: 0.82rem; width: auto; }
.btn-block-sm { width: 100%; }
@media (min-width: 480px) {
  .btn-block-sm { width: auto; min-width: 140px; }
  .hero-cta { flex-direction: row; justify-content: center; }
  .hero-cta .btn { width: auto; min-width: 150px; }
}

.msg { margin-top: 10px; font-size: 0.86rem; min-height: 1.2em; }
.msg.ok { color: var(--green); }
.msg.err { color: #f87171; }

.account-list { display: grid; gap: 10px; margin-top: 8px; }

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.account-item:hover, .account-item:focus-visible {
  border-color: #444;
  background: var(--card-2);
  outline: none;
}
.account-item-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.account-name { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-meta { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.account-meta strong { color: var(--green); font-weight: 600; }
.account-chevron { color: var(--muted); font-size: 1.1rem; flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.upload-zone {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
}
.upload-grid { display: grid; gap: 10px; }
@media (min-width: 480px) { .upload-grid { grid-template-columns: 1fr 1fr; } }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .btn { flex: 1 1 140px; width: auto; }

.job-log {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.84rem;
  color: var(--muted);
  word-break: break-word;
}

.back-link {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 0; margin-bottom: 12px; font: inherit;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; }
table { width: 100%; min-width: 300px; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--border); }
th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

.user-link { color: var(--text); font-weight: 600; text-decoration: none; }
.user-link:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-bg);
  color: #86efac;
}

.hidden { display: none !important; }
.footer { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 24px; }

.auth-card { max-width: 400px; margin: 0 auto; }
.auth-card .btn { margin-top: 4px; }
.auth-card .btn-ghost { margin-top: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-box b { display: block; font-size: 1.2rem; }
.stat-box span { color: var(--muted); font-size: 0.72rem; }

.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.tab-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); border-radius: 999px; padding: 8px 14px;
  font: inherit; font-size: 0.8rem; cursor: pointer; white-space: nowrap;
}
.tab-btn.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }

.detail-header { margin-bottom: 16px; }
.detail-header h2 { margin: 0 0 4px; font-size: 1.25rem; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-head h2 { margin: 0; }

.btn-xs {
  padding: 6px 10px;
  font-size: 0.72rem;
  border-radius: 999px;
  width: auto;
}

.muted-sm { color: var(--muted); font-size: 0.75rem; }

.badge.warn {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
}

.admin-role-btn { white-space: nowrap; }

.guide-card { padding: 0; overflow: hidden; }
.guide-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.guide-toggle[aria-expanded="true"] .guide-chevron { transform: rotate(90deg); }
.guide-chevron { color: var(--muted); transition: transform 0.15s; }
.guide-body { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.guide-steps {
  margin: 14px 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}
.guide-steps li { margin-bottom: 8px; }
.guide-steps a { color: var(--text); }
.guide-steps code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}

.compare-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.compare-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.compare-head strong { font-size: 0.95rem; }
.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 480px) { .compare-grid { grid-template-columns: repeat(4, 1fr); } }
.compare-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.compare-stat b { display: block; font-size: 1.15rem; }
.compare-stat span { color: var(--muted); font-size: 0.68rem; line-height: 1.3; }
.compare-stat.pos b { color: #86efac; }
.compare-stat.neg b { color: #f87171; }
.compare-stat.neu b { color: #fcd34d; }

.compare-tabs { margin-top: 14px; }

.badge.blue {
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
}

.chart-block { margin-bottom: 20px; }
.chart-block:last-child { margin-bottom: 0; }
.chart-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  padding-top: 4px;
}
.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.chart-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.2s;
}
.chart-bar.reg { background: #86efac; }
.chart-bar.imp { background: #93c5fd; }
.chart-bar.log { background: #fcd34d; }
.chart-label {
  font-size: 0.58rem;
  color: var(--muted);
  transform: rotate(-45deg);
  white-space: nowrap;
  margin-top: 8px;
  height: 24px;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--muted);
}
.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
