/* Supergenios admin: one column with a bottom tab bar on phones, a side menu on wide screens. */
:root {
  --bg: #f4f2fb; --surface: #ffffff; --surface-2: #ece8f8; --text: #1d1730; --muted: #6b6485;
  --primary: #5b3fd1; --primary-text: #ffffff; --accent: #f5b301; --ok: #1f9d55; --bad: #d64545; --warn: #c47f00;
  --border: #dcd6f0; --radius: 14px; --shadow: 0 2px 10px rgba(30, 20, 70, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14101f; --surface: #1e1830; --surface-2: #2a2242; --text: #efeaff; --muted: #a59dc2;
    --primary: #8f75ff; --primary-text: #120c24; --border: #3a3157; --shadow: 0 2px 10px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.loading { text-align: center; color: var(--muted); padding: 40px; }

/* ---------- layout ---------- */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { color: var(--muted); font-size: 14px; text-align: right; line-height: 1.2; }
main { flex: 1; padding: 16px 16px calc(env(safe-area-inset-bottom) + 90px); max-width: 1200px; width: 100%; margin: 0 auto; }
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 56px;
  text-decoration: none; color: var(--muted); font-size: 11px; position: relative;
}
nav.tabs a .ico { font-size: 22px; line-height: 1; }
nav.tabs a.on { color: var(--primary); font-weight: 700; }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff;
  font-size: 12px; font-weight: 700; text-align: center; line-height: 20px;
}
nav.tabs .badge { position: absolute; top: 4px; left: 55%; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 230px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / 3; }
  nav.tabs {
    position: sticky; top: 61px; bottom: auto; flex-direction: column; height: calc(100vh - 61px);
    border-top: 0; border-right: 1px solid var(--border); padding: 12px 8px;
  }
  nav.tabs a { flex: none; flex-direction: row; gap: 12px; font-size: 15px; padding: 12px 14px; min-height: 0; border-radius: 10px; }
  nav.tabs a.on { background: var(--surface-2); }
  nav.tabs .badge { position: static; margin-left: auto; }
  main { padding: 24px; }
}

/* ---------- building blocks ---------- */
h2 { font-size: 22px; margin: 4px 0 14px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 140px; }
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.bad { background: var(--bad); color: #fff; border-color: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.link { background: none; border: 0; color: var(--primary); padding: 0 6px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
label.field { display: block; font-size: 14px; color: var(--muted); }
label.field > * { margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.chip.lang { font-weight: 700; text-transform: uppercase; font-size: 11px; }
.status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; }
.status.approved { background: var(--ok); } .status.rejected { background: var(--bad); }
.status.pending, .status.proposed { background: var(--warn); }
.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 600; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.filters .wide { grid-column: 1 / -1; }
@media (min-width: 700px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr; } .filters .wide { grid-column: auto; } }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- summary ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 14px; }

/* ---------- images ---------- */
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column;
}
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: block; }
.tile .info { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.tile .words { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* ---------- lists ---------- */
.list > .item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.list > .item + .item { margin-top: 10px; }
.item .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item .title { font-weight: 700; }
.thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.terms { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.term { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 6px 6px 12px; }
.term span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.clue { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.clue:first-of-type { border-top: 0; margin-top: 4px; padding-top: 4px; }

/* ---------- sheet (bottom sheet on phones, dialog on wide screens) ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 25, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); animation: up .18s ease-out;
}
.sheet .close { float: right; }
.sheet img.big { width: 100%; max-height: 45vh; object-fit: contain; background: var(--surface-2); border-radius: 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 900px) {
  .overlay { align-items: center; }
  .sheet { width: 720px; border-radius: 20px; max-height: 88vh; }
}

/* ---------- login ---------- */
.login { max-width: 380px; margin: 8vh auto; padding: 0 16px; }
.login .logo { font-size: 54px; text-align: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 6px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#google-btn { display: flex; justify-content: center; min-height: 44px; }
.error { color: var(--bad); font-weight: 600; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 80px); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 60; opacity: 0;
  transition: .2s; pointer-events: none; max-width: 90vw; text-align: center; font-weight: 600;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { #toast { bottom: 30px; } }

/* ---------- history ---------- */
.history { display: flex; flex-direction: column; gap: 8px; }
.hist { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }

/* ---------- quick review ---------- */
.quick { max-width: 560px; margin: 0 auto; }
.quick-card { display: flex; flex-direction: column; gap: 10px; }
.quick-photo {
  width: 100%; height: min(58vh, 520px); object-fit: contain; background: var(--surface-2); border-radius: 12px;
  touch-action: pan-y; transition: transform .15s, opacity .15s; user-select: none; -webkit-user-drag: none;
}
.quick-words { font-size: 24px; font-weight: 800; text-align: center; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.big { min-height: 60px; font-size: 18px; border-radius: 16px; }
.quick-help { text-align: center; font-size: 13px; margin-top: 14px; }
