/* Yokai 26.2 — mobile-first dark field UI (One Dark–adjacent) */
:root {
  --bg: #1a1d23;
  --bg-elev: #23272f;
  --bg-input: #2c313c;
  --border: #3e4451;
  --text: #abb2bf;
  --text-strong: #e6e9ef;
  --muted: #7f8794;
  --accent: #61afef;
  --ok: #98c379;
  --warn: #e5c07b;
  --danger: #e06c75;
  --purple: #c678dd;
  --radius: 12px;
  --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #282c34;
  color: var(--ok);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: -0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  color: var(--text-strong);
  font-size: 0.95rem;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  font-size: 0.7rem;
  color: var(--muted);
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.pill-ok {
  color: var(--ok);
  border-color: #3d5a3a;
  background: #243024;
}

.pill-warn {
  color: var(--warn);
  border-color: #5a4a2a;
  background: #302820;
}

.queue-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--warn);
  color: #1a1d23;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.nav-bar {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: #1e2229;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  min-height: 40px;
  cursor: pointer;
}

.nav-link.active {
  color: var(--text-strong);
  background: var(--bg-input);
  border-color: var(--border);
}

.main {
  padding: 0.85rem;
  max-width: 720px;
  margin: 0 auto;
}

.app-footer {
  padding: 1.25rem 1rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  max-width: 720px;
  margin: 0 auto;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.form .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-strong);
}

.field-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-strong);
  font: inherit;
  appearance: none;
}

textarea.input {
  min-height: 110px;
  resize: vertical;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.check-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
}

.check-row input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.warn-check {
  color: var(--warn);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-strong);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 0.35rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: #2a4a6a;
  border-color: #3d6a94;
  color: #d6ebff;
}

.btn-secondary {
  background: #2a3a2a;
  border-color: #3d5a3a;
  color: #d6f0d6;
}

.btn-ghost {
  background: transparent;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-row .btn {
  margin-top: 0;
}

.sticky-submit {
  position: sticky;
  bottom: 0.5rem;
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

.error {
  color: var(--danger);
}

.row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.row.between {
  justify-content: space-between;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.sev-1 { color: var(--ok); border-color: #3d5a3a; }
.sev-2 { color: #b5d48a; }
.sev-3 { color: var(--warn); border-color: #5a4a2a; }
.sev-4 { color: #e0a070; }
.sev-5 { color: var(--danger); border-color: #6a3038; background: #3a2024; }

.badge-tech {
  color: var(--purple);
  border-color: #5a3a6a;
}

.meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.25rem 0 0.4rem;
}

.thumb-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.thumb.missing {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.7rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.stat-cell {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.35rem;
  text-align: center;
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-strong);
}

.stat-label {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.section-title {
  font-size: 0.9rem;
  color: var(--text-strong);
  margin: 0.5rem 0;
}

.list .card {
  margin-bottom: 0.65rem;
}

.toast-host {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}

.toast {
  background: #2c313c;
  border: 1px solid var(--border);
  color: var(--text-strong);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-ok { border-color: #3d5a3a; }
.toast-err { border-color: #6a3038; color: #f0c0c4; }
.toast-info { border-color: #3d5a7a; }

h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--text-strong);
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text-strong);
}

h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--text-strong);
}

.eval-cat {
  margin-top: 0.65rem;
  background: #1e2229;
}

.eval-elements {
  margin: 0.25rem 0 0.75rem 1.1rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.eval-elements li {
  margin-bottom: 0.15rem;
}

.eval-form .btn-ghost {
  margin-bottom: 0.5rem;
  width: auto;
}

.export-sheet-list {
  margin: 0.75rem 0 1rem 1.1rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.export-sheet-list li {
  margin-bottom: 0.25rem;
}

p {
  margin: 0.35rem 0;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .btn-row {
    max-width: 360px;
  }
  .btn:not(.sticky-submit) {
    width: auto;
  }
  .form .btn.sticky-submit {
    width: 100%;
  }
}
