/* Korpa admin, Pijaca tokens (android/app/src/main/java/ai/korpa/app/ui/theme/KorpaTokens.kt). */
:root {
  --surface: #F3F6EA; --raised: #FFFFFF; --sunken: #E6EBDB; --line: #7F9180;
  --ink: #12291B; --muted: #4F5E54; --brand: #CDEB5A; --on-brand: #12291B; --on-brand-muted: #2E4A1F;
  --action: #12291B; --on-action: #FFFFFF; --accent: #CDEB5A; --link: #1E7A46;
  --excellent: #5CC46E; --good: #A8D86A; --poor: #F2A33A; --bad: #F0705A;
  --good-text: #3F6B14; --poor-text: #9A4D00; --bad-text: #B3261E;
  --r-sm: 14px; --r-md: 18px; --r-lg: 24px; --r-xl: 32px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0F1D14; --raised: #18291E; --sunken: #22362A; --line: #6E8673;
    --ink: #EDF3E4; --muted: #A9B9A6; --action: #CDEB5A; --on-action: #12291B; --accent: #12291B; --link: #B9E07A;
    --good-text: #B9E07A; --poor-text: #F5B35A; --bad-text: #FF8A75;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface); color: var(--ink); font: 15px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: "Bricolage Grotesque", Inter, sans-serif; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, .mono { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.nav { background: var(--action); color: var(--on-action); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
@media (prefers-color-scheme: dark) { .nav { background: var(--raised); color: var(--ink); } }
.wordmark { font: 800 26px "Bricolage Grotesque", sans-serif; padding: 0 10px 18px; letter-spacing: -0.03em; }
.wordmark span { color: var(--brand); }
.nav a { color: inherit; padding: 10px 12px; border-radius: 999px; display: flex; justify-content: space-between; align-items: center; opacity: .86; }
.nav a:hover { text-decoration: none; opacity: 1; background: rgba(205, 235, 90, .14); }
.nav a.on { background: var(--brand); color: var(--on-brand); opacity: 1; font-weight: 600; }
.nav .count { font-size: 12px; font-weight: 600; background: var(--brand); color: var(--on-brand); border-radius: 999px; padding: 1px 8px; }
.nav a.on .count { background: var(--on-brand); color: var(--brand); }
.nav .me { margin-top: auto; font-size: 13px; opacity: .8; padding: 10px 12px; }
.nav .me button { margin-top: 8px; }
main { padding: 26px 32px 60px; max-width: 1240px; width: 100%; }
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.top h1 { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; background: var(--raised); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px; width: 360px; }
form.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; flex: 1; padding: 0; width: auto; }
.kbd { font: 600 11px Inter; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); }

/* blocks */
.card { background: var(--raised); border-radius: var(--r-lg); padding: 18px 20px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.stat { background: var(--raised); border-radius: var(--r-lg); padding: 18px 20px; display: block; color: inherit; }
.stat:hover { text-decoration: none; outline: 2px solid var(--brand); }
.stat .n { font: 800 34px "Bricolage Grotesque", sans-serif; }
.stat.hot { background: var(--brand); color: var(--on-brand); }
.stat.hot .muted { color: var(--on-brand-muted); }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: var(--sunken); color: var(--ink); white-space: nowrap; }
.chip.brand { background: var(--brand); color: var(--on-brand); }
.chip.poor { background: var(--poor); color: #12291B; }
.chip.bad { background: var(--bad); color: #12291B; }
.chip.good { background: var(--good); color: #12291B; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.score { min-width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font: 800 18px "Bricolage Grotesque"; color: #12291B; background: var(--sunken); }
.score.excellent { background: var(--excellent); } .score.good { background: var(--good); } .score.poor { background: var(--poor); } .score.bad { background: var(--bad); }

/* buttons, inputs */
button, .btn { font: 600 14px Inter; border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; background: var(--action); color: var(--on-action); display: inline-flex; align-items: center; gap: 8px; }
button.secondary { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
button.accent { background: var(--brand); color: var(--on-brand); }
button.danger { background: var(--bad); color: #12291B; }
button:disabled { opacity: .45; cursor: default; }
button .k { font-size: 11px; opacity: .7; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; }
input[type=text], input:not([type]), textarea, select { font: inherit; color: var(--ink); background: var(--raised); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--sunken); }
td { padding: 10px; border-bottom: 1px solid var(--sunken); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sunken); }

/* diff */
.diff td.old { color: var(--muted); text-decoration: line-through; }
.diff td.new { font-weight: 600; }
.diff tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.warn { color: var(--bad-text); font-weight: 600; }

/* queue */
.queue { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.qlist { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 120px); overflow: auto; position: sticky; top: 20px; }
.qitem { background: var(--raised); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; border: 2px solid transparent; }
.qitem.on { border-color: var(--brand); }
.qitem .name { font-weight: 600; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos img { width: 100%; height: 220px; object-fit: contain; background: var(--sunken); border-radius: var(--r-md); cursor: zoom-in; }
.zoom { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; }
.zoom img { max-width: 96vw; max-height: 96vh; }
.decide { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 4px; }
.reasons { display: flex; gap: 6px; flex-wrap: wrap; }
.reasons .chip { cursor: pointer; }

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.ver { background: var(--raised); border-radius: var(--r-lg); padding: 14px 18px; display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: start; }
.ver.public { outline: 2px solid var(--brand); }
.ver .n { font: 800 22px "Bricolage Grotesque"; color: var(--muted); }

/* changed by people */
.changed { display: grid; grid-template-columns: auto 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.changed .thumb { width: 56px; height: 56px; border-radius: 14px; background: var(--sunken); object-fit: contain; display: block; }
.changed .pick, #all { width: 20px; height: 20px; accent-color: var(--action); }
.bulk { flex-wrap: wrap; gap: 10px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--action); color: var(--on-action); padding: 12px 20px; border-radius: 999px; font-weight: 600; z-index: 20; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login .card { width: 420px; padding: 34px; display: flex; flex-direction: column; gap: 16px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.only-phone { display: none; }
.decide .grow { flex: 1; }
.nav .me .who { display: block; margin-bottom: 8px; }

/* Phones: one column, the menu as a strip on top, the queue as list then item, tables as cards. */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .nav {
    position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 6px;
    padding: 10px 12px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .wordmark { font-size: 22px; padding: 0 6px 0 4px; flex: none; }
  .nav a { flex: none; padding: 9px 14px; white-space: nowrap; gap: 6px; min-height: 40px; }
  .nav .me { margin: 0 0 0 auto; padding: 0; flex: none; }
  .nav .me .who { display: none; }
  .nav .me button { margin: 0; }
  main { padding: 16px 16px 72px; }
  h1 { font-size: 26px; }
  .top { flex-wrap: wrap; margin-bottom: 16px; }
  .search { width: 100%; }
  .search .kbd { display: none; }
  input[type=text], input:not([type]), textarea, select { font-size: 16px; }
  button, .btn { min-height: 44px; justify-content: center; }
  .card { padding: 16px; }
  .login .card { width: auto; max-width: 420px; margin: 16px; padding: 24px; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat .n { font-size: 28px; }

  .queue { grid-template-columns: 1fr; }
  .qlist { position: static; max-height: none; }
  .queue.open .qlist { display: none; }
  .queue:not(.open) #qdetail { display: none; }
  .only-phone { display: inline-flex; align-self: flex-start; }
  .qitem { padding: 14px 16px; }
  .photos { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 80%; overflow-x: auto; scroll-snap-type: x mandatory; }
  .photos img { height: 240px; scroll-snap-align: start; }
  .decide { bottom: 0; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .12); }
  .decide .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .decide .grow { display: none; }
  .diff th, .diff td { padding: 8px 6px; font-size: 14px; word-break: break-word; }
  .diff input { font-size: 16px; }

  .ver { grid-template-columns: 40px minmax(0, 1fr); padding: 14px; }
  .ver > :last-child { grid-column: 1 / -1; flex-direction: row !important; align-items: center !important; justify-content: flex-end; flex-wrap: wrap; }
  .card.row { flex-wrap: wrap; }

  .changed { grid-template-columns: auto 48px minmax(0, 1fr); gap: 10px 12px; }
  .changed .thumb { width: 48px; height: 48px; }
  .changed .actions { grid-column: 1 / -1; flex-direction: row !important; justify-content: space-between; align-items: center !important; }
  .bulk > .row { width: 100%; justify-content: space-between; }

  /* A table row becomes a small card with each value under its label. */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 12px 0; border-bottom: 1px solid var(--sunken); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { border: 0; padding: 3px 0; }
  table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
  table.cards td.actions { display: flex; gap: 12px; align-items: center; padding-top: 8px; }
  .toast { bottom: calc(22px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }
}

/* Touch screens have no keyboard shortcuts. */
@media (hover: none) {
  .keys, button .k { display: none; }
}
